Logiciel Pastèque/API/Upgrade to V8
= Upgrading older version to version 8 =
bin/upgrade7/importdb.php.
codice_1 is a script to insert data from a database v7 into a database v8. It doesn't import sales and cashes because the format has completely changed.
It requires 2 users ini files: the one from v7 user and the one for v8 user. Even if id is not used, it has to be present.
The database from v8 user must have been initialized. For postgresql create the database, log as v8 user then:
 \i res/database/postgresql/schema.sql
will initialize the database scheme.
You are ready to run the script.
 php bin/import/importdb.php <v7_login> <v8_login>
Preparing data from a v6 database.
Just run the update script included in v7 server in codice_2.
Preparing data from a v5 database.
Run the update script included in v7 server in codice_3.
Then prepare the v6 database as explained above.
Preparing data from a v4 database.
Run the update script included in v7 server in codice_4.
v4 doesn't have codice_5, but may have a lot of hosts in codice_6. To have only the required cash registers you can clean the database before importing crap into the v8 database.
 truncate TICKETLINES;
 delete from TICKETS;
 truncate PAYMENTS;
 truncate TAXLINES;
 delete from RECEIPTS;
 delete from CLOSEDCASH;
 delete from CASHREGISTERS where ID in (<list of crap ids>);
Then prepare the v5 database as explained above.
Most of the permissions in roles are tagged codice_7 and doesn't apply to further versions. After having imported the data into the v8 database, fix it with the default values included in the following postgresql script. You may also want to remove the useless codice_8 user:
 -- Set permissions
 update roles set permissions = ';fr.pasteque.pos.sales.JPanelTicketSales;fr.pasteque.pos.sales.JPanelTicketEdits;fr.pasteque.pos.customers.CustomersPayment;fr.pasteque.pos.panels.JPanelPayments;fr.pasteque.pos.panels.JPanelCloseMoney;sales.EditLines;sales.EditTicket;sales.RefundTicket;sales.PrintTicket;sales.Total;sales.ChangeTaxOptions;payment.cash;payment.cheque;payment.paper;payment.magcard;payment.free;payment.debt;payment.prepaid;refund.cash;refund.cheque;refund.paper;refund.magcard;Menu.BackOffice;fr.pasteque.pos.forms.MenuMaintenance;fr.pasteque.pos.admin.ResourcesPanel;fr.pasteque.possync.ProductsSyncCreate;fr.pasteque.possync.OrdersSyncCreate;Menu.ChangePassword;fr.pasteque.pos.panels.JPanelPrinter;fr.pasteque.pos.config.JPanelConfiguration;button.print;button.opendrawer;button.openmoney' where id = 1;
 update roles set permissions = ';fr.pasteque.pos.sales.JPanelTicketSales;fr.pasteque.pos.sales.JPanelTicketEdits;fr.pasteque.pos.customers.CustomersPayment;fr.pasteque.pos.panels.JPanelPayments;fr.pasteque.pos.panels.JPanelCloseMoney;sales.EditLines;sales.RefundTicket;sales.PrintTicket;sales.Total;payment.cash;payment.cheque;payment.paper;payment.magcard;payment.free;payment.debt;payment.prepaid;refund.cash;refund.cheque;refund.paper;refund.magcard;Menu.BackOffice;Menu.ChangePassword;button.print;button.opendrawer;button.openmoney' where id = 2;
 update roles set permissions = ';fr.pasteque.pos.sales.JPanelTicketSales;fr.pasteque.pos.sales.JPanelTicketEdits;fr.pasteque.pos.panels.JPanelPayments;sales.EditLines;sales.RefundTicket;sales.PrintTicket;sales.Total;payment.cash;payment.cheque;payment.paper;payment.magcard;payment.free;payment.prepaid;refund.cash;refund.cheque;refund.paper;refund.magcard;Menu.ChngePassword;button.print' where id = 3;
 -- Remove guest
 delete from users where id = 4;
 delete from roles where id = 4;
