Bug 24584: Rewrite optional/sample_creator_data to YAML
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Wed, 5 Feb 2020 12:35:53 +0000 (09:35 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 9 Mar 2020 13:54:38 +0000 (13:54 +0000)
YAML version of optional sample_creator_data

To test:
1) Same test plan of first patch, only check tables
   creator_layouts, creator_templates and printers_profile

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

installer/data/mysql/en/optional/sample_creator_data.sql [deleted file]
installer/data/mysql/en/optional/sample_creator_data.txt [deleted file]
installer/data/mysql/en/optional/sample_creator_data.yml [new file with mode: 0644]

diff --git a/installer/data/mysql/en/optional/sample_creator_data.sql b/installer/data/mysql/en/optional/sample_creator_data.sql
deleted file mode 100644 (file)
index 2601946..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-
-LOCK TABLES `creator_layouts` WRITE;
-INSERT INTO `creator_layouts` (`layout_id`, `barcode_type`, `start_label`, `printing_type`, `layout_name`, `guidebox`, `font`, `font_size`, `units`, `callnum_split`, `text_justify`, `format_string`, `layout_xml`, `creator`) VALUES (17,'CODE39',1,'BIBBAR','Label Test',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(18,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(19,'CODE39',1,'BAR','DEFAULT',0,'TR',3,'POINT',0,'L','title, author, isbn, issn, itemtype, barcode, itemcallnumber','<opt></opt>','Labels'),(20,'CODE39',1,'BAR','Test Layout',0,'TR',10,'POINT',0,'L','barcode','<opt page_side="F" units="POINT">
-  <images name="image_1" Dx="72" Ox="0" Oy="0" Sx="0" Sy="0" Tx="4.5" Ty="63">
-    <data_source image_name="none" image_source="patronimages" />
-  </images>
-  <text>&lt;firstname&gt; &lt;surname&gt;</text>
-  <text enable="1" font="TR" font_size="10" llx="100" lly="100" text_alignment="L" />
-  <text>Branch: &lt;branchcode&gt;</text>
-  <text enable="1" font="TR" font_size="10" llx="100" lly="75" text_alignment="L" />
-  <text>Expires: August 31, 2010</text>
-  <text font="TR" font_size="6" llx="115" lly="65" text_alignment="L" />
-</opt>
-','Patroncards');
-UNLOCK TABLES;
-
-
-LOCK TABLES `creator_templates` WRITE;
-INSERT INTO `creator_templates` VALUES (1,1,'Avery 5160 | 1 x 2-5/8','3 columns, 10 rows of labels',8.5,11,2.63,1,0.139,0,0.35,0.23,3,10,0.13,0,'INCH','Labels'),(7,13,'Demco WS14942260','1\" X 1.5\" Spine Label | Setup for up to four lines of text',8.5,11,1.5,1,0.236,0,0.5,0.25,5,10,0.0625,0,'INCH','Labels'),(12,14,'Demco WS14942260','1\" X 1.5\" Spine Label | Setup for five lines of text',8.5,11,1.5,1,0.139,0,0.53,0.3,5,10,0.0625,0,'INCH','Labels'),(22,0,'DEFAULT TEMPLATE 01','Default description',0,5,0,0,0,0,0,0,0,0,0,0,'POINT','Labels'),(23,16,'HB-PC0001','A template for home brewed patron card forms',8.5,11,3.1875,1.9375,0,0,0.6875,0.875,2,4,0.4375,0.1875,'INCH','Patroncards');
-UNLOCK TABLES;
-
-LOCK TABLES `printers_profile` WRITE;
-INSERT INTO `printers_profile` ( profile_id, printer_name, template_id, paper_bin, offset_horz, offset_vert, creep_horz, creep_vert, units, creator ) VALUES
-( 1,'Library Laser',   1,'Bypass', -2,9,3,0,'POINT','Labels'),
-(13,'Library Laser',   7,'Tray 1',  0,0,0,0,'POINT','Labels'),
-(14,'Library Laser',  12,'Tray 2',  0,0,0,0,'POINT','Labels'),
-(16,'Test Printer 01',23,'Test Bin',0,0,0,0,'POINT','Patroncards'),
-(22,'Library Laser',   0,'Tray 3',  0,0,0,0,'POINT','Labels');
-UNLOCK TABLES;
-
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
diff --git a/installer/data/mysql/en/optional/sample_creator_data.txt b/installer/data/mysql/en/optional/sample_creator_data.txt
deleted file mode 100644 (file)
index 7dc5fcf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sample label and patron card data
diff --git a/installer/data/mysql/en/optional/sample_creator_data.yml b/installer/data/mysql/en/optional/sample_creator_data.yml
new file mode 100644 (file)
index 0000000..8ac78b6
--- /dev/null
@@ -0,0 +1,259 @@
+---
+#
+#  Copyright 2020 Koha Development Team
+#
+#  This file is part of Koha.
+#
+#  Koha is free software; you can redistribute it and/or modify it under the
+#  terms of the GNU General Public License as published by the Free Software
+#  Foundation; either version 2 of the License, or (at your option) any later
+#  version.
+#
+#  Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+#  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with Koha; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+description:
+  - "Sample label and patron card data"
+
+tables:
+  - creator_layouts:
+      translatable: [ layout_name, layout_xml ]
+      multiline: [ layout_xml ]
+      rows:
+        - layout_id: 17
+          barcode_type: CODE39
+          start_label: 1
+          printing_type: BIBBAR
+          layout_name: "Label Test"
+          guidebox: 0
+          font: TR
+          font_size: 3
+          units: POINT
+          callnum_split: 0
+          text_justify: L
+          format_string: "title, author, isbn, issn, itemtype, barcode, itemcallnumber"
+          layout_xml:
+            - "<opt></opt>"
+          creator: "Labels"
+
+        - layout_id: 18
+          barcode_type: CODE39
+          start_label: 1
+          printing_type: BAR
+          layout_name: "DEFAULT"
+          guidebox: 0
+          font: TR
+          font_size: 3
+          units: POINT
+          callnum_split: 0
+          text_justify: L
+          format_string: "title, author, isbn, issn, itemtype, barcode, itemcallnumber"
+          layout_xml:
+            - "<opt></opt>"
+          creator: "Labels"
+
+        - layout_id: 19
+          barcode_type: CODE39
+          start_label: 1
+          printing_type: BAR
+          layout_name: "DEFAULT"
+          guidebox: 0
+          font: TR
+          font_size: 3
+          units: POINT
+          callnum_split: 0
+          text_justify: L
+          format_string: "title, author, isbn, issn, itemtype, barcode, itemcallnumber"
+          layout_xml:
+            - "<opt></opt>"
+          creator: "Labels"
+
+        - layout_id: 20
+          barcode_type: CODE39
+          start_label: 1
+          printing_type: BAR
+          layout_name: "Test Layout"
+          guidebox: 0
+          font: TR
+          font_size: 10
+          units: POINT
+          callnum_split: 0
+          text_justify: L
+          format_string: "barcode"
+          layout_xml:
+            - "<opt page_side=\"F\" units=\"POINT\">"
+            - "  <images name=\"image_1\" Dx=\"72\" Ox=\"0\" Oy=\"0\" Sx=\"0\" Sy=\"0\" Tx=\"4.5\" Ty=\"63\">"
+            - "    <data_source image_name=\"none\" image_source=\"patronimages\" />"
+            - "  </images>"
+            - "  <text>&lt;firstname&gt; &lt;surname&gt;</text>"
+            - "  <text enable=\"1\" font=\"TR\" font_size=\"10\" llx=\"100\" lly=\"100\" text_alignment=\"L\" />"
+            - "  <text>Branch: &lt;branchcode&gt;</text>"
+            - "  <text enable=\"1\" font=\"TR\" font_size=\"10\" llx=\"100\" lly=\"75\" text_alignment=\"L\" />"
+            - "  <text>Expires: August 31, 2010</text>"
+            - "  <text font=\"TR\" font_size=\"6\" llx=\"115\" lly=\"65\" text_alignment=\"L\" />"
+            - "</opt>"
+          creator: "Patroncards"
+
+  - creator_templates:
+      translatable: [ template_desc ]
+      multiline: [ ]
+      rows:
+        - template_id: 1
+          profile_id: 1
+          template_code: "Avery 5160 | 1 x 2-5/8"
+          template_desc: "3 columns, 10 rows of labels"
+          page_width: 8.5
+          page_height: 11
+          label_width: 2.63
+          label_height: 1
+          top_text_margin: 0.139
+          left_text_margin: 0
+          top_margin: 0.35
+          left_margin: 0.23
+          cols: 3
+          rows: 10
+          col_gap: 0.13
+          row_gap: 0
+          units: "INCH"
+          creator: "Labels"
+
+        - template_id: 7
+          profile_id: 13
+          template_code: "Demco WS14942260"
+          template_desc: "1\" X 1.5\" Spine Label | Setup for up to four lines of text"
+          page_width: 8.5
+          page_height: 11
+          label_width: 1.5
+          label_height: 1
+          top_text_margin: 0.236
+          left_text_margin: 0
+          top_margin: 0.5
+          left_margin: 0.25
+          cols: 5
+          rows: 10
+          col_gap: 0.0625
+          row_gap: 0
+          units: "INCH"
+          creator: "Labels"
+
+        - template_id: 12
+          profile_id: 14
+          template_code: "Demco WS14942260"
+          template_desc: "1\" X 1.5\" Spine Label | Setup for five lines of text"
+          page_width: 8.5
+          page_height: 11
+          label_width: 1.5
+          label_height: 1
+          top_text_margin: 0.139
+          left_text_margin: 0
+          top_margin: 0.53
+          left_margin: 0.3
+          cols: 5
+          rows: 10
+          col_gap: 0.0625
+          row_gap: 0
+          units: "INCH"
+          creator: "Labels"
+
+        - template_id: 22
+          profile_id: 0
+          template_code: "DEFAULT TEMPLATE 01"
+          template_desc: "Default description"
+          page_width: 0
+          page_height: 5
+          label_width: 0
+          label_height: 0
+          top_text_margin: 0
+          left_text_margin: 0
+          top_margin: 0
+          left_margin: 0
+          cols: 0
+          rows: 0
+          col_gap: 0
+          row_gap: 0
+          units: "POINT"
+          creator: "Labels"
+
+        - template_id: 23
+          profile_id: 16
+          template_code: "HB-PC0001"
+          template_desc: "A template for home brewed patron card forms"
+          page_width: 8.5
+          page_height: 11
+          label_width: 3.1875
+          label_height: 1.9375
+          top_text_margin: 0
+          left_text_margin: 0
+          top_margin: 0.6875
+          left_margin: 0.875
+          cols: 2
+          rows: 4
+          col_gap: 0.4375
+          row_gap: 0.1875
+          units: "INCH"
+          creator: "Patroncards"
+
+  - printers_profile:
+      translatable: [ printer_name ]
+      multiline: [ ]
+      rows:
+        - profile_id: 1
+          printer_name: "Library Laser"
+          template_id: 1
+          paper_bin: "Bypass"
+          offset_horz: -2
+          offset_vert: 9
+          creep_horz: 3
+          creep_vert: 0
+          units: "POINT"
+          creator: "Labels"
+
+        - profile_id: 13
+          printer_name: "Library Laser"
+          template_id: 7
+          paper_bin: "Tray 1"
+          offset_horz: 0
+          offset_vert: 0
+          creep_horz: 0
+          creep_vert: 0
+          units: "POINT"
+          creator: "Labels"
+
+        - profile_id: 14
+          printer_name: "Library Laser"
+          template_id: 12
+          paper_bin: "Tray 2"
+          offset_horz: 0
+          offset_vert: 0
+          creep_horz: 0
+          creep_vert: 0
+          units: "POINT"
+          creator: "Labels"
+
+        - profile_id: 16
+          printer_name: "Test Printer 01"
+          template_id: 23
+          paper_bin: "Test Bin"
+          offset_horz: 0
+          offset_vert: 0
+          creep_horz: 0
+          creep_vert: 0
+          units: "POINT"
+          creator: "Patroncards"
+
+        - profile_id: 22
+          printer_name: "Library Laser"
+          template_id: 0
+          paper_bin: "Tray 3"
+          offset_horz: 0
+          offset_vert: 0
+          creep_horz: 0
+          creep_vert: 0
+          units: "POINT"
+          creator: "Labels"