Standardize and update code

This commit is contained in:
Philippe GRAND 2018-09-02 11:08:41 +02:00
parent c4f05aff28
commit 3de16a145e
16 changed files with 226 additions and 126 deletions

View File

@ -55,6 +55,9 @@ class Propal extends CommonObject
*/
public $table_element='propal';
/**
* @var int Name of subtable line
*/
public $table_element_line='propaldet';
/**

View File

@ -52,7 +52,11 @@ class Commande extends CommonOrder
*/
public $table_element='commande';
/**
* @var int Name of subtable line
*/
public $table_element_line = 'commandedet';
public $class_element_line = 'OrderLine';
/**
@ -61,11 +65,13 @@ class Commande extends CommonOrder
public $fk_element = 'fk_commande';
public $picto = 'order';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
*/
public $ismultientitymanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
@ -92,6 +98,7 @@ class Commande extends CommonOrder
* @var int
*/
public $statut;
/**
* Billed
* @var int
@ -114,21 +121,25 @@ class Commande extends CommonOrder
* @var int
*/
public $mode_reglement_id;
/**
* Payment mode code
* @var string
*/
public $mode_reglement_code;
/**
* Availability delivery time id
* @var int
*/
public $availability_id;
/**
* Availability delivery time code
* @var string
*/
public $availability_code;
/**
* Label of availability delivery time. Use it in case translation cannot be found.
* @var string
@ -138,11 +149,13 @@ class Commande extends CommonOrder
public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...)
public $demand_reason_code;
public $date; // Date commande
/**
* @deprecated
* @see date
*/
public $date_commande;
public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
public $fk_remise_except;
public $remise_percent;

View File

@ -41,6 +41,9 @@ class Deplacement extends CommonObject
*/
public $table_element='deplacement';
/**
* @var int Name of subtable line
*/
public $table_element_line = '';
/**
@ -50,22 +53,22 @@ class Deplacement extends CommonObject
public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $datec; // Creation date
var $dated;
var $fk_user_author;
public $datec; // Creation date
public $dated;
public $fk_user_author;
/**
* @var int User ID
*/
public $fk_user;
var $km;
var $socid;
var $statut; // 0=draft, 1=validated
var $extraparams=array();
public $km;
public $socid;
public $statut; // 0=draft, 1=validated
public $extraparams=array();
var $statuts=array();
var $statuts_short=array();
public $statuts=array();
public $statuts_short=array();
/**
* Constructor

View File

@ -49,6 +49,9 @@ class FactureRec extends CommonInvoice
*/
public $table_element='facture_rec';
/**
* @var int Name of subtable line
*/
public $table_element_line='facturedet_rec';
/**
@ -58,30 +61,30 @@ class FactureRec extends CommonInvoice
public $picto='bill';
var $entity;
var $number;
var $date;
var $amount;
var $remise;
var $tva;
var $total;
var $db_table;
var $propalid;
public $entity;
public $number;
public $date;
public $amount;
public $remise;
public $tva;
public $total;
public $db_table;
public $propalid;
var $date_last_gen;
var $date_when;
var $nb_gen_done;
var $nb_gen_max;
public $date_last_gen;
public $date_when;
public $nb_gen_done;
public $nb_gen_max;
var $frequency;
var $unit_frequency;
public $frequency;
public $unit_frequency;
var $rang;
var $special_code;
public $rang;
public $special_code;
var $usenewprice=0;
public $usenewprice=0;
var $suspended; // status
public $suspended; // status
const STATUS_NOTSUSPENDED = 0;
const STATUS_SUSPENDED = 1;

View File

@ -63,6 +63,9 @@ class Facture extends CommonInvoice
*/
public $table_element='facture';
/**
* @var int Name of subtable line
*/
public $table_element_line = 'facturedet';
/**
@ -71,11 +74,13 @@ class Facture extends CommonInvoice
public $fk_element = 'fk_facture';
public $picto='bill';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
*/
public $ismultientitymanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
@ -125,14 +130,17 @@ class Facture extends CommonInvoice
public $cond_reglement_code; // Code in llx_c_paiement
public $mode_reglement_code; // Code in llx_c_paiement
public $fk_bank; // Field to store bank id to use when payment mode is withdraw
/**
* @deprecated
*/
public $products=array();
/**
* @var FactureLigne[]
*/
public $lines=array();
public $line;
public $extraparams=array();
public $specimen;

