From 276f057acf741e9afab31468c6bbbcfb27751611 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2015 16:10:03 +0200 Subject: [PATCH] Clean trigger codes Better error message when we insert duplicate barcode. --- htdocs/admin/agenda.php | 3 ++- htdocs/core/lib/company.lib.php | 7 ++++--- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 4 ++++ htdocs/product/class/product.class.php | 3 ++- htdocs/societe/agenda.php | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 5da5fa621c6..8b28400ab75 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -168,8 +168,9 @@ if (! empty($triggers)) //print 'module='.$module.'
'; if (! empty($conf->$module->enabled)) { - // Discard special case. + // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; + if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; $var=!$var; print ''; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e6b0f0a8dd6..5ba2ea89009 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -971,6 +971,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) $out.=""; + // Date $out.=''; $out.=dol_print_date($datep,'dayhour'); if ($datep2 && $datep2 != $datep) @@ -998,7 +999,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) // Title of event //$out.=''.dol_trunc($obj->label,40).''; - $out.=''.$actionstatic->getNomUrl(1,40).''; + $out.=''.$actionstatic->getNomUrl(1,120).''; // Contact pour cette action if (empty($objcon->id) && $obj->fk_contact > 0) @@ -1240,14 +1241,14 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) //$actionstatic->libelle=$libelle; $actionstatic->libelle=$histo[$key]['note']; $actionstatic->id=$histo[$key]['id']; - $out.=$actionstatic->getNomUrl(1,40); + $out.=$actionstatic->getNomUrl(1,120); } if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') { $out.=''.img_object($langs->trans("ShowEMailing"),"email").' '; $transcode=$langs->trans("Action".$histo[$key]['acode']); $libelle=($transcode!="Action".$histo[$key]['acode']?$transcode:'Send mass mailing'); - $out.=dol_trunc($libelle,40); + $out.=dol_trunc($libelle,120); } $out.=''; diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 5b0b6705e5a..3bd8c282c38 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -725,3 +725,7 @@ INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES ( INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1); + +DELETE FROM llx_c_action_trigger where code = 'PROPAL_CLASSIFYBILLED'; +DELETE FROM llx_c_action_trigger where code = 'FICHINTER_CLASSIFYBILLED'; + diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a501212c8ba..28af434d56a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -808,7 +808,8 @@ class Product extends CommonObject { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); + if (empty($conf->barcode->enabled)) $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductAlreadyExists",$this->ref); + else $this->error=$langs->trans("Error")." : ".$langs->trans("ErrorProductBarCodeAlreadyExists",$this->barcode); $this->db->rollback(); return -1; } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 4648992506b..847c23c6719 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2005 Brice Davoleau * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006-2015 Laurent Destailleur * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos GarcĂ­a