Browse Source

A lot of fix in missing intervention trigger. Align key to use same name
to avoid future bugs.

Laurent Destailleur 10 years ago
parent
commit
cf6a0df3e4

+ 1 - 1
htdocs/comm/propal/class/propal.class.php

@@ -1761,7 +1761,7 @@ class Propal extends CommonObject
             }
             if ($statut == 4)
             {
-            	$trigger_name='PROPAL_CLASSIFYBILLED';
+            	$trigger_name='PROPAL_CLASSIFY_BILLED';
             }
 
             if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))

+ 3 - 2
htdocs/core/class/commonobject.class.php

@@ -2074,7 +2074,8 @@ abstract class CommonObject
         	if (! $error)
 			{
 				$trigkey='';
-				if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFYBILLED';
+				if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED';
+				if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED';
 
 				if ($trigkey)
 				{
@@ -2566,7 +2567,7 @@ abstract class CommonObject
 					$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
 					$reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks
 				}
-				else 
+				else
 				{
 					$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
 					$reshook=$hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action);    // Note that $action and $object may have been modified by some hooks

+ 20 - 8
htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php

@@ -149,7 +149,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
 
 			$object->sendtoid=0;
 		}
-		elseif ($action == 'PROPAL_CLASSIFYBILLED')
+		elseif ($action == 'PROPAL_CLASSIFY_BILLED')
         {
             $langs->load("propal");
 
@@ -264,7 +264,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
 		}
 		elseif ($action == 'FICHINTER_CREATE')
         {
-            $langs->load("other");
+        	$langs->load("other");
             $langs->load("interventions");
 
 			$object->actiontypecode='AC_OTH_AUTO';
@@ -292,7 +292,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
 		}
 		elseif ($action == 'FICHINTER_MODIFY')
         {
-            $langs->load("other");
+        	$langs->load("other");
             $langs->load("interventions");
 
 			$object->actiontypecode='AC_OTH_AUTO';
@@ -304,7 +304,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
 			$object->fk_element=0;
 			$object->elementtype='';
 		}
-        elseif ($action == 'FICHINTER_SENTBYMAIL')
+		elseif ($action == 'FICHINTER_SENTBYMAIL')
         {
         	$langs->load("other");
             $langs->load("interventions");
@@ -316,19 +316,31 @@ class InterfaceActionsAuto extends DolibarrTriggers
             // Parameters $object->sendtoid defined by caller
             //$object->sendtoid=0;
         }
-        elseif ($action == 'FICHINTER_CLASSIFYBILLED')
+        elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
+        {
+            $langs->load("other");
+            $langs->load("interventions");
+
+            $object->actiontypecode='AC_OTH_AUTO';
+           	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref);
+           	$object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr",$object->ref);
+            $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
+
+            $object->sendtoid=0;
+        }
+	    elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED')
         {
             $langs->load("other");
             $langs->load("interventions");
 
             $object->actiontypecode='AC_OTH_AUTO';
-            if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilled",$object->ref);
-            $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilled",$object->ref);
+           	if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref);
+           	$object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr",$object->ref);
             $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
 
             $object->sendtoid=0;
         }
-		elseif ($action == 'FICHINTER_DELETE')
+        elseif ($action == 'FICHINTER_DELETE')
         {
             $langs->load("other");
             $langs->load("interventions");

+ 4 - 2
htdocs/install/mysql/data/llx_c_action_trigger.sql

@@ -60,12 +60,14 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10);
 insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','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_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','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 ('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_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 ('PROPAL_CLASSIFY_BILLED','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_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);

+ 4 - 4
htdocs/install/mysql/migration/3.6.0-3.7.0.sql

@@ -21,9 +21,11 @@
 
 --insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_MODIFY','Intervention modified','Executed when a intervention is modified','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_CLASSIFY_BILLED','Intervention set billed','Executed when a intervention is set to billed (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED 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 ('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 ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROPAL_CLASSIFY_BILLED','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;
 
@@ -47,8 +49,6 @@ ALTER TABLE llx_fichinter ADD COLUMN ref_ext 	varchar(255);
 -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B)
 ALTER TABLE llx_c_typent ADD COLUMN fk_country integer NULL AFTER libelle;
 
-INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (29,'FICHINTER_CLASSIFY_BILLED','Classify intervention as billed','Executed when a intervention is classified as billed (when option FICHINTER_DISABLE_DETAILS is set)','ficheinter',19);
-
 INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) values (11,'AC_INT','system','Intervention on site',NULL, 1, 4);
 
 ALTER TABLE llx_user ADD COLUMN fk_user_creat integer AFTER tms;

+ 0 - 3
htdocs/langs/en_US/agenda.lang

@@ -51,7 +51,6 @@ OrderApprovedInDolibarr=Order %s approved
 OrderRefusedInDolibarr=Order %s refused
 OrderBackToDraftInDolibarr=Order %s go back to draft status
 OrderCanceledInDolibarr=Order %s canceled
-InterventionValidatedInDolibarr=Intervention %s validated
 ProposalSentByEMail=Commercial proposal %s sent by EMail
 OrderSentByEMail=Customer order %s sent by EMail
 InvoiceSentByEMail=Customer invoice %s sent by EMail
@@ -59,8 +58,6 @@ SupplierOrderSentByEMail=Supplier order %s sent by EMail
 SupplierInvoiceSentByEMail=Supplier invoice %s sent by EMail
 ShippingSentByEMail=Shipping %s sent by EMail
 ShippingValidated= Shipping %s validated
-InterventionSentByEMail=Intervention %s sent by EMail
-InterventionClassifiedBilled=Intervention %s classified as Billed
 NewCompanyToDolibarr= Third party created
 DateActionPlannedStart= Planned start date
 DateActionPlannedEnd= Planned end date

+ 7 - 0
htdocs/langs/en_US/interventions.lang

@@ -31,6 +31,13 @@ RelatedInterventions=Related interventions
 ShowIntervention=Show intervention
 SendInterventionRef=Submission of intervention %s
 SendInterventionByMail=Send intervention by Email
+InterventionCreatedInDolibarr=Intervention %s created
+InterventionValidatedInDolibarr=Intervention %s validated
+InterventionModifiedInDolibarr=Intervention %s modified
+InterventionClassifiedBilledInDolibarr=Intervention %s set as billed
+InterventionClassifiedUnbilledInDolibarr=Intervention %s set as unbilled
+InterventionSentByEMail=Intervention %s sent by EMail
+InterventionDeletedInDolibarr=Intervention %s deleted
 ##### Types de contacts #####
 TypeContact_fichinter_internal_INTERREPFOLL=Representative following-up intervention
 TypeContact_fichinter_internal_INTERVENING=Intervening