Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-09-18 15:18:16 +02:00
commit b67392b016
34 changed files with 432 additions and 477 deletions

View File

@ -1166,58 +1166,58 @@ class ActionComm extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)';
else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)';
else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)';
} }
else if ($mode == 1) elseif ($mode == 1)
{ {
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable');
else if ($percent==0) return $langs->trans('StatusActionToDo'); elseif ($percent==0) return $langs->trans('StatusActionToDo');
else if ($percent > 0 && $percent < 100) return $percent.'%'; elseif ($percent > 0 && $percent < 100) return $percent.'%';
else if ($percent >= 100) return $langs->trans('StatusActionDone'); elseif ($percent >= 100) return $langs->trans('StatusActionDone');
} }
else if ($mode == 2) elseif ($mode == 2)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo'); elseif ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo');
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%'; elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%';
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone'); elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone');
} }
else if ($mode == 3) elseif ($mode == 3)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1'); elseif ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1');
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3');
else if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6'); elseif ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6');
} }
else if ($mode == 4) elseif ($mode == 4)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable');
else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)'; elseif ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)';
else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)'; elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)';
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)'; elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)';
} }
else if ($mode == 5) elseif ($mode == 5)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); elseif ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); elseif ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
else if ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6'); elseif ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6');
} }
else if ($mode == 6) elseif ($mode == 6)
{ {
if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1'); elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1');
else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6'); elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6');
} }
else if ($mode == 7) elseif ($mode == 7)
{ {
if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9');
else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); elseif ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1');
else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); elseif ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3');
else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6');
} }
return ''; return '';
@ -1564,8 +1564,8 @@ class ActionComm extends CommonObject
// Write file // Write file
if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); elseif ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp); elseif ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp);
if ($result >= 0) if ($result >= 0)
{ {

View File

@ -189,32 +189,32 @@ class ActionCommReminder extends CommonObject
if ($mode == 0 || $mode == 1) if ($mode == 0 || $mode == 1)
{ {
if ($status == 1) return $langs->trans('Done'); if ($status == 1) return $langs->trans('Done');
if ($status == 0) return $langs->trans('ToDo'); elseif ($status == 0) return $langs->trans('ToDo');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Done'),'statut4'); if ($status == 1) return img_picto($langs->trans('Done'),'statut4');
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5'); elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done');
if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
} }
elseif ($mode == 6) elseif ($mode == 6)
{ {
if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4');
if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5');
} }
} }

View File

@ -135,18 +135,17 @@ class PaymentTerm // extends CommonObject
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_payment_term"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_payment_term");
if (! $notrigger) // Uncomment this and change MYOBJECT to your own tag if you
{ // want this action call a trigger.
// Uncomment this and change MYOBJECT to your own tag if you //if (! $notrigger) {
// want this action call a trigger.
//// Call triggers // // Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); // $interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } // if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers // // End call triggers
} //}
} }
// Commit or rollback // Commit or rollback
@ -311,21 +310,16 @@ class PaymentTerm // extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error) // Uncomment this and change MYOBJECT to your own tag if you
{ // want this action call a trigger.
if (! $notrigger) //if (! $error && ! $notrigger) {
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
// Call triggers // Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); //$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } //if ($result < 0) { $error++; $this->errors=$interface->errors; }
// End call triggers // End call triggers
} //}
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
@ -367,21 +361,16 @@ class PaymentTerm // extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error) // Uncomment this and change MYOBJECT to your own tag if you
{ // want this action call a trigger.
if (! $notrigger) //if (! $error && ! $notrigger) {
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers //// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db); //$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; } //if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers //// End call triggers
} //}
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
@ -439,12 +428,9 @@ class PaymentTerm // extends CommonObject
$error++; $error++;
} }
if (! $error) //if (! $error)
{ //{
//}
}
unset($this->context['createfromclone']); unset($this->context['createfromclone']);

View File

@ -77,31 +77,18 @@ class Cchargesociales
$error = 0; $error = 0;
// Clean parameters // Clean parameters
$this->trimParameters(
if (isset($this->libelle)) { array(
$this->libelle = trim($this->libelle); 'libelle',
} 'deductible',
if (isset($this->deductible)) { 'active',
$this->deductible = trim($this->deductible); 'code',
} 'fk_pays',
if (isset($this->active)) { 'module',
$this->active = trim($this->active); 'accountancy_code',
} )
if (isset($this->code)) { );
$this->code = trim($this->code);
}
if (isset($this->fk_pays)) {
$this->fk_pays = trim($this->fk_pays);
}
if (isset($this->module)) {
$this->module = trim($this->module);
}
if (isset($this->accountancy_code)) {
$this->accountancy_code = trim($this->accountancy_code);
}
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -143,7 +130,7 @@ class Cchargesociales
if (!$error) { if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) { //if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger. // want this action to call a trigger.
@ -151,7 +138,7 @@ class Cchargesociales
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); //$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++; //if ($result < 0) $error++;
//// End call triggers //// End call triggers
} //}
} }
// Commit or rollback // Commit or rollback
@ -243,28 +230,17 @@ class Cchargesociales
// Clean parameters // Clean parameters
if (isset($this->libelle)) { $this->trimParameters(
$this->libelle = trim($this->libelle); array(
} 'libelle',
if (isset($this->deductible)) { 'deductible',
$this->deductible = trim($this->deductible); 'active',
} 'code',
if (isset($this->active)) { 'fk_pays',
$this->active = trim($this->active); 'module',
} 'accountancy_code',
if (isset($this->code)) { )
$this->code = trim($this->code); );
}
if (isset($this->fk_pays)) {
$this->fk_pays = trim($this->fk_pays);
}
if (isset($this->module)) {
$this->module = trim($this->module);
}
if (isset($this->accountancy_code)) {
$this->accountancy_code = trim($this->accountancy_code);
}
// Check parameters // Check parameters
@ -290,7 +266,7 @@ class Cchargesociales
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
} }
if (!$error && !$notrigger) { //if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
@ -298,7 +274,7 @@ class Cchargesociales
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers //// End call triggers
} //}
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
@ -328,8 +304,8 @@ class Cchargesociales
$this->db->begin(); $this->db->begin();
if (!$error) { //if (!$error) {
if (!$notrigger) { //if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
@ -337,8 +313,8 @@ class Cchargesociales
//$result=$this->call_trigger('MYOBJECT_DELETE',$user); //$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers //// End call triggers
} //}
} //}
if (!$error) { if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
@ -476,34 +452,33 @@ class Cchargesociales
if ($mode == 0) if ($mode == 0)
{ {
$prefix='';
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
} }
} }

