Fix hrm module

This commit is contained in:
Laurent Destailleur 2016-08-31 18:57:27 +02:00
parent f04a3bf0c8
commit 1360372a3c
3 changed files with 19 additions and 17 deletions

View File

@ -110,7 +110,8 @@ if ($result)
$establishmentstatic->id=$obj->rowid; $establishmentstatic->id=$obj->rowid;
$establishmentstatic->name=$obj->name; $establishmentstatic->name=$obj->name;
$establishmentstatic->status=$obj->status;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'.$establishmentstatic->getNomUrl(1).'</td>'; print '<td>'.$establishmentstatic->getNomUrl(1).'</td>';
@ -119,7 +120,7 @@ if ($result)
print '<td align="left">'.$obj->town.'</td>'; print '<td align="left">'.$obj->town.'</td>';
print '<td align="right">'; print '<td align="right">';
print $establishmenttmp->getLibStatus(5); print $establishmentstatic->getLibStatus(5);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -58,8 +58,8 @@ class Establishment extends CommonObject
{ {
$this->db = $db; $this->db = $db;
$this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); $this->statuts_short = array(0 => 'Closed', 1 => 'Opened');
$this->statuts = array(0 => 'Opened', 1 => 'Closed'); $this->statuts = array(0 => 'Closed', 1 => 'Opened');
return 1; return 1;
} }
@ -157,7 +157,7 @@ class Establishment extends CommonObject
$sql .= ", address = '".$this->address."'"; $sql .= ", address = '".$this->address."'";
$sql .= ", zip = '".$this->zip."'"; $sql .= ", zip = '".$this->zip."'";
$sql .= ", town = '".$this->town."'"; $sql .= ", town = '".$this->town."'";
$sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null');
$sql .= ", status = '".$this->status."'"; $sql .= ", status = '".$this->status."'";
$sql .= ", fk_user_mod = " . $user->id; $sql .= ", fk_user_mod = " . $user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -273,23 +273,23 @@ class Establishment extends CommonObject
} }
if ($mode == 2) if ($mode == 2)
{ {
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]); if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts_short[$status]);
if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts_short[$status]); if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]);
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4'); if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5');
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8'); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4');
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]); if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts[$status]);
if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut8').' '.$langs->trans($this->statuts[$status]); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]);
} }
if ($mode == 5) if ($mode == 5)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4'); if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5');
if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut8'); if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4');
} }
} }

View File

@ -40,8 +40,8 @@ $id = GETPOST('id','int');
// List of status // List of status
static $tmpstatus2label=array( static $tmpstatus2label=array(
'0'=>'OpenEtablishment', '0'=>'CloseEtablishment',
'1'=>'CloseEtablishment' '1'=>'OpenEtablishment'
); );
$status2label=array(''); $status2label=array('');
foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val); foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val);
@ -138,7 +138,7 @@ else if ($action == 'update')
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha'); $object->town = GETPOST('town', 'alpha');
$object->country_id = $_POST["country_id"]; $object->country_id = GETPOST('country_id', 'int');
$object->fk_user_mod = $user->id; $object->fk_user_mod = $user->id;
$result = $object->update($user); $result = $object->update($user);
@ -378,7 +378,8 @@ else if ($id)
print '</tr>'; print '</tr>';
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatus(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
print $object->getLibStatus(4).'</td></tr>';
print "</table>"; print "</table>";