Clean trigger codes

Better error message when we insert duplicate barcode.
This commit is contained in:
Laurent Destailleur 2015-06-30 16:10:03 +02:00
parent c69a9996f1
commit 276f057acf
5 changed files with 13 additions and 6 deletions

View File

@ -168,8 +168,9 @@ if (! empty($triggers))
//print 'module='.$module.'<br>';
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 '<tr '.$bc[$var].'>';

View File

@ -971,6 +971,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
$out.="<tr ".$bc[$var].">";
// Date
$out.='<td width="120" align="left" class="nowrap">';
$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.='<td colspan="2">'.dol_trunc($obj->label,40).'</td>';
$out.='<td colspan="2">'.$actionstatic->getNomUrl(1,40).'</td>';
$out.='<td colspan="2">'.$actionstatic->getNomUrl(1,120).'</td>';
// 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.='<a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$histo[$key]['id'].'">'.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.='</td>';

View File

@ -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';

View File

@ -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;
}

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>