View File

@ -430,8 +430,9 @@ class ChargeSociales extends CommonObject
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load('customers');
$langs->load('bills'); // Load translation files required by the page
$langs->loadLangs(array("customers","bills"));
if ($mode == 0 || $mode == 1) if ($mode == 0 || $mode == 1)
{ {

View File

@ -100,7 +100,7 @@ class Contact extends CommonObject
public $state_code; // Code of department public $state_code; // Code of department
public $state; // Label of department public $state; // Label of department
public $poste; // Position public $poste; // Position
public $socid; // fk_soc public $socid; // fk_soc
public $statut; // 0=inactif, 1=actif public $statut; // 0=inactif, 1=actif
@ -493,8 +493,8 @@ class Contact extends CommonObject
global $conf; global $conf;
$dn=''; $dn='';
if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN; if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
if ($mode==1) $dn=$conf->global->LDAP_CONTACT_DN; elseif ($mode==1) $dn=$conf->global->LDAP_CONTACT_DN;
if ($mode==2) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS]; elseif ($mode==2) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
return $dn; return $dn;
} }
@ -508,12 +508,12 @@ class Contact extends CommonObject
function _load_ldap_info() function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf, $langs;
$info = array(); $info = array();
// Object classes // Object classes
$info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS); $info["objectclass"]=explode(',', $conf->global->LDAP_CONTACT_OBJECT_CLASS);
$this->fullname=$this->getFullName($langs); $this->fullname=$this->getFullName($langs);
@ -887,9 +887,9 @@ class Contact extends CommonObject
if ($obj->nb) if ($obj->nb)
{ {
if ($obj->element=='facture') $this->ref_facturation = $obj->nb; if ($obj->element=='facture') $this->ref_facturation = $obj->nb;
if ($obj->element=='contrat') $this->ref_contrat = $obj->nb; elseif ($obj->element=='contrat') $this->ref_contrat = $obj->nb;
if ($obj->element=='commande') $this->ref_commande = $obj->nb; elseif ($obj->element=='commande') $this->ref_commande = $obj->nb;
if ($obj->element=='propal') $this->ref_propal = $obj->nb; elseif ($obj->element=='propal') $this->ref_propal = $obj->nb;
} }
} }
$this->db->free($resql); $this->db->free($resql);
@ -914,8 +914,8 @@ class Contact extends CommonObject
$error=0; $error=0;
$this->old_lastname = $obj->lastname; $this->old_lastname = $obj->lastname;
$this->old_firstname = $obj->firstname; $this->old_firstname = $obj->firstname;
$this->db->begin(); $this->db->begin();
@ -1035,7 +1035,7 @@ class Contact extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
if ($obj->fk_user_creat) { if ($obj->fk_user_creat) {
$cuser = new User($this->db); $cuser = new User($this->db);

View File

@ -1845,28 +1845,28 @@ class Contrat extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } if ($statut == 0) { return $langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); }
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); } if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); }
if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); } elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); }
if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); } elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); }
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); } if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); }
if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); } elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); }
if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); } elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); }
} }
if ($mode == 4 || $mode == 6 || $mode == 7) elseif ($mode == 4 || $mode == 6 || $mode == 7)
{ {
$text=''; $text='';
if ($mode == 4) if ($mode == 4)
@ -1888,11 +1888,11 @@ class Contrat extends CommonObject
$text.=($mode == 7?'</div>':''); $text.=($mode == 7?'</div>':'');
return $text; return $text;
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'),'statut0'); } if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'),'statut0'); }
if ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); } elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); }
if ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); } elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); }
} }
} }
@ -2116,7 +2116,7 @@ class Contrat extends CommonObject
$sql.= " AND c.rowid = cd.fk_contrat"; $sql.= " AND c.rowid = cd.fk_contrat";
$sql.= " AND cd.statut = 0"; $sql.= " AND cd.statut = 0";
} }
if ($mode == 'expired') elseif ($mode == 'expired')
{ {
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
$sql.= $this->from; $sql.= $this->from;
@ -2637,50 +2637,50 @@ class ContratLigne extends CommonObjectLine
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); } if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); }
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); } elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); }
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); }
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); } if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); } elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); } elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); }
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); } elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); } elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
} }
} }
@ -3020,15 +3020,14 @@ class ContratLigne extends CommonObjectLine
} }
} }
if (! $error) if (! $error && ! $notrigger) {
{ // Call trigger
if (! $notrigger) $result=$this->call_trigger('LINECONTRACT_UPDATE', $user);
{ if ($result < 0) {
// Call trigger $error++;
$result=$this->call_trigger('LINECONTRACT_UPDATE', $user); $this->db->rollback();
if ($result < 0) { $error++; $this->db->rollback(); } }
// End call triggers // End call triggers
}
} }
if (! $error) if (! $error)

