mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW intervention signed status update (#30629)
* Added confirm_sign, confirm_unsign, sign & unsign actions. Added sign-unsign button. * Updated create & fetch methods with signed_status * Added EN localization * Added intervention signed notification * Added intervention signed auto event. Updated EN localization. Fixed trigger. * Cleaned code * Added signed label to status badge * Cleaned code * Added signed statues dictionary. Added method to get signed status label badge. * Added signed status to intervention list * Added sign localizations * Added sign confirm select. Refactored signed statuses dictionary. * Added method to get localized signed statuses arrray. Refactored code. Added EN localization. * Fixed signed status update * Cleaned code * Updated EN localization * Cleaned code * Changed sign workflow to exclude only drafts * Added signed status change with online sign * Improved signed status workflow * Removed db structure changes * Updated action trigger to FICHINTER_MODIFY * Updated EN localizations * Refactored to use FICHINTER_MODIFY trigger with localized context message. Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Updated EN localizations. * Added STATUS_SIGNED_RECEIVER_ONLINE signed status. Cleaned Ecode. * Fixed undeclared constant * Added contributor details * Updated notification logic to use object context to pass signature status * Refactored to make use of object context for event notification. Cleaned code. * Fixed deprecated method * Cleaned code
This commit is contained in:
parent
8ae78a33ff
commit
30805c68da
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -567,6 +568,8 @@ if ($action == "importSignature") {
|
|||
// Document format not supported to insert online signature.
|
||||
// We should just create an image file with the signature.
|
||||
}
|
||||
$user = new User($db);
|
||||
$object->setSignedStatus($user, $object::SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'], 0, 'FICHINTER_MODIFY');
|
||||
}
|
||||
} elseif ($mode == "societe_rib") {
|
||||
$langs->load('withdrawals');
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
|
||||
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -10716,15 +10717,15 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Set to a signed status
|
||||
* Set signed status & call trigger with context message
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param int $status New status to set (often a constant like self::STATUS_XXX)
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @param string $triggercode Trigger code to use
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param User $user Object user that modify
|
||||
* @param int $status New signed status to set (often a constant like self::STATUS_XXX)
|
||||
* @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers
|
||||
* @param string $triggercode Trigger code to use
|
||||
* @return int 0 < if KO, > 0 if OK
|
||||
*/
|
||||
public function setSignedStatusCommon($user, $status, $notrigger = 0, $triggercode = '')
|
||||
public function setSignedStatusCommon(User $user, int $status, int $notrigger = 0, string $triggercode = '')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
|
|
@ -10750,7 +10751,7 @@ abstract class CommonObject
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->status = $status;
|
||||
$this->signed_status = $status;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ class Notify
|
|||
'PROPAL_CLOSE_SIGNED',
|
||||
'PROPAL_CLOSE_REFUSED',
|
||||
'FICHINTER_VALIDATE',
|
||||
'FICHINTER_MODIFY',
|
||||
'FICHINTER_CLOSE',
|
||||
'FICHINTER_ADD_CONTACT',
|
||||
'ORDER_SUPPLIER_CANCEL',
|
||||
|
|
@ -811,6 +812,13 @@ class Notify
|
|||
$object_type = 'ficheinter';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
|
||||
break;
|
||||
case 'FICHINTER_MODIFY':
|
||||
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$context_info = array_key_exists('signature', $object->context) ? $object->getLibSignedStatus() : '';
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionModified", $link, $context_info);
|
||||
break;
|
||||
case 'FICHINTER_CLOSE':
|
||||
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
|
|
@ -1105,6 +1113,13 @@ class Notify
|
|||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
|
||||
break;
|
||||
case 'FICHINTER_MODIFY':
|
||||
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$context_info = array_key_exists('signature', $object->context) ? $object->getLibSignedStatus() : '';
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionModified", $link, $context_info);
|
||||
break;
|
||||
case 'FICHINTER_CLOSE':
|
||||
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
|
|
|
|||
|
|
@ -201,6 +201,56 @@ if (empty($reshook)) {
|
|||
} else {
|
||||
$mesg = $object->error;
|
||||
}
|
||||
} elseif ($action == 'confirm_sign' && $confirm == 'yes' && $user->hasRight('ficheinter', 'creer')) {
|
||||
$result = $object->setSignedStatus($user, GETPOSTINT('signed_status'), 0, 'FICHINTER_MODIFY');
|
||||
if ($result >= 0) {
|
||||
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||
$newlang = GETPOST('lang_id', 'aZ09');
|
||||
}
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
exit;
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
}
|
||||
} elseif ($action == 'confirm_unsign' && $confirm == 'yes' && $user->hasRight('ficheinter', 'creer')) {
|
||||
$result = $object->setSignedStatus($user, $object::SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'FICHINTER_MODIFY');
|
||||
if ($result >= 0) {
|
||||
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||
$newlang = GETPOST('lang_id', 'aZ09');
|
||||
}
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$result = fichinter_create($db, $object, (!GETPOST('model', 'alpha')) ? $object->model_pdf : GETPOST('model', 'alpha'), $outputlangs);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
exit;
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
}
|
||||
} elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->hasRight('ficheinter', 'creer')) {
|
||||
$result = $object->setDraft($user);
|
||||
if ($result >= 0) {
|
||||
|
|
@ -1146,6 +1196,37 @@ if ($action == 'create') {
|
|||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate', '', 1, 1);
|
||||
}
|
||||
|
||||
// Confirm sign
|
||||
if ($action == 'sign') {
|
||||
$text = $langs->trans('ConfirmSignIntervention');
|
||||
if (isModEnabled('notification')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('FICHINTER_MODIFY', $object->socid, $object);
|
||||
}
|
||||
$formquestion = [];
|
||||
$formquestion[] = [
|
||||
'type' => 'select',
|
||||
'name' => 'signed_status',
|
||||
'label' => '<span class="fieldrequired">'.$langs->trans('SignStatus').'</span>',
|
||||
'values' => $object->getSignedStatusLocalisedArray()
|
||||
];
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SignIntervention'), $text, 'confirm_sign', $formquestion, 0, 1);
|
||||
}
|
||||
|
||||
// Confirm unsign
|
||||
if ($action == 'unsign') {
|
||||
$text = $langs->trans('ConfirmUnsignIntervention');
|
||||
if (isModEnabled('notification')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('FICHINTER_MODIFY', $object->socid, $object);
|
||||
}
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('UnsignIntervention'), $text, 'confirm_unsign', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirm done
|
||||
if ($action == 'classifydone') {
|
||||
$text = $langs->trans('ConfirmCloseIntervention');
|
||||
|
|
@ -1723,6 +1804,15 @@ if ($action == 'create') {
|
|||
}
|
||||
}
|
||||
|
||||
// Sign
|
||||
if ($object->statut > Fichinter::STATUS_DRAFT) {
|
||||
if ($object->signed_status != Fichinter::SIGNED_STATUSES['STATUS_SIGNED_ALL']) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=sign&token=' . newToken() . '">' . $langs->trans("InterventionSign") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=unsign&token=' . newToken() . '">' . $langs->trans("InterventionUnsign") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Done
|
||||
if (!getDolGlobalString('FICHINTER_CLASSIFY_BILLED') && $object->statut > Fichinter::STATUS_DRAFT && $object->statut < Fichinter::STATUS_CLOSED) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifydone&token='.newToken().'">'.$langs->trans("InterventionClassifyDone").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Fichinter extends CommonObject
|
|||
'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90),
|
||||
'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95),
|
||||
'duree' => array('type' => 'double', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100),
|
||||
'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 9 => 'SignedAll')),
|
||||
'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 3 => 'SignedReceiverOnline', 9 => 'SignedAll')),
|
||||
'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2),
|
||||
'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110),
|
||||
'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 115),
|
||||
|
|
@ -203,27 +203,16 @@ class Fichinter extends CommonObject
|
|||
*/
|
||||
const STATUS_CLOSED = 3;
|
||||
|
||||
|
||||
/**
|
||||
* No signature
|
||||
* Signed statuses dictionary. Label used as key for string localizations.
|
||||
*/
|
||||
const STATUS_NO_SIGNATURE = 0;
|
||||
|
||||
/**
|
||||
* Signed by sender
|
||||
*/
|
||||
const STATUS_SIGNED_SENDER = 1;
|
||||
|
||||
/**
|
||||
* Signed by receiver
|
||||
*/
|
||||
const STATUS_SIGNED_RECEIVER = 2;
|
||||
|
||||
/**
|
||||
* Signed by all
|
||||
*/
|
||||
const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)
|
||||
|
||||
const SIGNED_STATUSES = [
|
||||
'STATUS_NO_SIGNATURE' => 0,
|
||||
'STATUS_SIGNED_SENDER' => 1,
|
||||
'STATUS_SIGNED_RECEIVER' => 2,
|
||||
'STATUS_SIGNED_RECEIVER_ONLINE' => 3,
|
||||
'STATUS_SIGNED_ALL' => 9 // To handle future kind of signature (ex: tripartite contract)
|
||||
];
|
||||
|
||||
/**
|
||||
* Date delivery
|
||||
|
|
@ -342,6 +331,7 @@ class Fichinter extends CommonObject
|
|||
$sql .= ", fk_projet";
|
||||
$sql .= ", fk_contrat";
|
||||
$sql .= ", fk_statut";
|
||||
$sql .= ", signed_status";
|
||||
$sql .= ", note_private";
|
||||
$sql .= ", note_public";
|
||||
$sql .= ") ";
|
||||
|
|
@ -358,6 +348,7 @@ class Fichinter extends CommonObject
|
|||
$sql .= ", ".($this->fk_project ? ((int) $this->fk_project) : 0);
|
||||
$sql .= ", ".($this->fk_contrat ? ((int) $this->fk_contrat) : 0);
|
||||
$sql .= ", ".((int) $this->statut);
|
||||
$sql .= ", ".($this->signed_status);
|
||||
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
|
@ -492,7 +483,7 @@ class Fichinter extends CommonObject
|
|||
*/
|
||||
public function fetch($rowid, $ref = '')
|
||||
{
|
||||
$sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut as status,";
|
||||
$sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut as status, f.signed_status,";
|
||||
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
|
||||
$sql .= " f.date_valid as datev,";
|
||||
$sql .= " f.tms as datem,";
|
||||
|
|
@ -518,6 +509,7 @@ class Fichinter extends CommonObject
|
|||
$this->socid = $obj->fk_soc;
|
||||
$this->status = $obj->status;
|
||||
$this->statut = $obj->status; // deprecated
|
||||
$this->signed_status= $obj->signed_status;
|
||||
$this->duration = $obj->duree;
|
||||
$this->datec = $this->db->jdate($obj->datec);
|
||||
$this->dateo = $this->db->jdate($obj->dateo);
|
||||
|
|
@ -857,10 +849,11 @@ class Fichinter extends CommonObject
|
|||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
// Init/load array of translation of status
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
global $langs;
|
||||
$langs->load("interventions");
|
||||
$langs->load("propal");
|
||||
|
||||
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
|
||||
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
|
||||
|
|
@ -876,7 +869,54 @@ class Fichinter extends CommonObject
|
|||
if ($status == self::STATUS_BILLED || $status == self::STATUS_CLOSED) {
|
||||
$statuscode = 'status6';
|
||||
}
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statuscode, $mode);
|
||||
|
||||
$signed_label = ' (' . $this->getLibSignedStatus() . ')';
|
||||
$status_label = $this->signed_status ? $this->labelStatus[$status] . $signed_label : $this->labelStatus[$status];
|
||||
$status_label_short = $this->signed_status ? $this->labelStatusShort[$status] . $signed_label : $this->labelStatusShort[$status];
|
||||
|
||||
return dolGetStatus($status_label, $status_label_short, '', $statuscode, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label for signed status
|
||||
*
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Label
|
||||
*/
|
||||
public function getLibSignedStatus(int $mode = 0): string
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("commercial");
|
||||
$list_signed_status = $this->getSignedStatusLocalisedArray();
|
||||
$signed_status_label = $list_signed_status[$this->signed_status];
|
||||
$signed_status_label_short = $list_signed_status[$this->signed_status];
|
||||
$signed_status_code = 'status'.$this->signed_status;
|
||||
return dolGetStatus($signed_status_label, $signed_status_label_short, '', $signed_status_code, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of signed statuses with associated localized labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSignedStatusLocalisedArray(): array
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("commercial");
|
||||
|
||||
$l10n_signed_status_labels = [
|
||||
self::SIGNED_STATUSES['STATUS_NO_SIGNATURE'] => 'NoSignature',
|
||||
self::SIGNED_STATUSES['STATUS_SIGNED_SENDER'] => 'SignedSender',
|
||||
self::SIGNED_STATUSES['STATUS_SIGNED_RECEIVER'] => 'SignedReceiver',
|
||||
self::SIGNED_STATUSES['STATUS_SIGNED_RECEIVER_ONLINE'] => 'SignedReceiverOnline',
|
||||
self::SIGNED_STATUSES['STATUS_SIGNED_ALL'] => 'SignedAll'
|
||||
];
|
||||
|
||||
$l10n_signed_status = [];
|
||||
foreach (self::SIGNED_STATUSES as $signed_status_code) {
|
||||
$l10n_signed_status[$signed_status_code] = $langs->transnoentitiesnoconv($l10n_signed_status_labels[$signed_status_code]);
|
||||
}
|
||||
return $l10n_signed_status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1642,16 +1682,37 @@ class Fichinter extends CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Set signed status
|
||||
* Set signed status & object context. Call sign action trigger.
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param int $status Newsigned status to set (often a constant like self::STATUS_XXX)
|
||||
* @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers
|
||||
* @param string $triggercode Trigger code to use
|
||||
* @return int 0 < if KO, > 0 if OK
|
||||
* @param User $user Object user that modify
|
||||
* @param int $status New signed status to set (often a constant like self::STATUS_XXX)
|
||||
* @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers
|
||||
* @param string $triggercode Trigger code to use
|
||||
* @return int 0 < if KO, > 0 if OK
|
||||
*/
|
||||
public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int
|
||||
public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, string $triggercode = ''): int
|
||||
{
|
||||
global $langs;
|
||||
$langs->loadLangs(array('interventions', 'commercial'));
|
||||
$this->signed_status = $status;
|
||||
$this->context['signature'] = $status;
|
||||
switch ($status) {
|
||||
case 0:
|
||||
$this->context['actionmsg2'] = $langs->transnoentitiesnoconv('InterventionUnsignedInDolibarr');
|
||||
break;
|
||||
case 1:
|
||||
$this->context['actionmsg2'] = $langs->transnoentitiesnoconv('SignedSender');
|
||||
break;
|
||||
case 2:
|
||||
$this->context['actionmsg2'] = $langs->transnoentitiesnoconv('SignedReceiver');
|
||||
break;
|
||||
case 3:
|
||||
$this->context['actionmsg2'] = $langs->transnoentitiesnoconv('SignedReceiverOnline');
|
||||
break;
|
||||
case 9:
|
||||
$this->context['actionmsg2'] = $langs->transnoentitiesnoconv('SignedAll');
|
||||
break;
|
||||
}
|
||||
return $this->setSignedStatusCommon($user, $status, $notrigger, $triggercode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||
$search_projet_ref = GETPOST('search_projet_ref', 'alpha');
|
||||
$search_contrat_ref = GETPOST('search_contrat_ref', 'alpha');
|
||||
$search_status = GETPOST('search_status', 'alpha');
|
||||
$search_signed_status = GETPOST('search_signed_status', 'alpha');
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_date_startday = GETPOSTINT('search_date_startday');
|
||||
$search_date_startmonth = GETPOSTINT('search_date_startmonth');
|
||||
|
|
@ -141,6 +142,7 @@ $arrayfields = array(
|
|||
'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
|
||||
'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
|
||||
'f.fk_statut' => array('label' => 'Status', 'checked' => 1, 'position' => 1000),
|
||||
'f.signed_status' =>array('label' => 'Signed status', 'checked' => 0, 'position' => 1001),
|
||||
'fd.description' => array('label' => "DescriptionOfLine", 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0),
|
||||
'fd.date' => array('label' => 'DateOfLine', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0),
|
||||
'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), //type duration is here because in database, column 'duree' is double
|
||||
|
|
@ -196,6 +198,7 @@ if (empty($reshook)) {
|
|||
$search_contrat_ref = "";
|
||||
$search_desc = "";
|
||||
$search_status = "";
|
||||
$search_signed_status = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
|
|
@ -253,7 +256,7 @@ foreach ($arrayfields as $tmpkey => $tmpval) {
|
|||
}
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_modification, f.note_public, f.note_private,";
|
||||
$sql .= " f.ref, f.ref_client, f.rowid, f.fk_statut as status, f.signed_status as signed_status, f.description, f.datec as date_creation, f.tms as date_modification, f.note_public, f.note_private,";
|
||||
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
|
||||
$sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
|
||||
}
|
||||
|
|
@ -327,6 +330,9 @@ if ($search_desc) {
|
|||
if ($search_status != '' && $search_status >= 0) {
|
||||
$sql .= ' AND f.fk_statut = '.urlencode($search_status);
|
||||
}
|
||||
if ($search_signed_status != '' && $search_signed_status >= 0) {
|
||||
$sql .= ' AND f.signed_status = '.urlencode($search_signed_status);
|
||||
}
|
||||
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND fd.date >= '".$db->idate($search_date_start)."'";
|
||||
|
|
@ -456,6 +462,9 @@ if ($search_desc) {
|
|||
if ($search_status != '' && $search_status > -1) {
|
||||
$param .= "&search_status=".urlencode($search_status);
|
||||
}
|
||||
if ($search_signed_status != '' && $search_signed_status >= 0) {
|
||||
$param .= '&search_signed_status='.urlencode($search_signed_status);
|
||||
}
|
||||
if ($search_date_startday > 0) {
|
||||
$param .= '&search_date_startday='.urlencode((string) ($search_date_startday));
|
||||
}
|
||||
|
|
@ -655,6 +664,13 @@ if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
|||
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status width100 onrightofpage');
|
||||
print '</td>';
|
||||
}
|
||||
// Signed status
|
||||
if (!empty($arrayfields['f.signed_status']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
$list_signed_status = $object->getSignedStatusLocalisedArray();
|
||||
print $form->selectarray('search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status');
|
||||
print '</td>';
|
||||
}
|
||||
// Fields of detail line
|
||||
if (!empty($arrayfields['fd.description']['checked'])) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
|
|
@ -742,6 +758,10 @@ if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
|||
print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['f.signed_status']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.signed_status']['label'], $_SERVER["PHP_SELF"], "f.signed_status", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($arrayfields['fd.description']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -787,6 +807,7 @@ while ($i < $imaxinloop) {
|
|||
$objectstatic->ref_client = $obj->ref_client;
|
||||
$objectstatic->statut = $obj->status; // deprecated
|
||||
$objectstatic->status = $obj->status;
|
||||
$objectstatic->signed_status = $obj->signed_status;
|
||||
|
||||
$companystatic->name = $obj->name;
|
||||
$companystatic->id = $obj->socid;
|
||||
|
|
@ -977,6 +998,13 @@ while ($i < $imaxinloop) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Signed Status
|
||||
if (!empty($arrayfields['f.signed_status']['checked'])) {
|
||||
print '<td class="center">'.$objectstatic->getLibSignedStatus(5).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Fields of detail of line
|
||||
if (!empty($arrayfields['fd.description']['checked'])) {
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($obj->descriptiondetail, 1));
|
||||
|
|
|
|||
|
|
@ -94,3 +94,9 @@ SignatureContractRef=Signature of contract %s
|
|||
SignatureFichinterRef=Signature of intervention %s
|
||||
SignatureSociete_ribRef=Signature of SEPA Mandate %s
|
||||
FeatureOnlineSignDisabled=Feature for online signing disabled or document generated before the feature was enabled
|
||||
NoSignature=Not signed
|
||||
SignedSender=Signed internally
|
||||
SignedReceiver=Signed by third party
|
||||
SignedReceiverOnline=Signed by third party online
|
||||
SignedAll=Signed by all parties
|
||||
SignStatus=Signature status
|
||||
|
|
|
|||
|
|
@ -13,11 +13,15 @@ CreateDraftIntervention=Create draft
|
|||
InterventionContact=Intervention contact
|
||||
DeleteIntervention=Delete intervention
|
||||
ValidateIntervention=Validate intervention
|
||||
SignIntervention=Sign intervention
|
||||
UnsignIntervention=Unsign intervention
|
||||
ModifyIntervention=Modify intervention
|
||||
CloseIntervention=Close intervention
|
||||
DeleteInterventionLine=Delete intervention line
|
||||
ConfirmDeleteIntervention=Are you sure you want to delete this intervention?
|
||||
ConfirmValidateIntervention=Are you sure you want to validate this intervention under name <b>%s</b>?
|
||||
ConfirmSignIntervention=Are you sure you want to set this intervention as signed ?
|
||||
ConfirmUnsignIntervention=Are you sure you want to set this intervention as unsigned ?
|
||||
ConfirmModifyIntervention=Are you sure you want to modify this intervention?
|
||||
ConfirmCloseIntervention=Are you sure you want to close this intervention?
|
||||
ConfirmDeleteInterventionLine=Are you sure you want to delete this intervention line?
|
||||
|
|
@ -29,10 +33,15 @@ InterventionCardsAndInterventionLines=Interventions and lines of interventions
|
|||
InterventionClassifyBilled=Classify "Billed"
|
||||
InterventionClassifyUnBilled=Classify "Unbilled"
|
||||
InterventionClassifyDone=Classify "Done"
|
||||
InterventionSign=Set Signed
|
||||
InterventionUnsign=Set Unsigned
|
||||
SendInterventionRef=Submission of intervention %s
|
||||
SendInterventionByMail=Send intervention by email
|
||||
InterventionCreatedInDolibarr=Intervention %s created
|
||||
InterventionValidatedInDolibarr=Intervention %s validated
|
||||
InterventionSignedInDolibarr=Intervention signed
|
||||
InterventionSignedOnline=Intervention signed online
|
||||
InterventionUnsignedInDolibarr=Intervention unsigned
|
||||
InterventionModifiedInDolibarr=Intervention %s modified
|
||||
InterventionClassifiedBilledInDolibarr=Intervention %s set as billed
|
||||
InterventionClassifiedUnbilledInDolibarr=Intervention %s set as unbilled
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ Notify_BILL_SUPPLIER_SENTBYMAIL=Vendor invoice sent by mail
|
|||
Notify_BILL_SUPPLIER_CANCELED=Vendor invoice canceled
|
||||
Notify_CONTRACT_VALIDATE=Contract validated
|
||||
Notify_FICHINTER_VALIDATE=Intervention validated
|
||||
Notify_FICHINTER_MODIFY=Intervention modified
|
||||
Notify_FICHINTER_CLOSE=Intervention closed
|
||||
Notify_FICHINTER_ADD_CONTACT=Added contact to Intervention
|
||||
Notify_FICHINTER_SENTBYMAIL=Intervention sent by mail
|
||||
|
|
@ -209,6 +210,7 @@ AmountIn=Amount in %s
|
|||
NumberOfUnitsMos=Number of units to produce in manufacturing orders
|
||||
EMailTextInterventionAddedContact=A new intervention %s has been assigned to you.
|
||||
EMailTextInterventionValidated=The intervention %s has been validated.
|
||||
EMailTextInterventionModified=The intervention %s has been modified. %s
|
||||
EMailTextInterventionClosed=The intervention %s has been closed.
|
||||
EMailTextInvoiceValidated=Invoice %s has been validated.
|
||||
EMailTextInvoicePayed=Invoice %s has been paid.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user