adding baseline circ matrix models
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 4 Feb 2008 21:22:27 +0000 (21:22 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 4 Feb 2008 21:22:27 +0000 (21:22 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8610 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/admin/ils_admin/setup/ils_data/models.py

index 42e4ba2..dac4f05 100644 (file)
@@ -220,6 +220,36 @@ class HoursOfOperation(models.Model):
     Config tables
     -------------------------------------------------------------- """
 
+class CircModifier(models.Model):
+    code = models.CharField(maxlength=CHAR_MAXLEN)
+    name = models.CharField(maxlength=CHAR_MAXLEN)
+    description = models.CharField(maxlength=CHAR_MAXLEN);
+    sip2_media_type = models.CharField(maxlength=CHAR_MAXLEN);
+    magnetic_media = models.BooleanField()
+    class Admin:
+        search_fields = ['name','code']
+        list_display = ('code','name','description','sip2_media_type','magnetic_media')
+    class Meta:
+        db_table = 'circ_modifier'
+        ordering = ['name']
+        verbose_name = _('Circulation Modifier')
+    def __str__(self):
+        return self.name
+
+
+class VideoRecordingFormat(models.Model):
+    code = models.CharField(maxlength=CHAR_MAXLEN)
+    value = models.CharField(maxlength=CHAR_MAXLEN, help_text=INTERVAL_HELP_TEXT);
+    class Admin:
+        search_fields = ['value','code']
+        list_display = ('value','code')
+    class Meta:
+        db_table = 'videorecording_format_map'
+        ordering = ['code']
+        verbose_name = _('Video Recording Format')
+    def __str__(self):
+        return self.value
+
 class RuleCircDuration(models.Model):
     name = models.CharField(maxlength=CHAR_MAXLEN)
     extended = models.CharField(maxlength=CHAR_MAXLEN, help_text=INTERVAL_HELP_TEXT);
@@ -236,6 +266,70 @@ class RuleCircDuration(models.Model):
     def __str__(self):
         return self.name
 
+class CircMatrixMatchpoint(models.Model):
+    active = models.BooleanField()
+    org_unit_id = models.ForeignKey(OrgUnit, db_column='org_unit')
+    grp_id = models.ForeignKey(GrpTree, db_column='grp')
+    circ_modifier_id = models.ForeignKey(CircModifier, db_column='circ_modifier')
+    marc_type_id = models.ForeignKey('ItemTypeMap', db_column='marc_type')
+    marc_form_id = models.ForeignKey('ItemFormMap', db_column='marc_form')
+    marc_vr_format_id = models.ForeignKey('VideoRecordingFormat', db_column='marc_vr_format')
+    ref_flag = models.BooleanField()
+    usr_age_lower_bound = models.CharField(maxlength=CHAR_MAXLEN, help_text=INTERVAL_HELP_TEXT);
+    usr_age_upper_bound = models.CharField(maxlength=CHAR_MAXLEN, help_text=INTERVAL_HELP_TEXT);
+    class Admin:
+        list_display = ('org_unit_id','grp_id','circ_modifier_id','marc_type_id','marc_form_id','marc_vr_format_id','ref_flag','usr_age_lower_bound','usr_age_upper_bound')
+        list_filter = ['grp_id','org_unit_id','circ_modifier_id','marc_type_id','marc_form_id','marc_vr_format_id']
+    class Meta:
+        db_table = 'circ_matrix_matchpoint'
+        ordering = ['name']
+        verbose_name = _('Circulation Matrix Matchpoint')
+    def __str__(self):
+        return _("OrgUnit: %s, Group: %s, Circ Modifier: %s") % (self.org_unit_id, self.grp_id, self.circ_modifier_id)
+
+class CircMatrixTest(models.Model)
+    matchpoint_id =  models.ForeignKey(CircMatrixMatchpoint, db_column='matchpoint')
+    max_items_out = models.IntegerField()
+    max_overdue = models.IntegerField()
+    max_fines = FloatField(max_digits=8, decimal_places=2)
+    script_test = models.CharField(maxlength=CHAR_MAXLEN);
+    class Admin:
+        list_display = ('matchpoint_id','max_items_out','max_overdue','max_fines','script_test')
+    class Meta:
+        db_table = 'circ_matrix_test'
+        ordering = ['matchpoint_id']
+        verbose_name = _('Circ Matrix Test')
+    def __str__(self):
+        return self.matchpoint_id + _(", Max Items Out: %s, Max Overdue: %s, Max Fines: %s") % (self.max_items_out, self.max_overdue, self.max_fines)
+
+class CircMatrixCircModTest(models.Model)
+    matchpoint_id =  models.ForeignKey(CircMatrixMatchpoint, db_column='matchpoint')
+    items_out = models.IntegerField()
+    circ_mod_id = models.ForeignKey(CircModifier, db_column='circ_mod')
+    class Admin:
+        search_fields = ['circ_mod_id']
+        list_display = ('matchpoint_id','circ_mod_id','items_out')
+    class Meta:
+        db_table = 'circ_matrix_circ_mod_test'
+        ordering = ['name']
+        verbose_name = _('Circ Matrix Items Out Cirulation Modifier Subtest')
+    def __str__(self):
+        return self.matchpoint_id + _(", Restrict: ") + self.circ_mod_id
+
+class CircMatrixRuleSet(models.Model)
+    matchpoint_id =  models.ForeignKey(CircMatrixMatchpoint, db_column='matchpoint')
+    duration_rule_id = models.ForeignKey(RuleCircDuration, db_column='duration_rule')
+    recurring_fine_rule_id = models.ForeignKey(RuleRecurringFine, db_column='recurring_fine_rule')
+    max_fine_rule_id = models.ForeignKey(RuleMaxFine, db_column='max_fine_rule')
+    class Admin:
+        search_fields = ['matchoint_id']
+        list_display = ('matchpoint_id','duration_rule_id','recurring_fine_rule_id','max_fine_rule_id')
+    class Meta:
+        db_table = 'circ_matrix_circ_mod_test'
+        ordering = ['name']
+        verbose_name = _('Circ Matrix Items Out Cirulation Modifier Subtest')
+    def __str__(self):
+        return self.matchpoint_id + _(", Restrict: ") + self.circ_mod_id
 
 class RuleMaxFine(models.Model):
     name = models.CharField(maxlength=CHAR_MAXLEN)