This commit is contained in:
Cedric 2014-06-25 13:37:55 +02:00
parent ffd27f2d49
commit ee91f4a3f7
5 changed files with 51 additions and 15 deletions

View File

@ -65,6 +65,9 @@ For users:
- Fix: Add actions events not implemented. - Fix: Add actions events not implemented.
- Fix: Price min of composition is not supplier price min by quantity. - Fix: Price min of composition is not supplier price min by quantity.
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers. - Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers.
- Fix: [ bug #1478 ] BILL_PAYED trigger action does not intercept failure under some circumstances
- Fix: [ bug #1479 ] Several customer invoice triggers do not intercept trigger action
- Fix: [ bug #1477 ] Several customer invoice triggers do not show trigger error messages
TODO TODO
- New: Predefined product and free product use same form. - New: Predefined product and free product use same form.

View File

@ -124,7 +124,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->c
header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result); header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $result);
exit(); exit();
} else { } else {
$mesgs [] = $object->error; setEventMessage($object->error, 'errors');
$action = ''; $action = '';
} }
} }
@ -140,7 +140,7 @@ else if ($action == 'reopen' && $user->rights->facture->creer) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
exit(); exit();
} else { } else {
$mesgs [] = '<div class="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
} }
} }
} }
@ -164,7 +164,8 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php'); header('Location: ' . DOL_URL_ROOT . '/compta/facture/list.php');
exit(); exit();
} else { } else {
$mesgs [] = '<div class="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
$action='';
} }
} }
@ -195,7 +196,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
exit(); exit();
} }
} else { } else {
$mesgs [] = '<div clas="error">' . $object->error . '</div>'; setEventMessage($object->error, 'errors');
$action = ''; $action = '';
} }
} }
@ -453,7 +454,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
// On verifie si aucun paiement n'a ete effectue // On verifie si aucun paiement n'a ete effectue
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) { if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
$object->set_draft($user, $idwarehouse); $result=$object->set_draft($user, $idwarehouse);
if ($result<0) setEventMessage($object->error,'errors');
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -478,6 +480,7 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) { else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->set_paid($user);
if ($result<0) setEventMessage($object->error,'errors');
} // Classif "paid partialy" } // Classif "paid partialy"
else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) { else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) {
$object->fetch($id); $object->fetch($id);
@ -485,6 +488,7 @@ else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->righ
$close_note = $_POST["close_note"]; $close_note = $_POST["close_note"];
if ($close_code) { if ($close_code) {
$result = $object->set_paid($user, $close_code, $close_note); $result = $object->set_paid($user, $close_code, $close_note);
if ($result<0) setEventMessage($object->error,'errors');
} else { } else {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
} }
@ -495,6 +499,7 @@ else if ($action == 'confirm_canceled' && $confirm == 'yes') {
$close_note = $_POST["close_note"]; $close_note = $_POST["close_note"];
if ($close_code) { if ($close_code) {
$result = $object->set_canceled($user, $close_code, $close_note); $result = $object->set_canceled($user, $close_code, $close_note);
if ($result<0) setEventMessage($object->error,'errors');
} else { } else {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
} }

View File

@ -1564,7 +1564,11 @@ class Facture extends CommonInvoice
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf); $result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0) {
$error++; $this->errors=$interface->errors; $error++;
$this->errors=$interface->errors;
$this->db->rollback();
return -1;
} }
// Fin appel triggers // Fin appel triggers
@ -1808,7 +1812,6 @@ class Facture extends CommonInvoice
else else
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
@ -2216,6 +2219,7 @@ class Facture extends CommonInvoice
} }
else else
{ {
$this->error=$this->line->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -2286,7 +2290,7 @@ class Facture extends CommonInvoice
else else
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$line->error;
return -1; return -1;
} }
} }
@ -3570,8 +3574,12 @@ class FactureLigne extends CommonInvoiceLine
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('LINEBILL_INSERT',$this,$user,$langs,$conf); $result = $interface->run_triggers('LINEBILL_INSERT',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0)
$error++; $this->errors=$interface->errors; {
$error++;
$this->errors=$interface->errors;
$this->db->rollback();
return -2;
} }
// Fin appel triggers // Fin appel triggers
} }
@ -3683,8 +3691,12 @@ class FactureLigne extends CommonInvoiceLine
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('LINEBILL_UPDATE',$this,$user,$langs,$conf); $result = $interface->run_triggers('LINEBILL_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0)
$error++; $this->errors=$interface->errors; {
$error++;
$this->errors=$interface->errors;
$this->db->rollback();
return -2;
} }
// Fin appel triggers // Fin appel triggers
} }
@ -3721,8 +3733,12 @@ class FactureLigne extends CommonInvoiceLine
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('LINEBILL_DELETE',$this,$user,$langs,$conf); $result = $interface->run_triggers('LINEBILL_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { if ($result < 0)
$error++; $this->errors=$interface->errors; {
$error++;
$this->errors=$interface->errors;
$this->db->rollback();
return -1;
} }
// Fin appel triggers // Fin appel triggers

View File

@ -221,7 +221,15 @@ class Paiement extends CommonObject
if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice. We do nothing more."); if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice. We do nothing more.");
else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more."); else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more."); else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
else $result=$invoice->set_paid($user,'',''); else
{
$result=$invoice->set_paid($user,'','');
if ($result<0)
{
$this->error=$invoice->error;
$error++;
}
}
} }
} }
else else

View File

@ -396,6 +396,10 @@ class InterfaceDemo
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);
} }
elseif ($action == 'BILL_DELETE') elseif ($action == 'BILL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_PAYED')
{ {
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);
} }