Merge remote-tracking branch 'origin/3.3' into develop

Conflicts:
	COPYRIGHT
This commit is contained in:
Laurent Destailleur 2012-12-30 18:00:07 +01:00
commit 4fe1ba33f9
13 changed files with 231 additions and 193 deletions

View File

@ -58,6 +58,7 @@ Copyright (C) 2012
- Florian Henry <florian.henry@open-concept.pro> - Florian Henry <florian.henry@open-concept.pro>
- Jean-François Ferry <jfefe@aternatik.fr> - Jean-François Ferry <jfefe@aternatik.fr>
- Maxime Kohlhaas <mko@atm-consulting.fr> - Maxime Kohlhaas <mko@atm-consulting.fr>
- Nicolas Péré <nicolas@amarok2.net>
Copyright (C) 2011 Copyright (C) 2011
- Laurent Destailleur <eldy@users.sourceforge.net> - Laurent Destailleur <eldy@users.sourceforge.net>

View File

@ -101,6 +101,9 @@ For developers:
- New: Add PRODUCT_PRICE_MODIFY trigger. - New: Add PRODUCT_PRICE_MODIFY trigger.
- New: Created function to retrieve total amount of discount of an invoice/proposal... - New: Created function to retrieve total amount of discount of an invoice/proposal...
- New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus. - New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus.
- Qual: Renamed SUPPLIER_INVOICE_BUILDDOC trigger to BILL_SUPPLIER_BUILDDOC
- Qual: Renamed INVOICE_SUPPLIER_DELETE trigger to BILL_SUPPLIER_DELETE
- Qual: Renamed SUPLLIER_ORDER_BUILDDOC trigger to ORDER_SUPPLIER_BUILDDOC
For translators: For translators:
- New: Update language files (de, tr, pt, ca, es, en, fr). - New: Update language files (de, tr, pt, ca, es, en, fr).

View File

@ -198,6 +198,15 @@ else if ($action == 'add' && $user->rights->commande->creer)
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year'));
if ($datecommande == '')
{
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).'</div>';
$action='create';
$error++;
}
if (! $error)
{
$object->socid=$socid; $object->socid=$socid;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -393,6 +402,7 @@ else if ($action == 'add' && $user->rights->commande->creer)
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>'; if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
} }
} }
}
else if ($action == 'classifybilled' && $user->rights->commande->creer) else if ($action == 'classifybilled' && $user->rights->commande->creer)
{ {

View File

@ -227,7 +227,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('FICHEINTER_BUILDDOC',$object,$user,$langs,$conf); $result=$interface->run_triggers('FICHINTER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers

View File

@ -311,7 +311,7 @@ class InterfaceActionsAuto
$object->sendtoid=0; $object->sendtoid=0;
$ok=1; $ok=1;
} }
elseif ($action == 'FICHEINTER_VALIDATE') elseif ($action == 'FICHINTER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
@ -328,7 +328,7 @@ class InterfaceActionsAuto
$object->elementtype=''; $object->elementtype='';
$ok=1; $ok=1;
} }
elseif ($action == 'FICHEINTER_SENTBYMAIL') elseif ($action == 'FICHINTER_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");

View File

@ -29,8 +29,14 @@
class InterfaceNotification class InterfaceNotification
{ {
var $db; var $db;
var $listofmanagedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE', var $listofmanagedevents=array(
'FICHEINTER_VALIDATE','ORDER_SUPPLIER_APPROVE','ORDER_SUPPLIER_REFUSE'); 'BILL_VALIDATE',
'ORDER_VALIDATE',
'PROPAL_VALIDATE',
'FICHINTER_VALIDATE',
'ORDER_SUPPLIER_APPROVE',
'ORDER_SUPPLIER_REFUSE'
);
/** /**
* Constructor * Constructor
@ -146,7 +152,7 @@ class InterfaceNotification
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf); $notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
} }
elseif ($action == 'FICHEINTER_VALIDATE') elseif ($action == 'FICHINTER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);

View File

@ -164,20 +164,29 @@ class Fichinter extends CommonObject
if (! $ret) dol_print_error($this->db); if (! $ret) dol_print_error($this->db);
} }
$this->db->commit();
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('FICHEINTER_CREATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $this->errors=$interface->errors;
} }
// Fin appel triggers // Fin appel triggers
if (! $error)
{
$this->db->commit();
return $this->id; return $this->id;
} }
else else
{
$this->db->rollback();
$this->error=join(',',$this->errors);
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
return -1;
}
}
else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
@ -213,7 +222,7 @@ class Fichinter extends CommonObject
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('FICHEINTER_MODIFY',$this,$user,$langs,$conf); $result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $this->errors=$interface->errors;
} }
@ -357,14 +366,14 @@ class Fichinter extends CommonObject
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_statut = 0"; $sql.= " AND fk_statut = 0";
dol_syslog("Fichinter::setValid sql=".$sql); dol_syslog(get_class($this)."::setValid sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('FICHINTER_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
@ -377,7 +386,7 @@ class Fichinter extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=join(',',$this->errors); $this->error=join(',',$this->errors);
dol_syslog("Fichinter::setValid ".$this->error,LOG_ERR); dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR);
return -1; return -1;
} }
} }
@ -385,7 +394,7 @@ class Fichinter extends CommonObject
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("Fichinter::setValid ".$this->error,LOG_ERR); dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR);
return -1; return -1;
} }
} }
@ -675,7 +684,7 @@ class Fichinter extends CommonObject
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('FICHEINTER_DELETE',$this,$user,$langs,$conf); $result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++; $this->errors=$interface->errors;
} }

View File

@ -719,7 +719,7 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$object,$user,$langs,$conf); $result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
@ -1387,7 +1387,7 @@ else if ($id > 0 || ! empty($ref))
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>'; else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
} }
if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED)) if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED))
{ {
if ($object->statut != 2) if ($object->statut != 2)
{ {

View File

@ -230,6 +230,13 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
$datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); $datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
if (GETPOST('socid','int')<1)
{
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'</div>';
$action='create';
$error++;
}
if ($datefacture == '') if ($datefacture == '')
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>'; $mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>';

View File

@ -30,7 +30,7 @@
-- List of all managed triggered events (used for trigger agenda and for notification) -- List of all managed triggered events (used for trigger agenda and for notification)
-- --
delete from llx_c_action_trigger; delete from llx_c_action_trigger;
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHEINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',18); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',18);
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (2,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (2,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6);
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (3,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',11); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (3,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',11);
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',12); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',12);

View File

@ -905,3 +905,5 @@ ALTER TABLE llx_element_lock ADD COLUMN sessionid varchar(255) AFTER datem;
ALTER TABLE llx_element_lock MODIFY COLUMN elementtype varchar(32) NOT NULL; ALTER TABLE llx_element_lock MODIFY COLUMN elementtype varchar(32) NOT NULL;
ALTER TABLE llx_element_lock DROP COLUMN fk_user_modif; ALTER TABLE llx_element_lock DROP COLUMN fk_user_modif;
ALTER TABLE llx_element_lock DROP COLUMN status; ALTER TABLE llx_element_lock DROP COLUMN status;
DELETE FROM llx_c_action_trigger WHERE elementtype='withdraw';