View File

@ -431,11 +431,11 @@ abstract class CommonInvoice extends CommonObject
{ {
global $langs; global $langs;
if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard");
if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
return $langs->trans("Unknown"); return $langs->trans("Unknown");
} }
@ -475,10 +475,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
return $langs->trans('Bill'.$prefix.'StatusStarted'); else return $langs->trans('Bill'.$prefix.'StatusStarted');
} }
else else
{ {
@ -493,10 +493,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid');
return $langs->trans('Bill'.$prefix.'StatusStarted'); else return $langs->trans('Bill'.$prefix.'StatusStarted');
} }
else else
{ {
@ -511,10 +511,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft'); if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted');
} }
else else
{ {
@ -529,10 +529,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0'); if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1');
return img_picto($langs->trans('BillStatusStarted'),'statut3'); else return img_picto($langs->trans('BillStatusStarted'),'statut3');
} }
else else
{ {
@ -547,10 +547,10 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially');
if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid');
return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted');
} }
else else
{ {
@ -566,14 +566,14 @@ abstract class CommonInvoice extends CommonObject
if (! $paye) if (! $paye)
{ {
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0'); if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5'); elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9');
if ($alreadypaid <= 0) elseif ($alreadypaid <= 0)
{ {
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1'); if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
} }
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3'); else return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3');
} }
else else
{ {
@ -598,7 +598,9 @@ abstract class CommonInvoice extends CommonObject
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code;
if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id;
$cdr_nbjour=0; $cdr_type=0; $cdr_decalage=0; $cdr_nbjour=0;
$cdr_type=0;
$cdr_decalage=0;
$sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage';
$sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c';

View File

@ -7324,7 +7324,7 @@ abstract class CommonObject
$comment = new Comment($this->db); $comment = new Comment($this->db);
$result=$comment->fetchAllFor($this->element, $this->id); $result=$comment->fetchAllFor($this->element, $this->id);
if ($result<0) { if ($result<0) {
$this->errors=array_merge($this->errors,$comment->errors); $this->errors=array_merge($this->errors, $comment->errors);
return -1; return -1;
} else { } else {
$this->comments = $comment->comments; $this->comments = $comment->comments;
@ -7341,4 +7341,20 @@ abstract class CommonObject
{ {
return count($this->comments); return count($this->comments);
} }
/**
* Trim object parameters
* @param string[] $parameters array of parameters to trim
*
* @return void
*/
public function trimParameters($parameters)
{
if (!is_array($parameters)) return;
foreach ($parameters as $parameter) {
if (isset($this->$parameter)) {
$this->$parameter = trim($this->$parameter);
}
}
}
} }

View File

@ -1149,8 +1149,8 @@ class FormOther
if ($nbboxactivated) if ($nbboxactivated)
{ {
$langs->load("boxes"); // Load translation files required by the page
$langs->load("projects"); $langs->loadLangs(array("boxes","projects"));
$emptybox=new ModeleBoxes($db); $emptybox=new ModeleBoxes($db);

View File

@ -101,9 +101,8 @@ class FormSms
if (! is_object($form)) $form=new Form($this->db); if (! is_object($form)) $form=new Form($this->db);
$langs->load("other"); // Load translation files required by the page
$langs->load("mails"); $langs->loadLangs(array('other', 'mails', 'sms'));
$langs->load("sms");
$soc=new Societe($this->db); $soc=new Societe($this->db);
if (!empty($this->withtosocid) && $this->withtosocid > 0) if (!empty($this->withtosocid) && $this->withtosocid > 0)

View File

@ -66,18 +66,19 @@ else
} }
// Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8) // Define tradMonths javascript array (we define this in datapicker AND in parent page to avoid errors with IE8)
$tradTemp=array($langs->trans("January"), $tradTemp=array(
$langs->trans("February"), $langs->trans("January"),
$langs->trans("March"), $langs->trans("February"),
$langs->trans("April"), $langs->trans("March"),
$langs->trans("May"), $langs->trans("April"),
$langs->trans("June"), $langs->trans("May"),
$langs->trans("July"), $langs->trans("June"),
$langs->trans("August"), $langs->trans("July"),
$langs->trans("September"), $langs->trans("August"),
$langs->trans("October"), $langs->trans("September"),
$langs->trans("November"), $langs->trans("October"),
$langs->trans("December") $langs->trans("November"),
$langs->trans("December")
); );
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print 'var tradMonths = ['; print 'var tradMonths = [';
@ -96,25 +97,22 @@ $qualified=true;
if (! isset($_GET["sd"])) $_GET["sd"]="00000000"; if (! isset($_GET["sd"])) $_GET["sd"]="00000000";
if (! isset($_GET["m"])) $qualified=false; if (! isset($_GET["m"]) || ! isset($_GET["y"])) $qualified=false;
if (! isset($_GET["y"])) $qualified=false;
if (isset($_GET["m"]) && isset($_GET["y"])) if (isset($_GET["m"]) && isset($_GET["y"]))
{ {
if ($_GET["m"] < 1) $qualified=false; if ($_GET["m"] < 1 || $_GET["m"] > 12) $qualified=false;
if ($_GET["m"] > 12) $qualified=false; if ($_GET["y"] < 0 || $_GET["y"] > 9999) $qualified=false;
if ($_GET["y"] < 0) $qualified=false;
if ($_GET["y"] > 9999) $qualified=false;
} }
// If parameters provided, we show calendar // If parameters provided, we show calendar
if ($qualified) if ($qualified)
{ {
//print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit; //print $_GET["cm"].",".$_GET["sd"].",".$_GET["m"].",".$_GET["y"];exit;
displayBox(GETPOST("sd",'alpha'),GETPOST("m",'int'),GETPOST("y",'int')); displayBox(GETPOST("sd",'alpha'), GETPOST("m",'int'), GETPOST("y",'int'));
} }
else else
{ {
dol_print_error('','ErrorBadParameters'); dol_print_error('', 'ErrorBadParameters');
} }
@ -195,9 +193,7 @@ function displayBox($selectedDate,$month,$year)
{ {
echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n"; echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n";
} }
?> print '</tr>';
</tr>
<?php
//print "x ".$thedate." y"; // $thedate = first day of month //print "x ".$thedate." y"; // $thedate = first day of month
$firstdate=dol_getdate($thedate); $firstdate=dol_getdate($thedate);
//var_dump($firstdateofweek); //var_dump($firstdateofweek);
@ -210,7 +206,7 @@ function displayBox($selectedDate,$month,$year)
//print_r($mydate); //print_r($mydate);
if ($mydate < $firstdate) // At first run if ($mydate < $firstdate) // At first run
{ {
echo "<TR class=\"dpWeek\">"; echo "<tr class=\"dpWeek\">";
//echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday; //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday;
$cols=0; $cols=0;
for ($i = 0; $i < 7; $i++) for ($i = 0; $i < 7; $i++)
@ -221,7 +217,7 @@ function displayBox($selectedDate,$month,$year)
$mydate = $firstdate; $mydate = $firstdate;
break; break;
} }
echo "<TD>&nbsp;</TD>"; echo "<td>&nbsp;</td>";
$cols++; $cols++;
} }
} }
@ -229,7 +225,7 @@ function displayBox($selectedDate,$month,$year)
{ {
if ($mydate["wday"] == $startday) if ($mydate["wday"] == $startday)
{ {
echo "<TR class=\"dpWeek\">"; echo "<tr class=\"dpWeek\">";
$cols=0; $cols=0;
} }
} }
@ -245,17 +241,17 @@ function displayBox($selectedDate,$month,$year)
} }
// Sur click dans calendrier, appelle fonction dpClickDay // Sur click dans calendrier, appelle fonction dpClickDay
echo "<TD class=\"".$dayclass."\""; echo "<td class=\"".$dayclass."\"";
echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\""; echo " onMouseOver=\"dpHighlightDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",tradMonths)\"";
echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\""; echo " onClick=\"dpClickDay(".$mydate["year"].",parseInt('".dol_print_date($thedate,"%m")."',10),".$mydate["mday"].",'".$langs->trans("FormatDateShortJavaInput")."')\"";
echo ">".sprintf("%02s",$mydate["mday"])."</TD>"; echo ">".sprintf("%02s",$mydate["mday"])."</td>";
$cols++; $cols++;
if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n"; if (($mydate["wday"] + 1) % 7 == $startday) echo "</TR>\n";
//$thedate=strtotime("tomorrow",$thedate); //$thedate=strtotime("tomorrow",$thedate);
$day++; $day++;
$thedate=dol_mktime(12,0,0,$month,$day,$year); $thedate=dol_mktime(12, 0, 0, $month, $day, $year);
if ($thedate == '') if ($thedate == '')
{ {
$stoploop=1; $stoploop=1;
@ -269,8 +265,8 @@ function displayBox($selectedDate,$month,$year)
if ($cols < 7) if ($cols < 7)
{ {
for($i=6; $i>=$cols; $i--) echo "<TD>&nbsp;</TD>"; for($i=6; $i>=$cols; $i--) echo "<td>&nbsp;</td>";
echo "</TR>\n"; echo "</tr>\n";
} }
?> ?>
<tr> <tr>

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr> * Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com> * Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
@ -1244,12 +1244,12 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
print "</tr>\n"; print "</tr>\n";
} }
} }
else //else
{ //{
//print '<tr class="oddeven">'; //print '<tr class="oddeven">';
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>'; //print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
//print "</tr>\n"; //print "</tr>\n";
} //}
print "\n</table>\n"; print "\n</table>\n";
print "<br>\n"; print "<br>\n";
@ -1323,30 +1323,30 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; $sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; $sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname"; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m"; elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o"; elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
if (is_object($filterobj) && get_class($filterobj) == 'Adherent') elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{ {
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
} }
if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
{ {
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
} }
if (is_object($filterobj) && get_class($filterobj) == 'Product') elseif (is_object($filterobj) && get_class($filterobj) == 'Product')
{ {
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
@ -1362,7 +1362,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
else else
{ {
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'"; if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'"; elseif ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
} }
} }
else else
@ -1373,7 +1373,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
} }
} }
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']); if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
$sql.= $db->order($sortfield, $sortorder); $sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG); dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
@ -1388,7 +1388,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; //elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone=''; $tododone='';
if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone='todo'; if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) $tododone='todo';

