|
@@ -38,7 +38,7 @@ class Holiday extends CommonObject
|
|
|
var $errors=array();
|
|
|
|
|
|
var $rowid;
|
|
|
- var $ref;
|
|
|
+ var $ref;
|
|
|
|
|
|
var $fk_user;
|
|
|
var $date_create='';
|
|
@@ -356,11 +356,11 @@ class Holiday extends CommonObject
|
|
|
$sql.= " cp.fk_user_cancel,";
|
|
|
$sql.= " cp.detail_refuse,";
|
|
|
|
|
|
- $sql.= " uu.name as user_lastname,";
|
|
|
- $sql.= " uu.firstname as user_firstname,";
|
|
|
+ $sql.= " uu.name as user_lastname,";
|
|
|
+ $sql.= " uu.firstname as user_firstname,";
|
|
|
|
|
|
- $sql.= " ua.name as validator_lastname,";
|
|
|
- $sql.= " ua.firstname as validator_firstname";
|
|
|
+ $sql.= " ua.name as validator_lastname,";
|
|
|
+ $sql.= " ua.firstname as validator_firstname";
|
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
|
|
|
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
|
|
@@ -461,7 +461,7 @@ class Holiday extends CommonObject
|
|
|
} else {
|
|
|
$error++;
|
|
|
}
|
|
|
- $sql.= " halfday = ".$this->halfday.",";
|
|
|
+ $sql.= " halfday = ".$this->halfday.",";
|
|
|
if(!empty($this->statut) && is_numeric($this->statut)) {
|
|
|
$sql.= " statut = '".$this->statut."',";
|
|
|
} else {
|
|
@@ -603,8 +603,8 @@ class Holiday extends CommonObject
|
|
|
|
|
|
foreach($this->holiday as $infos_CP)
|
|
|
{
|
|
|
- if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
|
|
|
- if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
|
|
|
+ if ($infos_CP['statut'] == 4) continue; // ignore not validated holidays
|
|
|
+ if ($infos_CP['statut'] == 5) continue; // ignore not validated holidays
|
|
|
|
|
|
// TODO Also use halfday for the check
|
|
|
if ($dateDebut >= $infos_CP['date_debut'] && $dateDebut <= $infos_CP['date_fin'] || $dateFin <= $infos_CP['date_fin'] && $dateFin >= $infos_CP['date_debut'])
|
|
@@ -618,42 +618,42 @@ class Holiday extends CommonObject
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * Return clicable name (with picto eventually)
|
|
|
- *
|
|
|
- * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
|
|
- * @return string String with URL
|
|
|
- */
|
|
|
- function getNomUrl($withpicto=0)
|
|
|
- {
|
|
|
- global $langs;
|
|
|
-
|
|
|
- $result='';
|
|
|
-
|
|
|
- $lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
|
|
|
- $lienfin='</a>';
|
|
|
-
|
|
|
- $picto='holiday';
|
|
|
-
|
|
|
- $label=$langs->trans("Show").': '.$this->ref;
|
|
|
-
|
|
|
- if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
|
|
- if ($withpicto && $withpicto != 2) $result.=' ';
|
|
|
- if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
|
|
- return $result;
|
|
|
+ /**
|
|
|
+ * Return clicable name (with picto eventually)
|
|
|
+ *
|
|
|
+ * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
|
|
|
+ * @return string String with URL
|
|
|
+ */
|
|
|
+ function getNomUrl($withpicto=0)
|
|
|
+ {
|
|
|
+ global $langs;
|
|
|
+
|
|
|
+ $result='';
|
|
|
+
|
|
|
+ $lien = '<a href="'.DOL_URL_ROOT.'/holiday/fiche.php?id='.$this->id.'">';
|
|
|
+ $lienfin='</a>';
|
|
|
+
|
|
|
+ $picto='holiday';
|
|
|
+
|
|
|
+ $label=$langs->trans("Show").': '.$this->ref;
|
|
|
+
|
|
|
+ if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
|
|
|
+ if ($withpicto && $withpicto != 2) $result.=' ';
|
|
|
+ if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
|
|
+ return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * Returns the label 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
|
|
|
- */
|
|
|
- function getLibStatut($mode=0)
|
|
|
- {
|
|
|
- return $this->LibStatut($this->statut, $mode, $this->date_debut);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * Returns the label 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
|
|
|
+ */
|
|
|
+ function getLibStatut($mode=0)
|
|
|
+ {
|
|
|
+ return $this->LibStatut($this->statut, $mode, $this->date_debut);
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* Returns the label of a statut
|
|
@@ -675,26 +675,26 @@ class Holiday extends CommonObject
|
|
|
if ($statut == 4) return $langs->trans('CancelCP');
|
|
|
if ($statut == 5) return $langs->trans('RefuseCP');
|
|
|
}
|
|
|
- if ($mode == 2)
|
|
|
- {
|
|
|
+ if ($mode == 2)
|
|
|
+ {
|
|
|
$pictoapproved='statut6';
|
|
|
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
|
|
- if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
|
|
|
- if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
|
|
|
- if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
|
|
|
- if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP');
|
|
|
- if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP');
|
|
|
- }
|
|
|
- if ($mode == 5)
|
|
|
+ if ($statut == 1) return img_picto($langs->trans('DraftCP'),'statut0').' '.$langs->trans('DraftCP'); // Draft
|
|
|
+ if ($statut == 2) return img_picto($langs->trans('ToValidateCP'),'statut1').' '.$langs->trans('ToValidateCP'); // Waiting approval
|
|
|
+ if ($statut == 3) return img_picto($langs->trans('ValidateCP'),$pictoapproved).' '.$langs->trans('ValidateCP');
|
|
|
+ if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP');
|
|
|
+ if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP');
|
|
|
+ }
|
|
|
+ if ($mode == 5)
|
|
|
{
|
|
|
- $pictoapproved='statut6';
|
|
|
+ $pictoapproved='statut6';
|
|
|
if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4';
|
|
|
- if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
|
|
|
- if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
|
|
|
- if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
|
|
|
- if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
|
|
|
- if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
|
|
|
- }
|
|
|
+ if ($statut == 1) return $langs->trans('DraftCP').' '.img_picto($langs->trans('DraftCP'),'statut0'); // Draft
|
|
|
+ if ($statut == 2) return $langs->trans('ToValidateCP').' '.img_picto($langs->trans('ToValidateCP'),'statut1'); // Waiting approval
|
|
|
+ if ($statut == 3) return $langs->trans('ValidateCP').' '.img_picto($langs->trans('ValidateCP'),$pictoapproved);
|
|
|
+ if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5');
|
|
|
+ if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5');
|
|
|
+ }
|
|
|
|
|
|
return $statut;
|
|
|
}
|