View File

@ -51,6 +51,9 @@ class Contrat extends CommonObject
*/
public $table_element='contrat';
/**
* @var int Name of subtable line
*/
public $table_element_line='contratdet';
/**

View File

@ -73,9 +73,9 @@ abstract class CommonObject
public $table_element;
/**
* @var
* @var int Name of subtable line
*/
public $table_element_line;
public $table_element_line='';
/**
* @var string Key value used to track if data is coming from import wizard
@ -168,6 +168,7 @@ abstract class CommonObject
* @see fetch_origin()
*/
public $origin;
/**
* @var int The id of originating object
* @see fetch_origin()
@ -6175,7 +6176,7 @@ abstract class CommonObject
{
//Show only the key field in params
if (is_array($params) && array_key_exists('onlykey',$params) && $key != $params['onlykey']) continue;
$enabled = 1;
if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key]))
{

View File

@ -38,6 +38,9 @@ class Fiscalyear extends CommonObject
*/
public $table_element='accounting_fiscalyear';
/**
* @var int Name of subtable line
*/
public $table_element_line = '';
/**

View File

@ -48,61 +48,69 @@ class Expedition extends CommonObject
* @var string ID to identify managed object
*/
public $element="shipping";
public $fk_element="fk_expedition";
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element="expedition";
/**
* @var int Name of subtable line
*/
public $table_element_line="expeditiondet";
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'sending';
var $socid;
var $ref_customer;
var $ref_int;
var $brouillon;
var $entrepot_id;
var $lines=array();
var $tracking_number;
var $tracking_url;
var $billed;
var $model_pdf;
public $socid;
public $ref_customer;
public $ref_int;
public $brouillon;
public $entrepot_id;
public $lines=array();
public $tracking_number;
public $tracking_url;
public $billed;
public $model_pdf;
var $trueWeight;
var $weight_units;
var $trueWidth;
var $width_units;
var $trueHeight;
var $height_units;
var $trueDepth;
var $depth_units;
public $trueWeight;
public $weight_units;
public $trueWidth;
public $width_units;
public $trueHeight;
public $height_units;
public $trueDepth;
public $depth_units;
// A denormalized value
var $trueSize;
public $trueSize;
public $date_delivery; // Date delivery planed
var $date_delivery; // Date delivery planed
/**
* @deprecated
* @see date_shipping
*/
var $date;
public $date;
/**
* @deprecated
* @see date_shipping
*/
var $date_expedition;
public $date_expedition;
/**
* Effective delivery date
* @var int
*/
public $date_shipping;
var $date_creation;
var $date_valid;
var $meths;
var $listmeths; // List of carriers
public $date_creation;
public $date_valid;
public $meths;
public $listmeths; // List of carriers
const STATUS_DRAFT = 0;
@ -478,7 +486,7 @@ class Expedition extends CommonObject
$sql.= ", e.note_private, e.note_public";
$sql.= ', e.fk_incoterms, e.location_incoterms';
$sql.= ', i.libelle as libelle_incoterms';
$sql.= ', s.libelle as shipping_method';
$sql.= ', s.libelle as shipping_method';
$sql.= ", el.fk_source as origin_id, el.sourcetype as origin";
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
@ -2293,7 +2301,7 @@ class ExpeditionLigne extends CommonObjectLine
* @var string ID to identify managed object
*/
public $element='expeditiondet';
/**
* @var string Name of table without prefix where object is stored
*/

View File

@ -50,7 +50,11 @@ class Fichinter extends CommonObject
*/
public $fk_element='fk_fichinter';
/**
* @var int Name of subtable line
*/
public $table_element_line='fichinterdet';
public $picto = 'intervention';
/**
@ -85,14 +89,17 @@ class Fichinter extends CommonObject
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Billed
*/
const STATUS_BILLED = 2;
/**
* Closed
*/