Other fixes.
Older databases don't have the codice_9 resource. If an error occurs while opening the cash on Desktop, the following postgresql script can fix it by creating the default resource:
 insert into resources (label, type, content) values ('Printer.OpenCash', 0, \x3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d38223f3e0a3c212d2d200a202020204f70656e627261766f20504f53206973206120706f696e74206f662073616c6573206170706c69636174696f6e2064657369676e656420666f7220746f7563682073637265656e732e0a20202020436f707972696768742028432920323030372d32303039204f70656e627261766f2c20532e4c2e0a20202020687474703a2f2f736f75726365666f7267652e6e65742f70726f6a656374732f6f70656e627261766f706f730a0a20202020546869732066696c652069732070617274206f66204f70656e627261766f20504f532e0a0a202020204f70656e627261766f20504f53206973206672656520736f6674776172653a20796f752063616e2072656469737472696275746520697420616e642f6f72206d6f646966790a20202020697420756e64657220746865207465726d73206f662074686520474e552047656e6572616c205075626c6963204c6963656e7365206173207075626c69736865642062790a20202020746865204672656520536f66747761726520466f756e646174696f6e2c206569746865722076657273696f6e2033206f6620746865204c6963656e73652c206f720a2020202028617420796f7572206f7074696f6e2920616e79206c617465722076657273696f6e2e0a0a202020204f70656e627261766f20504f5320697320646973747269627574656420696e2074686520686f706520746861742069742077696c6c2062652075736566756c2c0a2020202062757420574954484f555420414e592057415252414e54593b20776974686f7574206576656e2074686520696d706c6965642077617272616e7479206f660a202020204d45524348414e544142494c495459206f72204649544e45535320464f52204120504152544943554c415220505552504f53452e2020536565207468650a20202020474e552047656e6572616c205075626c6963204c6963656e736520666f72206d6f72652064657461696c732e0a0a20202020596f752073686f756c642068617665207265636569766564206120636f7079206f662074686520474e552047656e6572616c205075626c6963204c6963656e73650a20202020616c6f6e672077697468204f70656e627261766f20504f532e20204966206e6f742c20736565203c687474703a2f2f7777772e676e752e6f72672f6c6963656e7365732f3e2e0a202d2d3e0a0a3c6f75747075743e0a202020203c7469636b65743e0a20202020202020203c696d6167653e5072696e7465722e5469636b65742e4c6f676f3c2f696d6167653e0a20202020202020203c6c696e653e3c2f6c696e653e0a20202020202020203c6c696e652073697a653d2231223e0a2020202020202020202020203c7465787420616c69676e203d2263656e74657222206c656e6774683d2234322220626f6c643d2274727565223e4f7576657274757265206465206361697373653c2f746578743e0a20202020202020203c2f6c696e653e0a20202020202020203c6c696e653e3c2f6c696e653e0a20202020202020202369662028247061796d656e74732e68617346756e64732829290a20202020202020203c6c696e653e0a2020202020202020202020203c7465787420616c69676e3d226c65667422206c656e6774683d223332223e466f6e647320646520636169737365203a3c2f746578743e0a2020202020202020202020203c7465787420616c69676e3d22726967687422206c656e6774683d223130223e247b7061796d656e74732e7072696e744f70656e4361736828297d3c2f746578743e0a20202020202020203c2f6c696e653e0a20202020202020203c6c696e653e0a2020202020202020202020203c7465787420616c69676e3d226c65667422206c656e6774683d223232223e44c3a97461696c203a3c2f746578743e0a20202020202020203c2f6c696e653e0a202020202020202023666f726561636820282476616c20696e20247061796d656e74732e676574436f756e746564436f696e732829290a20202020202020203c6c696e653e0a2020202020202020202020203c7465787420616c69676e3d22726967687422206c656e6774683d223132223e247b7061796d656e74732e7072696e74436f696e56616c7565282476616c297d3a3c2f746578743e0a2020202020202020202020203c74657874206c656e6774683d223130223e3c2f746578743e0a2020202020202020202020203c7465787420616c69676e3d22726967687422206c656e6774683d223130223e247b7061796d656e74732e7072696e74436f696e436f756e74282476616c297d3c2f746578743e0a2020202020202020202020203c7465787420616c69676e3d22726967687422206c656e6774683d223130223e247b7061796d656e74732e7072696e74436f696e546f74616c282476616c297d3c2f746578743e0a20202020202020203c2f6c696e653e0a202020202020202023656e640a20202020202020203c6c696e653e3c2f6c696e653e0a202020202020202023656e640a20202020202020203c6c696e653e0a2020202020202020202020203c74657874206c656e6774683d223138223e436169737365203a3c2f746578743e0a2020202020202020202020203c746578743e247b7061796d656e74732e7072696e74486f737428297d3c2f746578743e0a20202020202020203c2f6c696e653e0a20202020202020203c6c696e653e0a2020202020202020202020203c74657874206c656e6774683d223138223e53657175656e6365203a3c2f746578743e0a2020202020202020202020203c74657874206c656e6774683d2232342220616c69676e3d227269676874223e247b7061796d656e74732e7072696e7453657175656e636528297d3c2f746578743e0a20202020202020203c2f6c696e653e200a20202020202020203c6c696e653e0a2020202020202020202020203c74657874206c656e6774683d223138223e4f7576657274757265203a3c2f746578743e0a2020202020202020202020203c74657874206c656e6774683d2232342220616c69676e3d227269676874223e247b7061796d656e74732e7072696e7444617465537461727428297d3c2f746578743e0a20202020202020203c2f6c696e653e0a202020203c2f7469636b65743e0a3c2f6f75747075743e0a');