-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Le 09/11/2011 18:54, Mason James a écrit :
do other people agree? not at all ! Sometimes (not very often, but not rarely either), more complex calculations must be made, like for
For example: depending on your marcflavour you do something or something else.
$DBversion = '3.05.00.017'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { if (C4::Context->preference("marcflavour") eq 'MARC21' || C4::Context->preference("marcflavour") eq 'NORMARC'){ $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n"; SetVersion ($DBversion); } elsif (C4::Context->preference("marcflavour") eq 'UNIMARC'){ $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('461', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)"); print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n"; SetVersion ($DBversion); }
So we must have a .pl file, not SQL - -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOxTmUAAoJEK81SonuhyGoIscH/i1yDbz+viO/Qcy+y5h/Ttlw tyc2xqWlCY0ph4XE7TyE5sz6PBWB57tg0KZGPAz8ubCd3AThUkzTgU33rrRLOkg6 zIguyp9GOXH8VDWGtttnXGCMJlLqKp3wRargBZHOIRGBJVUjDkhiat1X/feqlFyr 3V3LT+H9sg+mWGSOhhbd1xRbd6XtiLBccopMllcz/bzqq133HuMbfS7Au/qw9bYF DpIrFCoJgiVM3fyUwqSpDe9rkq+sTIbLw3KN6B17lSWjUqOHCYJKtcXIskUM0fLk 1RaNqXtob9ZvvY6VibjHnBUTgsZApGzt6NRE2tvy4d/HJXUmXHD70KVebw8WHek= =F8G6 -----END PGP SIGNATURE-----