diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index d93421ef6fb..92ba0bec200 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -166,12 +166,15 @@ foreach($listofnotifiedevents as $notifiedevent) { $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); + elseif ($notifiedevent['elementtype'] == 'shipping') $elementLabel = $langs->trans('Shipping'); + elseif ($notifiedevent['elementtype'] == 'expensereport') $elementLabel = $langs->trans('ExpenseReport'); if ($i) print ', '; print $label; @@ -209,11 +212,15 @@ foreach($listofnotifiedevents as $notifiedevent) $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); + // Special cases if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); + elseif ($notifiedevent['elementtype'] == 'shipping') $elementLabel = $langs->trans('Shipping'); + elseif ($notifiedevent['elementtype'] == 'expensereport') $elementLabel = $langs->trans('ExpenseReport'); print ''; print ''.$elementLabel.''; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 344b8050b65..7a24e4928c7 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -65,6 +65,7 @@ class Notify // Les codes actions sont definis dans la table llx_notify_def // codes actions supported are + // @TODO defined also into interface_50_modNotificiation_Notificiation.class.php public $arrayofnotifsupported = array( 'BILL_VALIDATE', 'BILL_PAYED', @@ -76,7 +77,11 @@ class Notify 'ORDER_SUPPLIER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', - 'SHIPPING_VALIDATE' + 'SHIPPING_VALIDATE', + 'EXPENSE_REPORT_VALIDATE', + 'EXPENSE_REPORT_APPROVE', + 'HOLIDAY_VALIDATE', + 'HOLIDAY_APPROVE' ); @@ -340,22 +345,27 @@ class Notify $oldref=(empty($object->oldref)?$object->ref:$object->oldref); $newref=(empty($object->newref)?$object->ref:$object->newref); + $sql = ''; + // Check notification per third party - $sql = "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; - $sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; - $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; - $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; - $sql.= " ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; - $sql.= " AND n.fk_soc = s.rowid"; - if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage - else $sql.= " AND a.code = '".$notifcode."'"; // New usage - $sql .= " AND s.rowid = ".$object->socid; + if ($object->socid > 0) + { + $sql.= "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,"; + $sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,"; + $sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,"; + $sql.= " ".MAIN_DB_PREFIX."notify_def as n,"; + $sql.= " ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action"; + $sql.= " AND n.fk_soc = s.rowid"; + if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage + else $sql.= " AND a.code = '".$notifcode."'"; // New usage + $sql .= " AND s.rowid = ".$object->socid; + + $sql.= "\nUNION\n"; + } // Check notification per user - $sql.= "\nUNION\n"; - $sql.= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,"; $sql.= " a.rowid as adid, a.label, a.code, n.rowid, n.type"; $sql.= " FROM ".MAIN_DB_PREFIX."user as c,"; @@ -363,7 +373,7 @@ class Notify $sql.= " ".MAIN_DB_PREFIX."notify_def as n"; $sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action"; if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage - else $sql.= " AND a.code = '".$notifcode."'"; // New usage + else $sql.= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage $result = $this->db->query($sql); if ($result) @@ -473,6 +483,26 @@ class Notify $object_type = 'order_supplier'; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref); break; + case 'EXPENSE_REPORT_VALIDATE': + $dir_output = $conf->expensereport->dir_output; + $object_type = 'expensereport'; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportValidated",$newref); + break; + case 'EXPENSE_REPORT_APPROVE': + $dir_output = $conf->expensereport->dir_output; + $object_type = 'expensereport'; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportApproved",$newref); + break; + case 'HOLIDAY_VALIDATE': + $dir_output = $conf->holiday->dir_output; + $object_type = 'holiday'; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated",$newref); + break; + case 'HOLIDAY_APPROVE': + $dir_output = $conf->holiday->dir_output; + $object_type = 'holiday'; + $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved",$newref); + break; } $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; @@ -663,6 +693,26 @@ class Notify $object_type = 'order_supplier'; $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$newref); break; + case 'EXPENSE_REPORT_VALIDATE': + $dir_output = $conf->expensereport->dir_output; + $object_type = 'expensereport'; + $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportValidated",$newref); + break; + case 'EXPENSE_REPORT_APPROVE': + $dir_output = $conf->expensereport->dir_output; + $object_type = 'expensereport'; + $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportApproved",$newref); + break; + case 'HOLIDAY_VALIDATE': + $dir_output = $conf->holiday->dir_output; + $object_type = 'holiday'; + $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayValidated",$newref); + break; + case 'HOLIDAY_APPROVE': + $dir_output = $conf->holiday->dir_output; + $object_type = 'holiday'; + $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved",$newref); + break; } $ref = dol_sanitizeFileName($newref); $pdf_path = $dir_output."/".$ref."/".$ref.".pdf"; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 26b36964676..f5995c47c84 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -44,6 +44,7 @@ class InterfaceNotification extends DolibarrTriggers */ public $picto = 'email'; + // @TODO Defined also into notify.class.php) public $listofmanagedevents=array( 'BILL_VALIDATE', 'BILL_PAYED', @@ -55,8 +56,12 @@ class InterfaceNotification extends DolibarrTriggers 'ORDER_SUPPLIER_VALIDATE', 'ORDER_SUPPLIER_APPROVE', 'ORDER_SUPPLIER_REFUSE', - 'SHIPPING_VALIDATE' - ); + 'SHIPPING_VALIDATE', + 'EXPENSE_REPORT_VALIDATE', + 'EXPENSE_REPORT_APPROVE', + 'HOLIDAY_VALIDATE', + 'HOLIDAY_APPROVE' + ); /** * Function called when a Dolibarrr business event is done. @@ -112,7 +117,7 @@ class InterfaceNotification extends DolibarrTriggers $qualified=0; // Check is this event is supported by notification module - if (in_array($obj->code,$this->listofmanagedevents)) $qualified=1; + if (in_array($obj->code, $this->listofmanagedevents)) $qualified=1; // Check if module for this event is active if ($qualified) { @@ -125,7 +130,7 @@ class InterfaceNotification extends DolibarrTriggers elseif ($element == 'withdraw' && empty($conf->prelevement->enabled)) $qualified=0; elseif ($element == 'shipping' && empty($conf->expedition->enabled)) $qualified=0; elseif ($element == 'member' && empty($conf->adherent->enabled)) $qualified=0; - elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member')) && empty($conf->$element->enabled)) $qualified=0; + elseif (! in_array($element,array('order_supplier','invoice_supplier','withdraw','shipping','member','expensereport')) && empty($conf->$element->enabled)) $qualified=0; } if ($qualified) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index be365c52351..9c89124c577 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -214,7 +214,7 @@ if ($action == 'update') $object->fetch($id); // If under validation - if ($object->statut == 1) + if ($object->statut == Holiday::STATUS_DRAFT) { // If this is the requestor or has read/write rights if ($cancreate) @@ -298,7 +298,7 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights- $object->fetch($id); // If this is a rough draft, approved, canceled or refused - if ($object->statut == 1 || $object->statut == 4 || $object->statut == 5) + if ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED) { // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer if ($candelete) @@ -332,11 +332,13 @@ if ($action == 'confirm_send') $object->fetch($id); // Si brouillon et créateur - if($object->statut == 1 && $cancreate) + if($object->statut == Holiday::STATUS_DRAFT && $cancreate) { - $object->statut = 2; + $object->oldcopy = dol_clone($object); - $verif = $object->update($user); + $object->statut = Holiday::STATUS_VALIDATED; + + $verif = $object->validate($user); // Si pas d'erreur SQL on redirige vers la fiche de la demande if ($verif > 0) @@ -435,13 +437,15 @@ if ($action == 'confirm_valid') $object->fetch($id); // Si statut en attente de validation et valideur = utilisateur - if ($object->statut == 2 && $user->id == $object->fk_validator) + if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { + $object->oldcopy = dol_clone($object); + $object->date_valid = dol_now(); $object->fk_user_valid = $user->id; - $object->statut = 3; + $object->statut = Holiday::STATUS_APPROVED; - $verif = $object->update($user); + $verif = $object->approve($user); // Si pas d'erreur SQL on redirige vers la fiche de la demande if ($verif > 0) @@ -530,11 +534,11 @@ if ($action == 'confirm_refuse' && GETPOST('confirm','alpha') == 'yes') $object->fetch($id); // Si statut en attente de validation et valideur = utilisateur - if ($object->statut == 2 && $user->id == $object->fk_validator) + if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator) { $object->date_refuse = dol_print_date('dayhour', dol_now()); $object->fk_user_refuse = $user->id; - $object->statut = 5; + $object->statut = Holiday::STATUS_REFUSED; $object->detail_refuse = GETPOST('detail_refuse','alphanohtml'); $verif = $object->update($user); @@ -615,7 +619,7 @@ if ($action == 'confirm_draft' && GETPOST('confirm') == 'yes') $object->fetch($id); $oldstatus = $object->statut; - $object->statut = 1; + $object->statut = Holiday::STATUS_DRAFT; $result = $object->update($user); if ($result < 0) @@ -646,18 +650,18 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') $object->fetch($id); // Si statut en attente de validation et valideur = valideur ou utilisateur, ou droits de faire pour les autres - if (($object->statut == 2 || $object->statut == 3) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all))) + if (($object->statut == Holiday::STATUS_VALIDATED || $object->statut == Holiday::STATUS_APPROVED) && ($user->id == $object->fk_validator || in_array($object->fk_user, $childids) || ! empty($user->rights->holiday->write_all))) { $db->begin(); $oldstatus = $object->statut; $object->date_cancel = dol_now(); $object->fk_user_cancel = $user->id; - $object->statut = 4; + $object->statut = Holiday::STATUS_CANCELED; $result = $object->update($user); - if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold + if ($result >= 0 && $oldstatus == Holiday::STATUS_APPROVED) // holiday was already validated, status 3, so we must increase back sold { // Calculcate number of days consummed $nbopenedday=num_open_day($object->date_debut_gmt,$object->date_fin_gmt,0,1,$object->halfday); diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index a888a4919a6..bc964ec7fc6 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -598,6 +598,234 @@ class Holiday extends CommonObject } } + + /** + * Validate leave request + * + * @param User $user User that validate + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function validate($user=null, $notrigger=0) + { + global $conf, $langs; + $error=0; + + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET"; + + $sql.= " description= '".$this->db->escape($this->description)."',"; + + if(!empty($this->date_debut)) { + $sql.= " date_debut = '".$this->db->idate($this->date_debut)."',"; + } else { + $error++; + } + if(!empty($this->date_fin)) { + $sql.= " date_fin = '".$this->db->idate($this->date_fin)."',"; + } else { + $error++; + } + $sql.= " halfday = ".$this->halfday.","; + if(!empty($this->statut) && is_numeric($this->statut)) { + $sql.= " statut = ".$this->statut.","; + } else { + $error++; + } + if(!empty($this->fk_validator)) { + $sql.= " fk_validator = '".$this->db->escape($this->fk_validator)."',"; + } else { + $error++; + } + if(!empty($this->date_valid)) { + $sql.= " date_valid = '".$this->db->idate($this->date_valid)."',"; + } else { + $sql.= " date_valid = NULL,"; + } + if(!empty($this->fk_user_valid)) { + $sql.= " fk_user_valid = '".$this->db->escape($this->fk_user_valid)."',"; + } else { + $sql.= " fk_user_valid = NULL,"; + } + if(!empty($this->date_refuse)) { + $sql.= " date_refuse = '".$this->db->idate($this->date_refuse)."',"; + } else { + $sql.= " date_refuse = NULL,"; + } + if(!empty($this->fk_user_refuse)) { + $sql.= " fk_user_refuse = '".$this->db->escape($this->fk_user_refuse)."',"; + } else { + $sql.= " fk_user_refuse = NULL,"; + } + if(!empty($this->date_cancel)) { + $sql.= " date_cancel = '".$this->db->idate($this->date_cancel)."',"; + } else { + $sql.= " date_cancel = NULL,"; + } + if(!empty($this->fk_user_cancel)) { + $sql.= " fk_user_cancel = '".$this->db->escape($this->fk_user_cancel)."',"; + } else { + $sql.= " fk_user_cancel = NULL,"; + } + if(!empty($this->detail_refuse)) { + $sql.= " detail_refuse = '".$this->db->escape($this->detail_refuse)."'"; + } else { + $sql.= " detail_refuse = NULL"; + } + + $sql.= " WHERE rowid= ".$this->id; + + $this->db->begin(); + + dol_syslog(get_class($this)."::validate", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error++; $this->errors[]="Error ".$this->db->lasterror(); + } + + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('HOLIDAY_VALIDATE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::validate ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } + + + /** + * Approve leave request + * + * @param User $user User that approve + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function approve($user=null, $notrigger=0) + { + global $conf, $langs; + $error=0; + + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."holiday SET"; + + $sql.= " description= '".$this->db->escape($this->description)."',"; + + if(!empty($this->date_debut)) { + $sql.= " date_debut = '".$this->db->idate($this->date_debut)."',"; + } else { + $error++; + } + if(!empty($this->date_fin)) { + $sql.= " date_fin = '".$this->db->idate($this->date_fin)."',"; + } else { + $error++; + } + $sql.= " halfday = ".$this->halfday.","; + if(!empty($this->statut) && is_numeric($this->statut)) { + $sql.= " statut = ".$this->statut.","; + } else { + $error++; + } + if(!empty($this->fk_validator)) { + $sql.= " fk_validator = '".$this->db->escape($this->fk_validator)."',"; + } else { + $error++; + } + if(!empty($this->date_valid)) { + $sql.= " date_valid = '".$this->db->idate($this->date_valid)."',"; + } else { + $sql.= " date_valid = NULL,"; + } + if(!empty($this->fk_user_valid)) { + $sql.= " fk_user_valid = '".$this->db->escape($this->fk_user_valid)."',"; + } else { + $sql.= " fk_user_valid = NULL,"; + } + if(!empty($this->date_refuse)) { + $sql.= " date_refuse = '".$this->db->idate($this->date_refuse)."',"; + } else { + $sql.= " date_refuse = NULL,"; + } + if(!empty($this->fk_user_refuse)) { + $sql.= " fk_user_refuse = '".$this->db->escape($this->fk_user_refuse)."',"; + } else { + $sql.= " fk_user_refuse = NULL,"; + } + if(!empty($this->date_cancel)) { + $sql.= " date_cancel = '".$this->db->idate($this->date_cancel)."',"; + } else { + $sql.= " date_cancel = NULL,"; + } + if(!empty($this->fk_user_cancel)) { + $sql.= " fk_user_cancel = '".$this->db->escape($this->fk_user_cancel)."',"; + } else { + $sql.= " fk_user_cancel = NULL,"; + } + if(!empty($this->detail_refuse)) { + $sql.= " detail_refuse = '".$this->db->escape($this->detail_refuse)."'"; + } else { + $sql.= " detail_refuse = NULL"; + } + + $sql.= " WHERE rowid= ".$this->id; + + $this->db->begin(); + + dol_syslog(get_class($this)."::approve", LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error++; $this->errors[]="Error ".$this->db->lasterror(); + } + + if (! $error) + { + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('HOLIDAY_APPROVE',$user); + if ($result < 0) { $error++; } + // End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::approve ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + else + { + $this->db->commit(); + return 1; + } + } + /** * Update database * diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 435d98a7a88..6f3bb5461f8 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -101,6 +101,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expensereport',204); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143); -- actions not enabled by default (no constant created for that) when we enable module agenda diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index c29cc803836..9048c681aa1 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -69,6 +69,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTRACT_DELETE','Contract deleted','Executed when a contract is deleted','contrat',18); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_DELETE','Intervention is deleted','Executed when a intervention is deleted','ficheinter',35); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Expense report validated','Executed when an expense report is validated','expensereport',202); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203); ALTER TABLE llx_payment_salary ADD COLUMN fk_projet integer DEFAULT NULL after amount; diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 67b9681fa3b..91442bbd05d 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -31,9 +31,6 @@ NextYearOfInvoice=Following year of invoice date DateNextInvoiceBeforeGen=Date of next invoice (before generation) DateNextInvoiceAfterGen=Date of next invoice (after generation) -Notify_FICHINTER_ADD_CONTACT=Added contact to Intervention -Notify_FICHINTER_VALIDATE=Intervention validated -Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail Notify_ORDER_VALIDATE=Customer order validated Notify_ORDER_SENTBYMAIL=Customer order sent by mail Notify_ORDER_SUPPLIER_SENTBYMAIL=Supplier order sent by mail @@ -60,6 +57,8 @@ Notify_BILL_SUPPLIER_SENTBYMAIL=Supplier invoice sent by mail Notify_BILL_SUPPLIER_CANCELED=Supplier invoice cancelled Notify_CONTRACT_VALIDATE=Contract validated Notify_FICHEINTER_VALIDATE=Intervention validated +Notify_FICHINTER_ADD_CONTACT=Added contact to Intervention +Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail Notify_SHIPPING_VALIDATE=Shipping validated Notify_SHIPPING_SENTBYMAIL=Shipping sent by mail Notify_MEMBER_VALIDATE=Member validated @@ -71,6 +70,10 @@ Notify_PROJECT_CREATE=Project creation Notify_TASK_CREATE=Task created Notify_TASK_MODIFY=Task modified Notify_TASK_DELETE=Task deleted +Notify_EXPENSE_REPORT_VALIDATE=Expense report validated (approval required) +Notify_EXPENSE_REPORT_APPROVE=Expense report approved +Notify_HOLIDAY_VALIDATE=Leave request validated (approval required) +Notify_HOLIDAY_APPROVE=Leave request approved SeeModuleSetup=See setup of module %s NbOfAttachedFiles=Number of attached files/documents TotalSizeOfAttachedFiles=Total size of attached files/documents @@ -198,6 +201,10 @@ EMailTextOrderApprovedBy=The order %s has been approved by %s. EMailTextOrderRefused=The order %s has been refused. EMailTextOrderRefusedBy=The order %s has been refused by %s. EMailTextExpeditionValidated=The shipping %s has been validated. +EMailTextExpenseReportValidated=The expense report %s has been validated. +EMailTextExpenseReportApproved=The expensereport %s has been approved. +EMailTextHolidayValidated=The leave request %s has been validated. +EMailTextHolidayApproved=The leave request %s has been approved. ImportedWithSet=Importation data set DolibarrNotification=Automatic notification ResizeDesc=Enter new width OR new height. Ratio will be kept during resizing...