Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
4d9fc36ff2
@ -162,7 +162,7 @@ if (empty($reshook)) {
|
|||||||
$halfday = 1;
|
$halfday = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$valideur = GETPOST('valideur', 'int');
|
$approverid = GETPOST('valideur', 'int');
|
||||||
$description = trim(GETPOST('description', 'restricthtml'));
|
$description = trim(GETPOST('description', 'restricthtml'));
|
||||||
|
|
||||||
// Check that leave is for a user inside the hierarchy or advanced permission for all is set
|
// Check that leave is for a user inside the hierarchy or advanced permission for all is set
|
||||||
@ -229,7 +229,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If no validator designated
|
// If no validator designated
|
||||||
if ($valideur < 1) {
|
if ($approverid < 1) {
|
||||||
setEventMessages($langs->transnoentitiesnoconv('InvalidValidatorCP'), null, 'errors');
|
setEventMessages($langs->transnoentitiesnoconv('InvalidValidatorCP'), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ if (empty($reshook)) {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$object->fk_user = $fuserid;
|
$object->fk_user = $fuserid;
|
||||||
$object->description = $description;
|
$object->description = $description;
|
||||||
$object->fk_validator = $valideur;
|
$object->fk_validator = $approverid;
|
||||||
$object->fk_type = $type;
|
$object->fk_type = $type;
|
||||||
$object->date_debut = $date_debut;
|
$object->date_debut = $date_debut;
|
||||||
$object->date_fin = $date_fin;
|
$object->date_fin = $date_fin;
|
||||||
@ -315,7 +315,7 @@ if (empty($reshook)) {
|
|||||||
if ($object->statut == Holiday::STATUS_DRAFT) {
|
if ($object->statut == Holiday::STATUS_DRAFT) {
|
||||||
// If this is the requestor or has read/write rights
|
// If this is the requestor or has read/write rights
|
||||||
if ($cancreate) {
|
if ($cancreate) {
|
||||||
$valideur = GETPOST('valideur', 'int');
|
$approverid = GETPOST('valideur', 'int');
|
||||||
$description = trim(GETPOST('description', 'restricthtml'));
|
$description = trim(GETPOST('description', 'restricthtml'));
|
||||||
|
|
||||||
// If no start date
|
// If no start date
|
||||||
@ -337,7 +337,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If no validator designated
|
// If no validator designated
|
||||||
if ($valideur < 1) {
|
if ($approverid < 1) {
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur');
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&error=Valideur');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ if (empty($reshook)) {
|
|||||||
$object->description = $description;
|
$object->description = $description;
|
||||||
$object->date_debut = $date_debut;
|
$object->date_debut = $date_debut;
|
||||||
$object->date_fin = $date_fin;
|
$object->date_fin = $date_fin;
|
||||||
$object->fk_validator = $valideur;
|
$object->fk_validator = $approverid;
|
||||||
$object->halfday = $halfday;
|
$object->halfday = $halfday;
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
@ -1100,8 +1100,8 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
|||||||
if (($id > 0) || $ref) {
|
if (($id > 0) || $ref) {
|
||||||
$result = $object->fetch($id, $ref);
|
$result = $object->fetch($id, $ref);
|
||||||
|
|
||||||
$valideur = new User($db);
|
$approverexpected = new User($db);
|
||||||
$valideur->fetch($object->fk_validator);
|
$approverexpected->fetch($object->fk_validator);
|
||||||
|
|
||||||
$userRequest = new User($db);
|
$userRequest = new User($db);
|
||||||
$userRequest->fetch($object->fk_user);
|
$userRequest->fetch($object->fk_user);
|
||||||
@ -1314,7 +1314,14 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
|
|||||||
print $langs->trans('ReviewedByCP');
|
print $langs->trans('ReviewedByCP');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$valideur->getNomUrl(-1);
|
print '<td>';
|
||||||
|
if ($object->statut == Holiday::STATUS_APPROVED || $object->statut == Holiday::STATUS_CANCELED) {
|
||||||
|
$approverdone = new User($db);
|
||||||
|
$approverdone->fetch($object->fk_user_valid);
|
||||||
|
print $approverdone->getNomUrl(-1);
|
||||||
|
} else {
|
||||||
|
print $approverexpected->getNomUrl(-1);
|
||||||
|
}
|
||||||
$include_users = $object->fetch_users_approver_holiday();
|
$include_users = $object->fetch_users_approver_holiday();
|
||||||
if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) {
|
if (is_array($include_users) && in_array($user->id, $include_users) && $object->statut == Holiday::STATUS_VALIDATED) {
|
||||||
print '<a class="editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editvalidator">'.img_edit($langs->trans("Edit")).'</a>';
|
print '<a class="editfielda paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editvalidator">'.img_edit($langs->trans("Edit")).'</a>';
|
||||||
|
|||||||
@ -85,31 +85,42 @@ class Holiday extends CommonObject
|
|||||||
public $statut = ''; // 1=draft, 2=validated, 3=approved
|
public $statut = ''; // 1=draft, 2=validated, 3=approved
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID of user that must approve. TODO: there is no date for validation (date_valid is used for approval), add one.
|
||||||
*/
|
*/
|
||||||
public $fk_validator;
|
public $fk_validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Date of approval. TODO: Add a field for approval date and use date_valid instead for validation.
|
||||||
|
*/
|
||||||
public $date_valid = '';
|
public $date_valid = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID of user that has approved (empty if not approved)
|
||||||
*/
|
*/
|
||||||
public $fk_user_valid;
|
public $fk_user_valid;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Date for refuse
|
||||||
|
*/
|
||||||
public $date_refuse = '';
|
public $date_refuse = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID for refuse
|
||||||
*/
|
*/
|
||||||
public $fk_user_refuse;
|
public $fk_user_refuse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Date for cancelation
|
||||||
|
*/
|
||||||
public $date_cancel = '';
|
public $date_cancel = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID for cancelation
|
||||||
*/
|
*/
|
||||||
public $fk_user_cancel;
|
public $fk_user_cancel;
|
||||||
|
|
||||||
|
|
||||||
public $detail_refuse = '';
|
public $detail_refuse = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2106,7 +2117,7 @@ class Holiday extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT f.rowid,";
|
$sql = "SELECT f.rowid, f.statut as status,";
|
||||||
$sql .= " f.date_create as datec,";
|
$sql .= " f.date_create as datec,";
|
||||||
$sql .= " f.tms as date_modification,";
|
$sql .= " f.tms as date_modification,";
|
||||||
$sql .= " f.date_valid as datev,";
|
$sql .= " f.date_valid as datev,";
|
||||||
@ -2114,8 +2125,8 @@ class Holiday extends CommonObject
|
|||||||
$sql .= " f.date_refuse as dater,";
|
$sql .= " f.date_refuse as dater,";
|
||||||
$sql .= " f.fk_user_create as fk_user_creation,";
|
$sql .= " f.fk_user_create as fk_user_creation,";
|
||||||
$sql .= " f.fk_user_modif as fk_user_modification,";
|
$sql .= " f.fk_user_modif as fk_user_modification,";
|
||||||
$sql .= " f.fk_user_valid,";
|
$sql .= " f.fk_user_valid as fk_user_approve_done,";
|
||||||
$sql .= " f.fk_validator as fk_user_approve,";
|
$sql .= " f.fk_validator as fk_user_approve_expected,";
|
||||||
$sql .= " f.fk_user_refuse as fk_user_refuse";
|
$sql .= " f.fk_user_refuse as fk_user_refuse";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as f";
|
||||||
$sql .= " WHERE f.rowid = ".((int) $id);
|
$sql .= " WHERE f.rowid = ".((int) $id);
|
||||||
@ -2152,10 +2163,19 @@ class Holiday extends CommonObject
|
|||||||
$muser->fetch($obj->fk_user_modification);
|
$muser->fetch($obj->fk_user_modification);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_approve) {
|
|
||||||
$auser = new User($this->db);
|
if ($obj->status == Holiday::STATUS_APPROVED || $obj->status == Holiday::STATUS_CANCELED) {
|
||||||
$auser->fetch($obj->fk_user_approve);
|
if ($obj->fk_user_approve_done) {
|
||||||
$this->user_approve = $auser;
|
$auser = new User($this->db);
|
||||||
|
$auser->fetch($obj->fk_user_approve_done);
|
||||||
|
$this->user_approve = $auser;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($obj->fk_user_approve_expected) {
|
||||||
|
$auser = new User($this->db);
|
||||||
|
$auser->fetch($obj->fk_user_approve_expected);
|
||||||
|
$this->user_approve = $auser;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user