Fix: Proposal deadlock situation

New: Add missing trigger PROPAL_CLASSIFYBILLED.
This commit is contained in:
Laurent Destailleur 2014-11-03 16:20:55 +01:00
parent b2ed53b785
commit 155452ba91
6 changed files with 76 additions and 73 deletions

View File

@ -535,7 +535,7 @@ else if ($action == 'classifybilled' && $user->rights->propal->cloturer) {
// Reopen proposal // Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) { else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times // prevent browser refresh from reopening proposal several times
if ($object->statut == 2 || $object->statut == 3) { if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) {
$object->reopen($user, 1); $object->reopen($user, 1);
} }
} }
@ -2201,7 +2201,7 @@ if ($action == 'create')
} }
// ReOpen // ReOpen
if (($object->statut == 2 || $object->statut == 3) && $user->rights->propal->cloturer) { if (($object->statut == 2 || $object->statut == 3 || $object->statut == 4) && $user->rights->propal->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
print '>' . $langs->trans('ReOpen') . '</a></div>'; print '>' . $langs->trans('ReOpen') . '</a></div>';
} }

View File

@ -1739,8 +1739,14 @@ class Propal extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf;
$trigger_name='PROPAL_CLOSE_REFUSED';
if ($statut == 2) if ($statut == 2)
{ {
$trigger_name='PROPAL_CLOSE_SIGNED';
$modelpdf=$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
// The connected company is classified as a client // The connected company is classified as a client
$soc=new Societe($this->db); $soc=new Societe($this->db);
$soc->id = $this->socid; $soc->id = $this->socid;
@ -1752,6 +1758,11 @@ class Propal extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
}
if ($statut == 4)
{
$trigger_name='PROPAL_CLASSIFYBILLED';
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{ {
@ -1764,36 +1775,14 @@ class Propal extends CommonObject
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
//$ret=$object->fetch($id); // Reload to get new records //$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $this->generateDocument($modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
// Call trigger // Call trigger
$result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user); $result=$this->call_trigger($trigger_name,$user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
}
else
{
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
$outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS))
{
$outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
// Call trigger
$result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if ( ! $error ) if ( ! $error )
{ {
$this->db->commit(); $this->db->commit();

View File

@ -145,6 +145,17 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
elseif ($action == 'PROPAL_CLASSIFYBILLED')
{
$langs->load("propal");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;

View File

@ -65,6 +65,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',30);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_SIGNED','Customer proposal closed signed','Executed when a customer proposal is closed signed','propal',2);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLOSE_REFUSED','Customer proposal closed refused','Executed when a customer proposal is closed refused','propal',2);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFYBILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',35); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',35);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',36); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',36);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',37);

View File

@ -23,6 +23,7 @@
--insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention delete','Executed when a intervention is delete','ficheinter',19); --insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention delete','Executed when a intervention is delete','ficheinter',19);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFYBILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFYBILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFYBILLED','Customer proposal set billed','Executed when a customer proposal is set to billed','propal',2);
ALTER TABLE llx_notify ADD COLUMN fk_soc integer NULL after fk_action; ALTER TABLE llx_notify ADD COLUMN fk_soc integer NULL after fk_action;

View File

@ -203,25 +203,26 @@ ForgetIfNothing=If you didn't request this change, just forget this email. Your
##### Calendar common ##### ##### Calendar common #####
AddCalendarEntry=Add entry in calendar %s AddCalendarEntry=Add entry in calendar %s
NewCompanyToDolibarr=Company %s added into Dolibarr NewCompanyToDolibarr=Company %s added
ContractValidatedInDolibarr=Contract %s validated in Dolibarr ContractValidatedInDolibarr=Contract %s validated
ContractCanceledInDolibarr=Contract %s canceled in Dolibarr ContractCanceledInDolibarr=Contract %s canceled
ContractClosedInDolibarr=Contract %s closed in Dolibarr ContractClosedInDolibarr=Contract %s closed
PropalClosedSignedInDolibarr=Proposal %s signed in Dolibarr PropalClosedSignedInDolibarr=Proposal %s signed
PropalClosedRefusedInDolibarr=Proposal %s refused in Dolibarr PropalClosedRefusedInDolibarr=Proposal %s refused
PropalValidatedInDolibarr=Proposal %s validated in Dolibarr PropalValidatedInDolibarr=Proposal %s validated
InvoiceValidatedInDolibarr=Invoice %s validated in Dolibarr PropalClassifiedBilledInDolibarr=Proposal %s classified billed
InvoicePaidInDolibarr=Invoice %s changed to paid in Dolibarr InvoiceValidatedInDolibarr=Invoice %s validated
InvoiceCanceledInDolibarr=Invoice %s canceled in Dolibarr InvoicePaidInDolibarr=Invoice %s changed to paid
PaymentDoneInDolibarr=Payment %s done in Dolibarr InvoiceCanceledInDolibarr=Invoice %s canceled
CustomerPaymentDoneInDolibarr=Customer payment %s done in Dolibarr PaymentDoneInDolibarr=Payment %s done
SupplierPaymentDoneInDolibarr=Supplier payment %s done in Dolibarr CustomerPaymentDoneInDolibarr=Customer payment %s done
MemberValidatedInDolibarr=Member %s validated in Dolibarr SupplierPaymentDoneInDolibarr=Supplier payment %s done
MemberResiliatedInDolibarr=Member %s resiliated in Dolibarr MemberValidatedInDolibarr=Member %s validated
MemberDeletedInDolibarr=Member %s deleted from Dolibarr MemberResiliatedInDolibarr=Member %s resiliated
MemberSubscriptionAddedInDolibarr=Subscription for member %s added in Dolibarr MemberDeletedInDolibarr=Member %s deleted
ShipmentValidatedInDolibarr=Shipment %s validated in Dolibarr MemberSubscriptionAddedInDolibarr=Subscription for member %s added
ShipmentDeletedInDolibarr=Shipment %s deleted from Dolibarr ShipmentValidatedInDolibarr=Shipment %s validated
ShipmentDeletedInDolibarr=Shipment %s deleted
##### Export ##### ##### Export #####
Export=Export Export=Export
ExportsArea=Exports area ExportsArea=Exports area