View File

@ -4,11 +4,11 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* 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
@ -50,7 +50,10 @@ class CommandeFournisseur extends CommonOrder
*/
public $table_element='commande_fournisseur';
public $table_element_line = 'commande_fournisseurdet';
/**
* @var int Name of subtable line
*/
public $table_element_line = 'commande_fournisseurdet';
/**
* @var int Field with ID of parent key if this field has a parent
@ -108,17 +111,20 @@ class CommandeFournisseur extends CommonOrder
* Delivery date
*/
public $date_livraison;
public $total_ht;
public $total_tva;
public $total_localtax1; // Total Local tax 1
public $total_localtax2; // Total Local tax 2
public $total_ttc;
public $source;
/**
* @deprecated
* @see note_private, note_public
*/
public $note;
public $note_private;
public $note_public;
public $model_pdf;
@ -144,6 +150,7 @@ class CommandeFournisseur extends CommonOrder
* @var CommandeFournisseurLigne[]
*/
public $lines = array();
//Add for supplier_proposal
public $origin;
public $origin_id;
@ -161,34 +168,42 @@ class CommandeFournisseur extends CommonOrder
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Accepted
*/
const STATUS_ACCEPTED = 2;
/**
* Order sent, shipment on process
*/
const STATUS_ORDERSENT = 3;
/**
* Received partially
*/
const STATUS_RECEIVED_PARTIALLY = 4;
/**
* Received completely
*/
const STATUS_RECEIVED_COMPLETELY = 5;
/**
* Order canceled
*/
const STATUS_CANCELED = 6;
/**
* Order canceled/never received
*/
const STATUS_CANCELED_AFTER_ORDER = 7;
/**
* Refused
*/

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
@ -51,7 +51,10 @@ class FactureFournisseur extends CommonInvoice
*/
public $table_element='facture_fourn';
public $table_element_line='facture_fourn_det';
/**
* @var int Name of subtable line
*/
public $table_element_line='facture_fourn_det';
/**
* @var int Field with ID of parent key if this field has a parent
@ -144,6 +147,7 @@ class FactureFournisseur extends CommonInvoice
* @var SupplierInvoiceLine[]
*/
public $lines = array();
/**
* @deprecated
*/

View File

@ -38,6 +38,9 @@ class Establishment extends CommonObject
*/
public $table_element='establishment';
/**
* @var int Name of subtable line
*/
public $table_element_line = '';
/**

View File

@ -3,8 +3,8 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -54,6 +54,9 @@ class Livraison extends CommonObject
*/
public $table_element="livraison";
/**
* @var int Name of subtable line
*/
public $table_element_line="livraisondet";
public $brouillon;

View File

@ -43,7 +43,10 @@ class Project extends CommonObject
*/
public $table_element = 'projet';
public $table_element_line = 'projet_task';
/**
* @var int Name of subtable line
*/
public $table_element_line = 'projet_task';
/**
* @var int Field with ID of parent key if this field has a parent
@ -69,31 +72,32 @@ class Project extends CommonObject
* @see title
*/
public $titre;
var $title;
var $date_start;
var $date_end;
var $date_close;
var $socid; // To store id of thirdparty
var $thirdparty_name; // To store name of thirdparty (defined only in some cases)
public $title;
public $date_start;
public $date_end;
public $date_close;
var $user_author_id; //!< Id of project creator. Not defined if shared project.
var $user_close_id;
var $public; //!< Tell if this is a public or private project
var $budget_amount;
var $bill_time; // Is the time spent on project must be invoiced or not
public $socid; // To store id of thirdparty
public $thirdparty_name; // To store name of thirdparty (defined only in some cases)
var $statuts_short;
var $statuts_long;
public $user_author_id; //!< Id of project creator. Not defined if shared project.
public $user_close_id;
public $public; //!< Tell if this is a public or private project
public $budget_amount;
public $bill_time; // Is the time spent on project must be invoiced or not
var $statut; // 0=draft, 1=opened, 2=closed
var $opp_status; // opportunity status, into table llx_c_lead_status
var $opp_percent; // opportunity probability
public $statuts_short;
public $statuts_long;
var $oldcopy;
public $statut; // 0=draft, 1=opened, 2=closed
public $opp_status; // opportunity status, into table llx_c_lead_status
public $opp_percent; // opportunity probability
var $weekWorkLoad; // Used to store workload details of a projet
var $weekWorkLoadPerTask; // Used to store workload details of tasks of a projet
public $oldcopy;
public $weekWorkLoad; // Used to store workload details of a projet
public $weekWorkLoadPerTask; // Used to store workload details of tasks of a projet
/**
* @var int Creation date
@ -101,16 +105,19 @@ class Project extends CommonObject
* @see date_c
*/
public $datec;
/**
* @var int Creation date
*/
public $date_c;
/**
* @var int Modification date
* @deprecated
* @see date_m
*/
public $datem;
/**
* @var int Modification date
*/
@ -125,10 +132,12 @@ class Project extends CommonObject
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Open/Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Closed status
*/