View File

@ -98,8 +98,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
{ {
global $conf,$langs; global $conf,$langs;
$langs->load("companies"); // Load translation files required by the page
$langs->load("errors"); $langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db); $form = new Form($this->db);

View File

@ -95,10 +95,10 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
*/ */
function info($langs) function info($langs)
{ {
global $conf,$langs; global $conf, $langs;
$langs->load("companies"); // Load translation files required by the page
$langs->load("errors"); $langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db); $form = new Form($this->db);

View File

@ -93,10 +93,10 @@ class doc_generic_user_odt extends ModelePDFUser
*/ */
function info($langs) function info($langs)
{ {
global $conf,$langs; global $conf, $langs;
$langs->load("companies"); // Load translation files required by the page
$langs->load("errors"); $langs->loadLangs(array('companies', 'errors'));
$form = new Form($this->db); $form = new Form($this->db);

View File

@ -37,10 +37,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
*/ */
class doc_generic_usergroup_odt extends ModelePDFUserGroup class doc_generic_usergroup_odt extends ModelePDFUserGroup
{ {
var $emetteur; // Objet societe qui emet public $emetteur; // Objet societe qui emet
var $phpmin = array(5,2,0); // Minimum version of PHP required by module public $phpmin = array(5,4,0); // Minimum version of PHP required by module
var $version = 'dolibarr'; public $version = 'dolibarr';
/** /**
@ -50,10 +50,10 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
*/ */
function __construct($db) function __construct($db)
{ {
global $conf,$langs,$mysoc; global $conf, $langs, $mysoc;
$langs->load("main"); // Load translation files required by the page
$langs->load("companies"); $langs->loadLangs(array('companies', 'main'));
$this->db = $db; $this->db = $db;
$this->name = "ODT templates"; $this->name = "ODT templates";

View File

@ -46,11 +46,8 @@ if (! empty($conf->contrat->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php';
} }
// Load translation files required by the page
$langs->load('bills'); $langs->loadLangs(array("interventions","admin","compta","bills"));
$langs->load('compta');
$langs->load('admin');
$langs->load("interventions");
// Security check // Security check
$id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int')); $id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int'));

View File

@ -49,10 +49,8 @@ $endyear=$year;
$object_status=GETPOST('object_status'); $object_status=GETPOST('object_status');
$langs->load('interventions'); // Load translation files required by the page
$langs->load('companies'); $langs->loadLangs(array("interventions","suppliers","companies","other"));
$langs->load('other');
$langs->load('suppliers');
/* /*

View File

@ -34,8 +34,8 @@ $idprod=GETPOST('idprod','int');
$prices = array(); $prices = array();
$langs->load('stocks'); // Load translation files required by the page
$langs->load('margins'); $langs->loadLangs(array("stocks","margins"));
/* /*

View File

@ -33,10 +33,8 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
} }
$langs->load("facture"); // Load translation files required by the page
$langs->load("orders"); $langs->loadLangs(array("facture","orders","sendings","companies"));
$langs->load("sendings");
$langs->load("companies");
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');

View File

@ -5,9 +5,9 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr> * Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,13 +40,9 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$langs->load('orders'); // Load translation files required by the page
$langs->load('sendings'); $langs->loadLangs(array("bills", "orders", "sendings", "companies", "deliveries", "products", "stocks"));
$langs->load('companies');
$langs->load('bills');
$langs->load('deliveries');
$langs->load('products');
$langs->load('stocks');
if (! empty($conf->productbatch->enabled)) if (! empty($conf->productbatch->enabled))
$langs->load('productbatch'); $langs->load('productbatch');

View File

@ -38,14 +38,8 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
} }
$langs->load('orders'); // Load translation files required by the page
$langs->load('other'); $langs->loadLangs(array("bills", "orders", "sendings", "companies", "deliveries", "products", "stocks","other"));
$langs->load('sendings');
$langs->load('companies');
$langs->load('bills');
$langs->load('deliveries');
$langs->load('products');
$langs->load('stocks');
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');

View File

@ -34,8 +34,8 @@ $orderid = GETPOST('orderid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande'); $result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande');
$langs->load("suppliers"); // Load translation files required by the page
$langs->load("orders"); $langs->loadLangs(array("suppliers", "orders"));
/* /*

View File

@ -33,10 +33,8 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
} }
$langs->load("orders"); // Load translation files required by the page
$langs->load("suppliers"); $langs->loadLangs(array("suppliers", "orders", "companies", "stocks"));
$langs->load("companies");
$langs->load('stocks');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -32,10 +32,8 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
} }
$langs->load("orders"); // Load translation files required by the page
$langs->load("suppliers"); $langs->loadLangs(array("suppliers", "orders", "companies", "stocks"));
$langs->load("companies");
$langs->load('stocks');
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'); $id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
$ref = GETPOST('ref'); $ref = GETPOST('ref');

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
@ -8,7 +8,7 @@
* Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -41,9 +41,8 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
} }
$langs->load('orders'); // Load translation files required by the page
$langs->load('deliveries'); $langs->loadLangs(array("orders", "companies", "deliveries"));
$langs->load('companies');
if (! $user->rights->fournisseur->facture->creer) if (! $user->rights->fournisseur->facture->creer)
accessforbidden(); accessforbidden();
@ -105,9 +104,9 @@ if (($action == 'create' || $action == 'add') && ! $error) {
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$langs->load('bills'); // Load translation files required by the page
$langs->load('products'); $langs->loadLangs(array("bills", "main", "products"));
$langs->load('main');
if (isset($_GET['orders_to_invoice'])) { if (isset($_GET['orders_to_invoice'])) {
$orders_id = GETPOST('orders_to_invoice','',1); $orders_id = GETPOST('orders_to_invoice','',1);
$n = count($orders_id); $n = count($orders_id);

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -310,22 +311,22 @@ class Establishment extends CommonObject
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$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]),'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]);
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5'); 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]),'statut4'); elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
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==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]),'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]);
} }
elseif ($mode == 5) elseif ($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]),'statut5'); 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]),'statut4'); elseif ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4');
} }
} }
@ -351,7 +352,7 @@ class Establishment extends CommonObject
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
if ($obj->fk_user_author) if ($obj->fk_user_author)
{ {
$cuser = new User($this->db); $cuser = new User($this->db);

View File

@ -937,7 +937,7 @@ else
define('ROWS_9',8); define('ROWS_9',8);
} }
$heightforframes=48; $heightforframes=50;
// Init menu manager // Init menu manager
if (! defined('NOREQUIREMENU')) if (! defined('NOREQUIREMENU'))

View File

@ -3,7 +3,7 @@
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -126,7 +126,7 @@ class ProductStockEntrepot extends CommonObject
if (!$error) { if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) { //if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger. // want this action to call a trigger.
@ -134,7 +134,7 @@ class ProductStockEntrepot extends CommonObject
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); //$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++; //if ($result < 0) $error++;
//// End call triggers //// End call triggers
} //}
} }
// Commit or rollback // Commit or rollback
@ -340,7 +340,7 @@ class ProductStockEntrepot extends CommonObject
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
} }
if (!$error && !$notrigger) { //if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
@ -348,7 +348,7 @@ class ProductStockEntrepot extends CommonObject
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers //// End call triggers
} //}
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
@ -378,8 +378,7 @@ class ProductStockEntrepot extends CommonObject
$this->db->begin(); $this->db->begin();
if (!$error) { //if (!$error && !$notrigger) {
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
@ -387,8 +386,7 @@ class ProductStockEntrepot extends CommonObject
//$result=$this->call_trigger('MYOBJECT_DELETE',$user); //$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers //// End call triggers
} //}
}
if (!$error) { if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
@ -526,34 +524,33 @@ class ProductStockEntrepot extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
$prefix='';
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($status == 1) return $langs->trans('Enabled'); if ($status == 1) return $langs->trans('Enabled');
if ($status == 0) return $langs->trans('Disabled'); elseif ($status == 0) return $langs->trans('Disabled');
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
} }
} }

View File

@ -529,7 +529,7 @@ class Societe extends CommonObject
$this->add_commercial($user, $this->commercial_id); $this->add_commercial($user, $this->commercial_id);
} }
// si un commercial cree un client il lui est affecte automatiquement // si un commercial cree un client il lui est affecte automatiquement
else if (empty($user->rights->societe->client->voir)) elseif (empty($user->rights->societe->client->voir))
{ {
$this->add_commercial($user, $user->id); $this->add_commercial($user, $user->id);
} }
@ -652,15 +652,15 @@ class Societe extends CommonObject
{ {
$this->errors[] = 'ErrorBadCustomerCodeSyntax'; $this->errors[] = 'ErrorBadCustomerCodeSyntax';
} }
if ($rescode == -2) elseif ($rescode == -2)
{ {
$this->errors[] = 'ErrorCustomerCodeRequired'; $this->errors[] = 'ErrorCustomerCodeRequired';
} }
if ($rescode == -3) elseif ($rescode == -3)
{ {
$this->errors[] = 'ErrorCustomerCodeAlreadyUsed'; $this->errors[] = 'ErrorCustomerCodeAlreadyUsed';
} }
if ($rescode == -4) elseif ($rescode == -4)
{ {
$this->errors[] = 'ErrorPrefixRequired'; $this->errors[] = 'ErrorPrefixRequired';
} }
@ -677,15 +677,15 @@ class Societe extends CommonObject
{ {
$this->errors[] = 'ErrorBadSupplierCodeSyntax'; $this->errors[] = 'ErrorBadSupplierCodeSyntax';
} }
if ($rescode == -2) elseif ($rescode == -2)
{ {
$this->errors[] = 'ErrorSupplierCodeRequired'; $this->errors[] = 'ErrorSupplierCodeRequired';
} }
if ($rescode == -3) elseif ($rescode == -3)
{ {
$this->errors[] = 'ErrorSupplierCodeAlreadyUsed'; $this->errors[] = 'ErrorSupplierCodeAlreadyUsed';
} }
if ($rescode == -5) elseif ($rescode == -5)
{ {
$this->errors[] = 'ErrorprefixRequired'; $this->errors[] = 'ErrorprefixRequired';
} }
@ -1064,7 +1064,7 @@ class Societe extends CommonObject
$error++; $error++;
} }
} }
else if ($result < 0) elseif ($result < 0)
{ {
$this->error=$lmember->error; $this->error=$lmember->error;
$error++; $error++;
@ -1960,37 +1960,37 @@ class Societe extends CommonObject
$label.= '<u>' . $langs->trans("ShowCustomer") . '</u>'; $label.= '<u>' . $langs->trans("ShowCustomer") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
} }
else if ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) elseif ($option == 'prospect' && empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{ {
$label.= '<u>' . $langs->trans("ShowProspect") . '</u>'; $label.= '<u>' . $langs->trans("ShowProspect") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$this->id;
} }
else if ($option == 'supplier') elseif ($option == 'supplier')
{ {
$label.= '<u>' . $langs->trans("ShowSupplier") . '</u>'; $label.= '<u>' . $langs->trans("ShowSupplier") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id;
} }
else if ($option == 'agenda') elseif ($option == 'agenda')
{ {
$label.= '<u>' . $langs->trans("ShowAgenda") . '</u>'; $label.= '<u>' . $langs->trans("ShowAgenda") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/agenda.php?socid='.$this->id;
} }
else if ($option == 'project') elseif ($option == 'project')
{ {
$label.= '<u>' . $langs->trans("ShowProject") . '</u>'; $label.= '<u>' . $langs->trans("ShowProject") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/project.php?socid='.$this->id;
} }
else if ($option == 'margin') elseif ($option == 'margin')
{ {
$label.= '<u>' . $langs->trans("ShowMargin") . '</u>'; $label.= '<u>' . $langs->trans("ShowMargin") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1'; $linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
} }
else if ($option == 'contact') elseif ($option == 'contact')
{ {
$label.= '<u>' . $langs->trans("ShowContacts") . '</u>'; $label.= '<u>' . $langs->trans("ShowContacts") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/contact.php?socid='.$this->id;
} }
else if ($option == 'ban') elseif ($option == 'ban')
{ {
$label.= '<u>' . $langs->trans("ShowBan") . '</u>'; $label.= '<u>' . $langs->trans("ShowBan") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$this->id; $linkstart = '<a href="'.DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$this->id;
@ -2103,37 +2103,37 @@ class Societe extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
if ($statut==0) return $langs->trans("ActivityCeased"); if ($statut==0) return $langs->trans("ActivityCeased");
if ($statut==1) return $langs->trans("InActivity"); elseif ($statut==1) return $langs->trans("InActivity");
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($statut==0) return $langs->trans("ActivityCeased"); if ($statut==0) return $langs->trans("ActivityCeased");
if ($statut==1) return $langs->trans("InActivity"); elseif ($statut==1) return $langs->trans("InActivity");
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); elseif ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); elseif ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased");
if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); elseif ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity");
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans("ActivityCeased").'</span> '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans("ActivityCeased").'</span> '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans("InActivity").'</span> '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); elseif ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans("InActivity").'</span> '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
} }
if ($mode == 6) elseif ($mode == 6)
{ {
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans("ActivityCeased").'</span> '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans("ActivityCeased").'</span> '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"');
if ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans("InActivity").'</span> '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); elseif ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans("InActivity").'</span> '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"');
} }
} }

View File

@ -79,24 +79,24 @@ $stripeacc = $stripe->getStripeAccount($service);
if (!$rowid) if (!$rowid)
{ {
print '<FORM method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<INPUT type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<INPUT type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<INPUT type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<INPUT type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
print '<INPUT type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<INPUT type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<INPUT type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$title=$langs->trans("StripeChargeList"); $title=$langs->trans("StripeChargeList");
$title.=($stripeacc?' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)'); $title.=($stripeacc?' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
print '<DIV class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<TABLE class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<TR class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
@ -105,9 +105,9 @@ if (!$rowid)
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"","","",'align="left"',$sortfield,$sortorder); print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Paid",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre("Paid",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"'); print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"');
print "</TR>\n"; print "</tr>\n";
print "</TR>\n"; print "</tr>\n";
if ($stripeacc) if ($stripeacc)
{ {
@ -148,7 +148,7 @@ if (!$rowid)
$memberstatic->id = 0; $memberstatic->id = 0;
} }
print '<TR class="oddeven">'; print '<tr class="oddeven">';
if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/';
@ -158,9 +158,9 @@ if (!$rowid)
{ {
$url='https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; $url='https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
} }
print "<TD><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."</a></TD>\n"; print "<td><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."</a></td>\n";
// Stripe customer // Stripe customer
print "<TD>"; print "<td>";
if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/'; if (! empty($conf->stripe->enabled) && !empty($stripeacc)) $connect=$stripeacc.'/';
$url='https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer; $url='https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;
@ -168,11 +168,11 @@ if (!$rowid)
{ {
$url='https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; $url='https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer;
} }
print ' <a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'object_globe').' '.$charge->customer.'</a>'; print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'object_globe').' '.$charge->customer.'</a>';
print "</TD>\n"; print "</td>\n";
// Link // Link
print "<TD>"; print "<td>";
if ($societestatic->id > 0) if ($societestatic->id > 0)
{ {
print $societestatic->getNomUrl(1); print $societestatic->getNomUrl(1);
@ -181,27 +181,27 @@ if (!$rowid)
{ {
print $memberstatic->getNomUrl(1); print $memberstatic->getNomUrl(1);
} }
print "</TD>\n"; print "</td>\n";
// Origine // Origine
print "<TD>"; print "<td>";
if ($charge->metadata->dol_type=="order"){ if ($charge->metadata->dol_type=="order"){
$object = new Commande($db); $object = new Commande($db);
$object->fetch($charge->metadata->dol_id); $object->fetch($charge->metadata->dol_id);
if ($object->id > 0) { if ($object->id > 0) {
print "<A href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'object_order')." ".$object->ref."</A>"; print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'object_order')." ".$object->ref."</a>";
} else print $FULLTAG; } else print $FULLTAG;
} elseif ($charge->metadata->dol_type=="invoice"){ } elseif ($charge->metadata->dol_type=="invoice"){
$object = new Facture($db); $object = new Facture($db);
$object->fetch($charge->metadata->dol_id); $object->fetch($charge->metadata->dol_id);
if ($object->id > 0) { if ($object->id > 0) {
print "<A href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</A>"; print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</a>";
} else print $FULLTAG; } else print $FULLTAG;
} else print $FULLTAG; } else print $FULLTAG;
print "</TD>\n"; print "</td>\n";
// Date payment // Date payment
print '<TD align="center">'.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."</TD>\n"; print '<td align="center">'.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."</td>\n";
// Type // Type
print '<TD>'; print '<td>';
if ($charge->source->object=='card') if ($charge->source->object=='card')
{ {
print $langs->trans("card"); print $langs->trans("card");
@ -211,11 +211,11 @@ if (!$rowid)
} elseif ($charge->source->type=='three_d_secure'){ } elseif ($charge->source->type=='three_d_secure'){
print $langs->trans("card3DS"); print $langs->trans("card3DS");
} }
print '</TD>'; print '</td>';
// Amount // Amount
print "<TD align=\"right\">".price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</TD>"; print "<td align=\"right\">".price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</td>";
// Status // Status
print '<TD align="right">'; print '<td align="right">';
if ($charge->refunded=='1'){ if ($charge->refunded=='1'){
print img_picto($langs->trans("refunded"),'statut6'); print img_picto($langs->trans("refunded"),'statut6');
} elseif ($charge->paid=='1'){ } elseif ($charge->paid=='1'){
@ -228,9 +228,9 @@ if (!$rowid)
$label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""),'statut8'),$label,1); print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""),'statut8'),$label,1);
} }
print "</TD>\n"; print "</td>\n";
print "</TR>\n"; print "</tr>\n";
} }
} else { } else {

View File

@ -808,20 +808,24 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$i = 0; $i = 0;
//print '<tr><td colspan="3">'; //print '<tr><td colspan="3">';
print '<br>'; print '<br>';
print_barre_liste($langs->trans('StripeInvoiceList').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); print_barre_liste($langs->trans('StripeInvoiceList').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$arraytitle.'</td>'; print '<td>'.$arraytitle.'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td align="center">'.$langs->trans('Date').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td>'.$langs->trans('Currency').'</td>'; if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>'; print '<td>'.$langs->trans('Currency').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>'; print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>'; print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>';
print '<td align="right">'.$multicurrencyremaindertopay.'</td>';
}
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$alreadypayedlabel.'</td>'; print '<td align="right">'.$alreadypayedlabel.'</td>';
print '<td align="right">'.$remaindertopay.'</td>'; print '<td align="right">'.$remaindertopay.'</td>';
print '<td align="right">'.$langs->trans('PaymentAmount').'</td>'; print '<td align="right">'.$langs->trans('PaymentAmount').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>'; if (!empty($conf->multicurrency->enabled)) {
print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
}
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -980,17 +984,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Print total // Print total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>'; print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
print '<td></td>';
}
print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>'; print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>';
print '<td align="right"><b>'.price($sign * $totalrecu); print '<td align="right"><b>'.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
if ($totalrecudeposits) print '+'.price($totalrecudeposits); if ($totalrecudeposits) print '+'.price($totalrecudeposits);
print '</b></td>'; print '</b></td>';
print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>'; print '<td align="right"><b>'.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
print '<td align="right" id="result" style="font-weight: bold;"></td>'; print '<td align="right" id="result" style="font-weight: bold;"></td>';
if (!empty($conf->multicurrency->enabled)) {print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';} if (!empty($conf->multicurrency->enabled)) {
print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
}
print "</tr>\n"; print "</tr>\n";
} }
print "</table>"; print "</table>";

View File

@ -2169,9 +2169,7 @@ class User extends CommonObject
*/ */
function getPhotoUrl($width, $height, $cssclass='', $imagesize='') function getPhotoUrl($width, $height, $cssclass='', $imagesize='')
{ {
$result=''; $result ='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
$result.='<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';
$result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize); $result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
$result.='</a>'; $result.='</a>';
@ -2199,7 +2197,7 @@ class User extends CommonObject
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager; global $menumanager;
if(!$user->rights->user->user->lire && $user->id !=$this->id) $option='nolink'; if(!$user->rights->user->user->lire && $user->id !=$this->id) $option='nolink';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
@ -2348,7 +2346,7 @@ class User extends CommonObject
$linkend='</a>'; $linkend='</a>';
} }
if ($option == 'nolink') if ($option == 'nolink')
{ {
$linkstart = ''; $linkstart = '';
$linkend=''; $linkend='';
@ -2388,34 +2386,33 @@ class User extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
$prefix='';
if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled'); elseif ($statut == 0) return $langs->trans('Disabled');
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled'); elseif ($statut == 0) return $langs->trans('Disabled');
} }
if ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled');
} }
if ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"');
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"');
} }
if ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled');
} }
if ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"');
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"');
} }
} }
@ -2436,8 +2433,8 @@ class User extends CommonObject
global $conf; global $conf;
$dn=''; $dn='';
if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN; if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN;
if ($mode==1) $dn=$conf->global->LDAP_USER_DN; elseif ($mode==1) $dn=$conf->global->LDAP_USER_DN;
if ($mode==2) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS]; elseif ($mode==2) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS];
return $dn; return $dn;
} }
@ -2511,7 +2508,7 @@ class User extends CommonObject
if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption)
} }
// Set LDAP password if possible // Set LDAP password if possible
else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
{ {
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
{ {
@ -2524,7 +2521,7 @@ class User extends CommonObject
} }
} }
// Use $this->pass_indatabase value if exists // Use $this->pass_indatabase value if exists
else if (! empty($this->pass_indatabase)) elseif (! empty($this->pass_indatabase))
{ {
if (! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte if (! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption
@ -3020,7 +3017,7 @@ class User extends CommonObject
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'user' 'user',
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
@ -3077,7 +3074,7 @@ class User extends CommonObject
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
{ {
global $conf,$user,$langs; global $conf, $user, $langs;
$langs->load("user"); $langs->load("user");