This commit is contained in:
aspangaro 2015-10-11 21:00:41 +02:00
parent 8b97196c2f
commit 2857d7cfda
2 changed files with 33 additions and 33 deletions

View File

@ -40,7 +40,7 @@ class Establishment extends CommonObject
var $address; var $address;
var $zip; var $zip;
var $town; var $town;
var $statut; // 0=open, 1=closed var $status; // 0=open, 1=closed
var $entity; var $entity;
var $statuts=array(); var $statuts=array();
@ -82,7 +82,7 @@ class Establishment extends CommonObject
$sql.= ", address"; $sql.= ", address";
$sql.= ", zip"; $sql.= ", zip";
$sql.= ", town"; $sql.= ", town";
$sql.= ", statut"; $sql.= ", status";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ", datec"; $sql.= ", datec";
$sql.= ", fk_user_author"; $sql.= ", fk_user_author";
@ -91,7 +91,7 @@ class Establishment extends CommonObject
$sql.= ", '".$this->address."'"; $sql.= ", '".$this->address."'";
$sql.= ", '".$this->zip."'"; $sql.= ", '".$this->zip."'";
$sql.= ", '".$this->town."'"; $sql.= ", '".$this->town."'";
$sql.= ", ".$this->statut; $sql.= ", ".$this->status;
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ". $user->id; $sql.= ", ". $user->id;
@ -148,7 +148,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 .= ", statut = '".$this->statut."'"; $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;
@ -172,7 +172,7 @@ class Establishment extends CommonObject
*/ */
function fetch($id) function fetch($id)
{ {
$sql = "SELECT rowid, name, address, zip, town, statut"; $sql = "SELECT rowid, name, address, zip, town, status";
$sql.= " FROM ".MAIN_DB_PREFIX."establishment"; $sql.= " FROM ".MAIN_DB_PREFIX."establishment";
$sql.= " WHERE rowid = ".$id; $sql.= " WHERE rowid = ".$id;
@ -187,7 +187,7 @@ class Establishment extends CommonObject
$this->address = $obj->address; $this->address = $obj->address;
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
$this->statut = $obj->statut; $this->status = $obj->status;
return 1; return 1;
} }
@ -231,49 +231,49 @@ class Establishment extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @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 * @return string Label
*/ */
function getLibStatut($mode=0) function getLibStatus($mode=0)
{ {
return $this->LibStatut($this->statut,$mode); return $this->LibStatus($this->status,$mode);
} }
/** /**
* Give a label from a status * Give a label from a status
* *
* @param int $statut Id status * @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 * @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 * @return string Label
*/ */
function LibStatut($statut,$mode=0) function LibStatus($status,$mode=0)
{ {
global $langs; global $langs;
if ($mode == 0) if ($mode == 0)
{ {
return $langs->trans($this->statuts[$statut]); return $langs->trans($this->statuts[$status]);
} }
if ($mode == 1) if ($mode == 1)
{ {
return $langs->trans($this->statuts_short[$statut]); return $langs->trans($this->statuts_short[$status]);
} }
if ($mode == 2) if ($mode == 2)
{ {
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'status4').' '.$langs->trans($this->statuts_short[$status]);
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts_short[$statut]); if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'status8').' '.$langs->trans($this->statuts_short[$status]);
} }
if ($mode == 3) if ($mode == 3)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status4');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status8');
} }
if ($mode == 4) if ($mode == 4)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status4').' '.$langs->trans($this->statuts[$status]);
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'status8').' '.$langs->trans($this->statuts[$status]);
} }
if ($mode == 5) if ($mode == 5)
{ {
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'status4');
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'status8');
} }
} }

View File

@ -38,13 +38,13 @@ $cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm','alpha');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
// List of statut // List of status
static $tmpstatut2label=array( static $tmpstatus2label=array(
'0'=>'OpenEtablishment', '0'=>'OpenEtablishment',
'1'=>'CloseEtablishment' '1'=>'CloseEtablishment'
); );
$statut2label=array(''); $status2label=array('');
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val);
$object = new Establishment($db); $object = new Establishment($db);
@ -93,7 +93,7 @@ else if ($action == 'add')
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha'); $object->town = GETPOST('town', 'alpha');
$object->fk_pays = $object->country_id; $object->fk_pays = $object->country_id;
$object->statut = GETPOST('statut','int'); $object->status = GETPOST('status','int');
$object->fk_user_author = $user->id; $object->fk_user_author = $user->id;
$object->datec = dol_now(); $object->datec = dol_now();
@ -234,11 +234,11 @@ if ($action == 'create')
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Statut // Status
print '<tr>'; print '<tr>';
print '<td class="fieldrequired"><label for="statut">'.$langs->trans("Statut").'</label></td>'; print '<td class="fieldrequired"><label for="status">'.$langs->trans("Status").'</label></td>';
print '<td>'; print '<td>';
print $form->selectarray('statut',$statut2label,GETPOST('statut')); print $form->selectarray('status',$status2label,GETPOST('status'));
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -311,9 +311,9 @@ else if ($id)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Statut // Status
print '<tr><td><label for="statut">'.$langs->trans("Statut").'</label></td><td>'; print '<tr><td><label for="status">'.$langs->trans("Status").'</label></td><td>';
print $form->selectarray('statut',$statut2label,$object->statut); print $form->selectarray('status',$status2label,$object->status);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@ -382,8 +382,8 @@ else if ($id)
print '<td colspan="2">'.getCountry($object->fk_pays,1).'</td>'; print '<td colspan="2">'.getCountry($object->fk_pays,1).'</td>';
print '</tr>'; print '</tr>';
// Statut // Status
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatus(4).'</td></tr>';
print "</table>"; print "</table>";