diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index c4e68356349..e7a6b897fdb 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -94,7 +94,7 @@ function payment_expensereport_prepare_head(PaymentExpenseReport $object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/expensereport/payment/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("ExpenseReport"); + $head[$h][1] = $langs->trans("ExpenseReportPayment"); $head[$h][2] = 'payment'; $h++; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 34c33f5aaab..2e826cb4080 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -225,7 +225,7 @@ if (empty($reshook)) $fuser = new User($db); $fuser->fetch($object->fk_user_author); - $object->fk_statut = 1; + $object->status = 1; $object->fk_c_paiement = GETPOST('fk_c_paiement', 'int'); $object->fk_user_validator = GETPOST('fk_user_validator', 'int'); $object->note_public = GETPOST('note_public', 'restricthtml'); @@ -275,7 +275,7 @@ if (empty($reshook)) $object->date_debut = $date_start; $object->date_fin = $date_end; - if ($object->fk_statut < 3) + if ($object->status < 3) { $object->fk_user_validator = GETPOST('fk_user_validator', 'int'); } @@ -288,7 +288,7 @@ if (empty($reshook)) $result = $object->update($user); if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); @@ -1505,7 +1505,7 @@ if ($action == 'create') $head = expensereport_prepare_head($object); - if ($action == 'edit' && ($object->fk_statut < 3 || $object->fk_statut == 99)) + if ($action == 'edit' && ($object->status < 3 || $object->status == 99)) { print "
\n"; print ''; @@ -1513,7 +1513,7 @@ if ($action == 'create') dol_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip'); - if ($object->fk_statut == 99) + if ($object->status == 99) { print ''; } else { @@ -1563,7 +1563,7 @@ if ($action == 'create') print ''; } - if ($object->fk_statut < 3) + if ($object->status < 3) { print ''; print ''.$langs->trans("VALIDATOR").''; // Approbator @@ -1583,7 +1583,7 @@ if ($action == 'create') print ''; } - if ($object->fk_statut == 6) + if ($object->status == 6) { print ''; print ''.$langs->trans("AUTHORPAIEMENT").''; @@ -1618,7 +1618,7 @@ if ($action == 'create') if (!empty($user->rights->expensereport->readall)) $criteriaforfilter = ''; $formquestion = array( 'text' => '', - array('type' => 'other', 'name' => 'fk_user_author', 'label' => $langs->trans("SelectTargetUser"), 'value' => $form->select_dolusers((GETPOST('fk_user_author', 'int') > 0 ? GETPOST('fk_user_author', 'int') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter)) + array('type' => 'other', 'name' => 'fk_user_author', 'label' => $langs->trans("SelectTargetUser"), 'value' => $form->select_dolusers((GETPOST('fk_user_author', 'int') > 0 ? GETPOST('fk_user_author', 'int') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter, '', '0', 0, 0, '', 0, '', 'maxwidth150')) ); // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneExpenseReport', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); @@ -1763,7 +1763,7 @@ if ($action == 'create') print ''; // User to inform for approval - if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) // informed + if ($object->status <= ExpenseReport::STATUS_VALIDATED) // informed { print ''; print ''.$langs->trans("VALIDATOR").''; // approver @@ -1780,7 +1780,7 @@ if ($action == 'create') } } print ''; - } elseif ($object->fk_statut == ExpenseReport::STATUS_CANCELED) + } elseif ($object->status == ExpenseReport::STATUS_CANCELED) { print ''; print ''.$langs->trans("CANCEL_USER").''; @@ -1819,7 +1819,7 @@ if ($action == 'create') print ''; } - if ($object->fk_statut == 99 || !empty($object->detail_refuse)) + if ($object->status == 99 || !empty($object->detail_refuse)) { print ''; print ''.$langs->trans("REFUSEUR").''; @@ -1837,7 +1837,7 @@ if ($action == 'create') print ''; } - if ($object->fk_statut == $object::STATUS_CLOSED) + if ($object->status == $object::STATUS_CLOSED) { /* TODO this fields are not yet filled print ''; @@ -1872,11 +1872,11 @@ if ($action == 'create') print ''.$langs->trans("AmountHT").''; print ''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).''; $rowspan = 5; - if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) $rowspan++; - elseif ($object->fk_statut == ExpenseReport::STATUS_CANCELED) $rowspan += 2; + if ($object->status <= ExpenseReport::STATUS_VALIDATED) $rowspan++; + elseif ($object->status == ExpenseReport::STATUS_CANCELED) $rowspan += 2; else $rowspan += 2; - if ($object->fk_statut == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan += 2; - if ($object->fk_statut == ExpenseReport::STATUS_CLOSED) $rowspan += 2; + if ($object->status == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan += 2; + if ($object->status == ExpenseReport::STATUS_CLOSED) $rowspan += 2; print ""; print ''; @@ -2010,7 +2010,7 @@ if ($action == 'create') print '
'; $actiontouse = 'updateline'; - if (($object->fk_statut == 0 || $object->fk_statut == 99) && $action != 'editline') $actiontouse = 'addline'; + if (($object->status == 0 || $object->status == 99) && $action != 'editline') $actiontouse = 'addline'; print ''; print ''; @@ -2046,7 +2046,7 @@ if ($action == 'create') print ''; print ''; // Ajout des boutons de modification/suppression - if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer) + if (($object->status < 2 || $object->status == 99) && $user->rights->expensereport->creer) { print ''; } @@ -2195,7 +2195,7 @@ if ($action == 'create') print ''; // Ajout des boutons de modification/suppression - if (($object->fk_statut < ExpenseReport::STATUS_VALIDATED || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) + if (($object->status < ExpenseReport::STATUS_VALIDATED || $object->status == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) { print ''; @@ -2349,7 +2349,7 @@ if ($action == 'create') } // Add a new line - if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) + if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer) { @@ -2549,7 +2549,7 @@ if ($action != 'create' && $action != 'edit') // Send if (empty($user->socid)) { - if ($object->fk_statut > ExpenseReport::STATUS_DRAFT) { + if ($object->status > ExpenseReport::STATUS_DRAFT) { //if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expensereport->expensereport_advance->send)) { print '
'.$langs->trans('SendMail').'
'; //} else @@ -2562,7 +2562,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if ($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_DRAFT) + if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_DRAFT) { if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) { @@ -2582,7 +2582,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if ($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_REFUSED) + if ($user->rights->expensereport->creer && $object->status == ExpenseReport::STATUS_REFUSED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2596,7 +2596,7 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->to_paid && $object->fk_statut == ExpenseReport::STATUS_APPROVED) + if ($user->rights->expensereport->to_paid && $object->status == ExpenseReport::STATUS_APPROVED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2610,7 +2610,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_validator == user courant * Afficher : "Valider" / "Refuser" / "Supprimer" */ - if ($object->fk_statut == ExpenseReport::STATUS_VALIDATED) + if ($object->status == ExpenseReport::STATUS_VALIDATED) { if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { @@ -2619,7 +2619,7 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_VALIDATED) + if ($user->rights->expensereport->approve && $object->status == ExpenseReport::STATUS_VALIDATED) { //if($object->fk_user_validator==$user->id) //{ @@ -2640,13 +2640,13 @@ if ($action != 'create' && $action != 'edit') // If status is Approved // --------------------- - if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_APPROVED) + if ($user->rights->expensereport->approve && $object->status == ExpenseReport::STATUS_APPROVED) { print '
id.'">'.$langs->trans('Deny').'
'; } // If bank module is used - if ($user->rights->expensereport->to_paid && !empty($conf->banque->enabled) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) + if ($user->rights->expensereport->to_paid && !empty($conf->banque->enabled) && $object->status == ExpenseReport::STATUS_APPROVED) { // Pay if ($remaintopay == 0) @@ -2658,7 +2658,7 @@ if ($action != 'create' && $action != 'edit') } // If bank module is not used - if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) + if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->status == ExpenseReport::STATUS_APPROVED) { //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) if ($object->paid == 0) @@ -2667,20 +2667,20 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) + if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->status == ExpenseReport::STATUS_APPROVED) { // Cancel print '
id.'">'.$langs->trans('Cancel').'
'; } // TODO Replace this. It should be SetUnpaid and should go back to status unpaid not canceled. - if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == ExpenseReport::STATUS_CLOSED) + if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->status == ExpenseReport::STATUS_CLOSED) { // Cancel print '
id.'">'.$langs->trans('Cancel').'
'; } - if ($user->rights->expensereport->to_paid && $object->paid && $object->fk_statut == ExpenseReport::STATUS_CLOSED) + if ($user->rights->expensereport->to_paid && $object->paid && $object->status == ExpenseReport::STATUS_CLOSED) { // Set unpaid print '
id.'">'.$langs->trans('ClassifyUnPaid').'
'; @@ -2692,11 +2692,11 @@ if ($action != 'create' && $action != 'edit') } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ - if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut < ExpenseReport::STATUS_APPROVED) + if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->status < ExpenseReport::STATUS_APPROVED) { // Delete print '
id.'">'.$langs->trans('Delete').'
'; - } elseif ($user->rights->expensereport->supprimer && $object->fk_statut != ExpenseReport::STATUS_CLOSED) + } elseif ($user->rights->expensereport->supprimer && $object->status != ExpenseReport::STATUS_CLOSED) { // Delete print '
id.'">'.$langs->trans('Delete').'
'; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b06e34eb92a..b32e95597e8 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -64,6 +64,13 @@ class ExpenseReport extends CommonObject * @var int Status */ public $status; + + /** + * 0=draft, 2=validated (attente approb), 4=canceled, 5=approved, 6=payed, 99=denied + * + * @var int Status + * @deprecated + */ public $fk_statut; public $fk_c_paiement; @@ -398,7 +405,7 @@ class ExpenseReport extends CommonObject $this->id = 0; $this->ref = ''; $this->status = 0; - $this->fk_statut = 0; + $this->fk_statut = 0; // deprecated // Clear fields $this->fk_user_author = $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for. @@ -407,6 +414,15 @@ class ExpenseReport extends CommonObject $this->date_creation = ''; $this->date_validation = ''; + // Remove link on lines to a joined file + if (is_array($this->lines) && count($this->lines) > 0) + { + foreach ($this->lines as $key => $line) + { + $this->lines[$key]->fk_ecm_files = 0; + } + } + // Create clone $this->context['createfromclone'] = 'createfromclone'; $result = $this->create($user); @@ -578,7 +594,7 @@ class ExpenseReport extends CommonObject $this->fk_c_paiement = $obj->fk_c_paiement; $this->paid = $obj->paid; - if ($this->fk_statut == self::STATUS_APPROVED || $this->fk_statut == self::STATUS_CLOSED) + if ($this->status == self::STATUS_APPROVED || $this->status == self::STATUS_CLOSED) { $user_valid = new User($this->db); if ($this->fk_user_valid > 0) $user_valid->fetch($this->fk_user_valid); @@ -668,9 +684,9 @@ class ExpenseReport extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns the label of a statut + * Returns the label of a status * - * @param int $status id statut + * @param int $status ID status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ @@ -857,7 +873,7 @@ class ExpenseReport extends CommonObject { $objp = $this->db->fetch_object($result); - $sql2 = "SELECT d.rowid, d.fk_user_author, d.ref, d.fk_statut"; + $sql2 = "SELECT d.rowid, d.fk_user_author, d.ref, d.fk_statut as status"; $sql2 .= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql2 .= " WHERE d.rowid = ".((int) $objp->fk_expensereport); @@ -866,7 +882,7 @@ class ExpenseReport extends CommonObject $objp->fk_user_author = $obj->fk_user_author; $objp->ref = $obj->ref; - $objp->fk_c_expensereport_status = $obj->fk_statut; + $objp->fk_c_expensereport_status = $obj->status; $objp->rowid = $obj->rowid; $total_HT = $total_HT + $objp->total_ht; @@ -1107,7 +1123,7 @@ class ExpenseReport extends CommonObject $now = dol_now(); // Protection - if ($this->statut == self::STATUS_VALIDATED) + if ($this->status == self::STATUS_VALIDATED) { dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING); return 0; @@ -1195,7 +1211,7 @@ class ExpenseReport extends CommonObject if (!$error) { $this->ref = $num; - $this->statut = self::STATUS_VALIDATED; + $this->status = self::STATUS_VALIDATED; } if (empty($error)) @@ -1237,7 +1253,7 @@ class ExpenseReport extends CommonObject $this->date_debut = $this->db->jdate($objp->date_debut); - if ($this->fk_statut != self::STATUS_VALIDATED) + if ($this->status != self::STATUS_VALIDATED) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= " SET fk_statut = ".self::STATUS_VALIDATED; @@ -1271,7 +1287,7 @@ class ExpenseReport extends CommonObject // date approval $this->date_approve = $now; - if ($this->fk_statut != self::STATUS_APPROVED) + if ($this->status != self::STATUS_APPROVED) { $this->db->begin(); @@ -1327,7 +1343,7 @@ class ExpenseReport extends CommonObject $error = 0; // date de refus - if ($this->fk_statut != self::STATUS_REFUSED) + if ($this->status != self::STATUS_REFUSED) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = ".self::STATUS_REFUSED.", fk_user_refuse = ".$fuser->id.","; @@ -1337,7 +1353,8 @@ class ExpenseReport extends CommonObject $sql .= ' WHERE rowid = '.$this->id; if ($this->db->query($sql)) { - $this->fk_statut = 99; + $this->fk_statut = 99; // deprecated + $this->status = 99; $this->fk_user_refuse = $fuser->id; $this->detail_refuse = $details; $this->date_refuse = $now; @@ -1441,7 +1458,7 @@ class ExpenseReport extends CommonObject // phpcs:enable $error = 0; $this->date_cancel = $this->db->idate(dol_now()); - if ($this->fk_statut != self::STATUS_CANCELED) + if ($this->status != self::STATUS_CANCELED) { $this->db->begin(); @@ -1565,6 +1582,9 @@ class ExpenseReport extends CommonObject $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (!empty($this->total_ttc)) $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + if (isset($this->status)) { + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + } if ($moretitle) $label .= ' - '.$moretitle; //if ($option != 'nolink') @@ -1683,7 +1703,7 @@ class ExpenseReport extends CommonObject dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG); - if ($this->fk_statut == self::STATUS_DRAFT) + if ($this->status == self::STATUS_DRAFT) { if (empty($qty)) $qty = 0; if (empty($fk_c_type_fees) || $fk_c_type_fees < 0) $fk_c_type_fees = 0; @@ -1925,7 +1945,7 @@ class ExpenseReport extends CommonObject { global $user, $mysoc; - if ($this->fk_statut == 0 || $this->fk_statut == 99) + if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_REFUSED) { $this->db->begin(); @@ -2268,8 +2288,8 @@ class ExpenseReport extends CommonObject $sql = "SELECT ex.rowid, ex.date_valid"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as ex"; - if ($option == 'toapprove') $sql .= " WHERE ex.fk_statut = 2"; - else $sql .= " WHERE ex.fk_statut = 5"; + if ($option == 'toapprove') $sql .= " WHERE ex.fk_statut = ".self::STATUS_VALIDATED; + else $sql .= " WHERE ex.fk_statut = ".self::STATUS_APPROVED; $sql .= " AND ex.entity IN (".getEntity('expensereport').")"; if (empty($user->rights->expensereport->readall)) { @@ -2289,12 +2309,12 @@ class ExpenseReport extends CommonObject $response->warning_delay = $conf->expensereport->approve->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("ExpenseReportsToApprove"); $response->labelShort = $langs->trans("ToApprove"); - $response->url = DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=2'; + $response->url = DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut='.self::STATUS_VALIDATED; } else { $response->warning_delay = $conf->expensereport->payment->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("ExpenseReportsToPay"); $response->labelShort = $langs->trans("StatusToPay"); - $response->url = DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=5'; + $response->url = DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut='.self::STATUS_APPROVED; } $response->img = img_object('', "trip"); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index bcae66ca5bf..88141debfad 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2012-2014 Regis Houssin * Copyright (C) 2015-2016 Alexandre Spangaro - * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; if ($conf->deplacement->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $hookmanager = new HookManager($db); @@ -52,6 +53,7 @@ if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INF $holiday = new Holiday($db); $holidaystatic = new Holiday($db); +$staticrecruitmentcandidature = new RecruitmentCandidature($db); $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; @@ -173,7 +175,8 @@ print '
'; // Latest leave requests if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut, x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,"; + $sql .= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; $sql .= " AND x.entity = ".$conf->entity; @@ -203,8 +206,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) print ''.$langs->trans("BoxTitleLastLeaveRequests", min($max, $num)).''; print ''.$langs->trans("from").''; print ''.$langs->trans("to").''; - print ''.$langs->trans("DateModificationShort").''; - print ' '; + print ''.$langs->trans("FullList").''; print ''; if ($num) { @@ -214,6 +216,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) $holidaystatic->id = $obj->rowid; $holidaystatic->ref = $obj->ref; + $holidaystatic->statut = $obj->status; $userstatic->id = $obj->uid; $userstatic->lastname = $obj->lastname; @@ -221,7 +224,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) $userstatic->login = $obj->login; $userstatic->photo = $obj->photo; $userstatic->email = $obj->email; - $userstatic->statut = $obj->statut; + $userstatic->statut = $obj->user_status; print ''; print ''.$holidaystatic->getNomUrl(1).''; @@ -231,10 +234,10 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - print ''.dol_print_date($db->jdate($obj->date_start), 'day').' '.$langs->trans($listhalfday[$starthalfday]); - print ''.dol_print_date($db->jdate($obj->date_end), 'day').' '.$langs->trans($listhalfday[$endhalfday]); + print ''.dol_print_date($db->jdate($obj->date_start), 'day').' '.$langs->trans($listhalfday[$starthalfday]).''; + print ''.dol_print_date($db->jdate($obj->date_end), 'day').' '.$langs->trans($listhalfday[$endhalfday]).''; print ''.dol_print_date($db->jdate($obj->dm), 'day').''; - print ''.$holidaystatic->LibStatut($obj->status, 3).''; + print ''.$holidaystatic->LibStatut($obj->status, 3).''; print ''; $i++; @@ -252,7 +255,8 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) // Latest expense report if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) { - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; + $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,"; + $sql .= " x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE u.rowid = x.fk_user_author"; @@ -275,8 +279,7 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) print ''; print ''.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).''; print ''.$langs->trans("TotalTTC").''; - print ''.$langs->trans("DateModificationShort").''; - print ' '; + print ''.$langs->trans("FullList").''; print ''; if ($num) { @@ -290,13 +293,14 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) $expensereportstatic->id = $obj->rowid; $expensereportstatic->ref = $obj->ref; + $expensereportstatic->statut = $obj->status; $userstatic->id = $obj->uid; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; $userstatic->email = $obj->email; $userstatic->login = $obj->login; - $userstatic->statut = $obj->statut; + $userstatic->statut = $obj->user_status; $userstatic->photo = $obj->photo; print ''; @@ -304,7 +308,7 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) print ''.$userstatic->getNomUrl(-1).''; print ''.price($obj->total_ttc).''; print ''.dol_print_date($db->jdate($obj->dm), 'day').''; - print ''.$expensereportstatic->LibStatut($obj->status, 3).''; + print ''.$expensereportstatic->LibStatut($obj->status, 3).''; print ''; $i++; @@ -314,10 +318,75 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) } print ''; print '
'; + print '
'; } else dol_print_error($db); } +// Last modified job position +if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read) +{ + $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status"; + $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + if ($socid) $sql .= " AND s.fk_soc = $socid"; + $sql .= " ORDER BY rc.tms DESC"; + $sql .= $db->plimit($max, 0); + + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($num) + { + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $staticrecruitmentcandidature->id = $objp->rowid; + $staticrecruitmentcandidature->ref = $objp->ref; + $staticrecruitmentcandidature->email = $objp->email; + $staticrecruitmentcandidature->status = $objp->status; + $staticrecruitmentcandidature->date_creation = $objp->date_creation; + $staticrecruitmentcandidature->firstname = $objp->firstname; + $staticrecruitmentcandidature->lastname = $objp->lastname; + + print ''; + print ''; + print '"; + print '"; + print '"; + print ''; + $i++; + } + + $db->free($resql); + } else { + print ''; + } + print "
'; + print $langs->trans("BoxTitleLatestModifiedCandidatures", $max); + print ''.$langs->trans("FullList").'
'.$staticrecruitmentcandidature->getNomUrl(1, '').''; + print "'.dol_print_date($db->jdate($objp->tms), 'day')."'; + print $staticrecruitmentcandidature->getLibStatut(3); + print "
'.$langs->trans("None").'
"; + print "
"; + print "
"; + } else { + dol_print_error($db); + } +} + print '
'; // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php index 93e4c53eb7c..04d50c34eb8 100644 --- a/htdocs/recruitment/recruitmentindex.php +++ b/htdocs/recruitment/recruitmentindex.php @@ -338,6 +338,7 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $num = $db->num_rows($resql); $i = 0; + print '
'; print ''; print ''; print '"; print '"; - print '"; print ''; @@ -372,7 +373,9 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme } else { print ''; } - print "
'; @@ -361,7 +362,7 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme print ''; print "'.dol_print_date($db->jdate($objp->tms), 'day')."'; + print ''; print $staticrecruitmentjobposition->getLibStatut(3); print "
'.$langs->trans("None").'

"; + print ""; + print "
"; + print "
"; } else { dol_print_error($db); } @@ -397,6 +400,7 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $num = $db->num_rows($resql); $i = 0; + print '
'; print ''; print ''; print '"; print '"; - print '"; print ''; @@ -433,7 +437,9 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme } else { print ''; } - print "
'; @@ -422,7 +426,7 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme print ''; print "'.dol_print_date($db->jdate($objp->tms), 'day')."'; + print ''; print $staticrecruitmentcandidature->getLibStatut(3); print "
'.$langs->trans("None").'

"; + print ""; + print "
"; + print "
"; } else { dol_print_error($db); }