Prepare removal of libelle and lib into label

This commit is contained in:
Laurent Destailleur 2021-01-31 13:07:41 +01:00
parent b349290cd1
commit dad6778570
4 changed files with 26 additions and 14 deletions

View File

@ -46,9 +46,15 @@ class Cchargesociales
/**
* @var string Label
* @deprecated
*/
public $libelle;
/**
* @var string Label
*/
public $label;
public $deductible;
public $active;
public $code;
@ -107,7 +113,6 @@ class Cchargesociales
// Insert request
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
$sql .= 'libelle,';
$sql .= 'deductible,';
$sql .= 'active,';
@ -115,10 +120,7 @@ class Cchargesociales
$sql .= 'fk_pays,';
$sql .= 'module';
$sql .= 'accountancy_code';
$sql .= ') VALUES (';
$sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").',';
$sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).',';
$sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).',';
@ -126,8 +128,6 @@ class Cchargesociales
$sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).',';
$sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").',';
$sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'");
$sql .= ')';
$this->db->begin();
@ -179,7 +179,7 @@ class Cchargesociales
$sql = 'SELECT';
$sql .= " t.id,";
$sql .= " t.libelle,";
$sql .= " t.libelle as label,";
$sql .= " t.deductible,";
$sql .= " t.active,";
$sql .= " t.code,";
@ -201,7 +201,8 @@ class Cchargesociales
$this->id = $obj->id;
$this->libelle = $obj->libelle;
$this->libelle = $obj->label;
$this->label = $obj->label;
$this->deductible = $obj->deductible;
$this->active = $obj->active;
$this->code = $obj->code;
@ -501,6 +502,7 @@ class Cchargesociales
$this->id = 0;
$this->libelle = '';
$this->label = '';
$this->deductible = '';
$this->active = '';
$this->code = '';

View File

@ -108,6 +108,11 @@ class ChargeSociales extends CommonObject
*/
public $fk_project;
/**
* @var int ID
*/
public $fk_user;
const STATUS_UNPAID = 0;
const STATUS_PAID = 1;
@ -135,7 +140,7 @@ class ChargeSociales extends CommonObject
$sql = "SELECT cs.rowid, cs.date_ech";
$sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
$sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user";
$sql .= ", c.libelle";
$sql .= ", c.libelle as type_label";
$sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
@ -158,7 +163,7 @@ class ChargeSociales extends CommonObject
$this->lib = $obj->label;
$this->label = $obj->label;
$this->type = $obj->fk_type;
$this->type_label = $obj->libelle;
$this->type_label = $obj->type_label;
$this->fk_account = $obj->fk_account;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code;

View File

@ -46,6 +46,11 @@ class PaymentSocialContribution extends CommonObject
*/
public $picto = 'payment';
/**
* @var string Label
*/
public $label;
/**
* @var int ID
*/
@ -679,7 +684,7 @@ class PaymentSocialContribution extends CommonObject
$result = '';
if (empty($this->ref)) $this->ref = $this->lib;
if (empty($this->ref)) $this->ref = $this->label;
$label = img_picto('', $this->picto).' <u>'.$langs->trans("SocialContributionPayment").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;

View File

@ -149,7 +149,7 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("SocialContributions"));
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user, ";
$sql .= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,";
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " c.libelle as type_label,";
$sql .= " SUM(pc.amount) as alreadypayed";
@ -381,7 +381,7 @@ while ($i < min($num, $limit))
$chargesociale_static->id = $obj->rowid;
$chargesociale_static->ref = $obj->rowid;
$chargesociale_static->label = $obj->libelle;
$chargesociale_static->label = $obj->label;
$chargesociale_static->type_label = $obj->type_label;
if (!empty($conf->projet->enabled)) {
$projectstatic->id = $obj->project_id;
@ -405,7 +405,7 @@ while ($i < min($num, $limit))
// Label
if (!empty($arrayfields['cs.libelle']['checked'])) {
print '<td>'.dol_trunc($obj->libelle, 42).'</td>';
print '<td>'.dol_trunc($obj->label, 42).'</td>';
if (!$i) $totalarray['nbfield']++;
}