View File

@ -7,7 +7,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
@ -55,14 +55,21 @@ class SupplierProposal extends CommonObject
*/
public $table_element='supplier_proposal';
public $table_element_line='supplier_proposaldet';
/**
* @var int Name of subtable line
*/
public $table_element_line='supplier_proposaldet';
public $fk_element='fk_supplier_proposal';
public $picto='propal';
/**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int
*/
public $ismultientitymanaged = 1;
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
@ -74,24 +81,25 @@ class SupplierProposal extends CommonObject
*/
protected $table_ref_field = 'ref';
var $socid; // Id client
public $socid; // Id client
/**
* @deprecated
* @see user_author_id
*/
var $author;
var $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande
var $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande
var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (processed/billed)
var $date; // Date of proposal
var $date_livraison;
public $author;
public $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande
public $ref_supplier; //Reference saisie lors de l'ajout d'une ligne à la demande
public $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (processed/billed)
public $date; // Date of proposal
public $date_livraison;
/**
* @deprecated
* @see date_creation
*/
var $datec;
public $datec;
/**
* Creation date
@ -103,7 +111,7 @@ class SupplierProposal extends CommonObject
* @deprecated
* @see date_validation
*/
var $datev;
public $datev;
/**
* Validation date
@ -112,70 +120,76 @@ class SupplierProposal extends CommonObject
public $date_validation;
var $user_author_id;
var $user_valid_id;
var $user_close_id;
public $user_author_id;
public $user_valid_id;
public $user_close_id;
/**
* @deprecated
* @see price_ht
*/
var $price;
public $price;
/**
* @deprecated
* @see total_tva
*/
var $tva;
public $tva;
/**
* @deprecated
* @see total_ttc
*/
var $total;
public $total;
var $cond_reglement_code;
var $mode_reglement_code;
var $remise = 0;
var $remise_percent = 0;
var $remise_absolue = 0;
public $cond_reglement_code;
public $mode_reglement_code;
public $remise = 0;
public $remise_percent = 0;
public $remise_absolue = 0;
var $products=array();
var $extraparams=array();
public $products=array();
public $extraparams=array();
var $lines = array();
var $line;
public $lines = array();
public $line;
var $labelstatut=array();
var $labelstatut_short=array();
public $labelstatut=array();
public $labelstatut_short=array();
var $nbtodo;
var $nbtodolate;
public $nbtodo;
public $nbtodolate;
var $specimen;
public $specimen;
// Multicurrency
var $fk_multicurrency;
var $multicurrency_code;
var $multicurrency_tx;
var $multicurrency_total_ht;
var $multicurrency_total_tva;
var $multicurrency_total_ttc;
public $fk_multicurrency;
public $multicurrency_code;
public $multicurrency_tx;
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/**
* Validated status
*/
const STATUS_VALIDATED = 1;
/**
* Signed quote
*/
const STATUS_SIGNED = 2;
/**
* Not signed quote, canceled
*/
const STATUS_NOTSIGNED = 3;
/**
* Billed or closed/processed quote
*/