From 685b8d722da219fff1e4f913acf2c3fac6d21dd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Feb 2015 16:46:37 +0100 Subject: [PATCH 1/3] Fix: Bad hook name --- htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 29bd483b39b..ddd10e56457 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -200,7 +200,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; - $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $nblignes = count($object->lines); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6f9449f209d..1d2085dcbf7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -624,7 +624,7 @@ Permission181=Read supplier orders Permission182=Create/modify supplier orders Permission183=Validate supplier orders Permission184=Approve supplier orders -Permission185=Order supplier orders +Permission185=Order or cancel supplier orders Permission186=Receive supplier orders Permission187=Close supplier orders Permission188=Cancel supplier orders diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 355878e9901..4475fe60771 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -631,7 +631,7 @@ Permission181=Consulter les commandes fournisseurs Permission182=Créer/modifier les commandes fournisseurs Permission183=Valider les commandes fournisseurs Permission184=Approuver les commandes fournisseurs -Permission185=Passer les commandes fournisseurs +Permission185=Passer les commandes fournisseurs et les annuler Permission186=Accuser réception des commandes fournisseurs Permission187=Clôturer les commandes fournisseurs Permission188=Annuler les commandes fournisseurs From ad67fe50a3c7ae642c4d8f17161fe659aafc3b33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Feb 2015 17:21:41 +0100 Subject: [PATCH 2/3] Correct management when delivery date is universal time format. --- .../supplier_order/pdf/pdf_muscadet.modules.php | 4 +++- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- htdocs/fourn/commande/card.php | 10 +++++++--- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 2 ++ .../install/mysql/tables/llx_commande_fournisseur.sql | 4 ++-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index ddd10e56457..e628013cb3e 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1011,7 +1011,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } $pdf->SetTextColor(0,0,60); - if (! empty($object->date_livraison)) $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R'); + $usehourmin='day'; + if ( empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; + if (! empty($object->date_livraison)) $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,$usehourmin,false,$outputlangs,true), '', 'R'); $posy+=5; $pdf->SetTextColor(0,0,60); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d95816a1511..6ba464b0a18 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1609,9 +1609,9 @@ class CommandeFournisseur extends CommonOrder /** * Set the planned delivery date * - * @param User $user Objet utilisateur qui modifie - * @param timestamp $date_livraison Date de livraison - * @return int <0 si ko, >0 si ok + * @param User $user Objet user making change + * @param timestamp $date_livraison Planned delivery date + * @return int <0 if KO, >0 if OK */ function set_date_livraison($user, $date_livraison) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 022b46f6a9b..ef78a9981c1 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -144,7 +144,7 @@ if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) // date de livraison if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) { - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); + $datelivraison=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), GETPOST('liv_sec','int'), GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); $result=$object->set_date_livraison($user,$datelivraison); if ($result < 0) @@ -1588,13 +1588,17 @@ elseif (! empty($object->id)) print '
'; print ''; print ''; - $form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_','','','',"setdate_livraison"); + $usehourmin=0; + if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin=1; + $form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_',$usehourmin,$usehourmin,'',"setdate_livraison"); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison,'daytext') : ' '; + $usehourmin='day'; + if (! empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin='dayhour'; + print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' '; } print ''; diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 22a65167e6f..0a9213a3d73 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -210,6 +210,8 @@ ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_product (fk_produc DELETE from llx_product_price where fk_product NOT IN (SELECT rowid from llx_product); ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); +ALTER TABLE llx_commande_fournisseur MODIFY COLUMN date_livraison datetime; + ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_account integer AFTER date_livraison; ALTER TABLE llx_facture_fourn ADD COLUMN fk_account integer AFTER fk_projet; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index ff87110c72a..f9f440d0db4 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -55,11 +55,11 @@ create table llx_commande_fournisseur note_public text, model_pdf varchar(255), - date_livraison date default NULL, + date_livraison datetime default NULL, fk_account integer, -- bank account fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement - fk_input_method integer default 0, + fk_input_method integer default 0, import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format From cc1d506614ca9e0267f3d6335cd71aa2b65c8719 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Feb 2015 21:01:17 +0100 Subject: [PATCH 3/3] Miscelaneous debug on barcode features. --- htdocs/admin/barcode.php | 5 +- htdocs/barcode/codeinit.php | 7 ++- htdocs/commande/contact.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 4 +- htdocs/core/modules/DolibarrModules.class.php | 7 ++- htdocs/cron/card.php | 2 +- htdocs/cron/info.php | 2 +- htdocs/install/upgrade2.php | 62 +++++++++++++------ htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/cron.lang | 1 + htdocs/langs/en_US/errors.lang | 2 +- 11 files changed, 61 insertions(+), 35 deletions(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 11341f632a2..725d53dd1c3 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * @@ -430,6 +430,5 @@ print ''; print "
"; -$db->close(); - llxFooter(); +$db->close(); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 19fb5c193bb..a2e24685017 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $langs->load("admin"); $langs->load("members"); $langs->load("errors"); +$langs->load("other"); // Choice of print year or current year. $now = dol_now(); @@ -229,7 +230,7 @@ if ($conf->societe->enabled) } else dol_print_error($db); - print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("Thirdparties")).'
'."\n"; + print $langs->trans("CurrentlyNWithoutBarCode", $nbno, $nbtotal, $langs->transnoentitiesnoconv("ThirdParties")).'
'."\n"; print '
product->enabled || $conf->product->service) $nbno=$nbtotal=0; print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','').'
'."\n"; - $sql ="SELECT count(rowid) as nb, fk_product_type"; + $sql ="SELECT count(rowid) as nb, fk_product_type, datec"; $sql.=" FROM ".MAIN_DB_PREFIX."product"; $sql.=" WHERE barcode IS NULL OR barcode = ''"; - $sql.=" GROUP BY fk_product_type"; + $sql.=" GROUP BY fk_product_type, datec"; $sql.=" ORDER BY datec"; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index c36f19c166b..6a322e8681e 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -221,5 +221,5 @@ if ($id > 0 || ! empty($ref)) } -$db->close(); llxFooter(); +$db->close(); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1ae0d46343b..c88c8375a41 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -217,8 +217,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) // Tools - $tmpentry=array('enabled'=>(! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)), - 'perms'=>(! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)), + $tmpentry=array('enabled'=>(! empty($conf->barcode->enabled) || ! empty($conf->mailing->enabled) || ! empty($conf->export->enabled) || ! empty($conf->import->enabled) || ! empty($conf->opensurvey->enabled)), + 'perms'=>(! empty($conf->barcode->enabled) || ! empty($user->rights->mailing->lire) || ! empty($user->rights->export->lire) || ! empty($user->rights->import->run) || ! empty($user->rights->opensurvey->read)), 'module'=>'mailing|export|import|opensurvey'); $showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal); if ($showmode) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 91b6e57a9b5..045bb1ddbcf 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -193,7 +193,9 @@ abstract class DolibarrModules * Inserts all informations into database * * @param string[] $array_sql SQL requests to be executed when enabling module - * @param string $options String with options when disabling module ('newboxdefonly|noboxes') + * @param string $options String with options when disabling module: + * 'noboxes' = Do not insert boxes + * 'newboxdefonly' = For boxes, insert def of boxes only and not boxes activation * * @return int 1 if OK, 0 if KO */ @@ -279,7 +281,8 @@ abstract class DolibarrModules * Disable function. Deletes the module constant and boxes from the database. * * @param string[] $array_sql SQL requests to be executed when module is disabled - * @param string $options Options when disabling module ('newboxdefonly|noboxes') + * @param string $options Options when disabling module: + * 'newboxdefonly|noboxes' = We don't remove boxes. * * @return int 1 if OK, 0 if KO */ diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index a826264c94e..f3c7d0363bb 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -227,7 +227,7 @@ llxHeader('',$langs->trans("CronAdd")); if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') { $head=cron_prepare_head($object); - print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'bill'); + print dol_get_fiche_head($head, 'card', $langs->trans("CronTask"), 0, 'cron'); } elseif ($action=='create') { diff --git a/htdocs/cron/info.php b/htdocs/cron/info.php index 53489d69f5a..ceec1d34adb 100644 --- a/htdocs/cron/info.php +++ b/htdocs/cron/info.php @@ -46,7 +46,7 @@ $object->info($id); $head = cron_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("CronTask"), 0, 'bill'); +dol_fiche_head($head, 'info', $langs->trans("CronTask"), 0, 'cron'); print '
'; dol_print_object_info($object); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 86ab911c71b..a7226c1621d 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -367,19 +367,21 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action'))) // Reload modules (this must be always and only into last targeted version) $listofmodule=array( 'MAIN_MODULE_AGENDA', - 'MAIN_MODULE_SOCIETE', - 'MAIN_MODULE_PRODUIT', - 'MAIN_MODULE_SERVICE', + 'MAIN_MODULE_BARCODE', + 'MAIN_MODULE_CRON', 'MAIN_MODULE_COMMANDE', - 'MAIN_MODULE_FACTURE', - 'MAIN_MODULE_FOURNISSEUR', - 'MAIN_MODULE_USER', 'MAIN_MODULE_DEPLACEMENT', 'MAIN_MODULE_DON', 'MAIN_MODULE_ECM', - 'MAIN_MODULE_PAYBOX', - 'MAIN_MODULE_OPENSURVEY' - ); + 'MAIN_MODULE_FACTURE', + 'MAIN_MODULE_FOURNISSEUR', + 'MAIN_MODULE_OPENSURVEY', + 'MAIN_MODULE_PAYBOX', + 'MAIN_MODULE_PRODUIT', + 'MAIN_MODULE_SOCIETE', + 'MAIN_MODULE_SERVICE', + 'MAIN_MODULE_USER' + ); migrate_reload_modules($db,$langs,$conf,$listofmodule); // Reload menus (this must be always and only into last targeted version) @@ -3773,6 +3775,26 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $mod->init('newboxdefonly'); } } + if ($moduletoreload == 'MAIN_MODULE_BARCODE') + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Barcode"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modBarcode.class.php'; + if ($res) { + $mod=new modBarcode($db); + $mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if ($moduletoreload == 'MAIN_MODULE_CRON') + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Cron"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCron.class.php'; + if ($res) { + $mod=new modCron($db); + $mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } if ($moduletoreload == 'MAIN_MODULE_SOCIETE') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe"); @@ -3833,17 +3855,6 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $mod->init('newboxdefonly'); } } - - if ($moduletoreload == 'MAIN_MODULE_USER') // Permission has changed into 3.0 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; - if ($res) { - $mod=new modUser($db); - //$mod->remove('noboxes'); // We need to remove because id of module has changed - $mod->init('newboxdefonly'); - } - } if ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') // Permission has changed into 3.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement"); @@ -3894,6 +3905,17 @@ function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) $mod->init('newboxdefonly'); } } + if ($moduletoreload == 'MAIN_MODULE_USER') // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; + if ($res) { + $mod=new modUser($db); + //$mod->remove('noboxes'); // We need to remove because id of module has changed + $mod->init('newboxdefonly'); + } + } + } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1d2085dcbf7..009c7dd774c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1374,7 +1374,7 @@ BarcodeDescUPC=Barcode of type UPC BarcodeDescISBN=Barcode of type ISBN BarcodeDescC39=Barcode of type C39 BarcodeDescC128=Barcode of type C128 -GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types) +GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types). Must be compatible with "genbarcode".
For example: /usr/local/bin/genbarcode BarcodeInternalEngine=Internal engine BarCodeNumberManager=Manager to auto define barcode numbers ##### Prelevements ##### diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 5432c5b5b52..31e701f1e2d 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -84,3 +84,4 @@ CronType_command=Shell command CronMenu=Cron CronCannotLoadClass=Cannot load class %s or object %s UseMenuModuleToolsToAddCronJobs=Go into menu "Home - Modules tools - Job list" to see and edit scheduled jobs. +TaskDisabled=Task disabled diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0187c567eb6..a2d73817bf1 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -25,7 +25,7 @@ ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be differen ErrorBadThirdPartyName=Bad value for third party name ErrorProdIdIsMandatory=The %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code -ErrorBadBarCodeSyntax=Bad syntax for bar code +ErrorBadBarCodeSyntax=Bad syntax for bar code. May be you set a bad barcode type or you defined a barcode mask for numbering that does not match value scanned. ErrorCustomerCodeRequired=Customer code required ErrorBarCodeRequired=Bar code required ErrorCustomerCodeAlreadyUsed=Customer code already used