diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 12ce42a8d03..9cdf621bef9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -218,18 +218,6 @@ class Propal extends CommonObject $this->remise_absolue = 0; $this->duree_validite=$conf->global->PROPALE_VALIDITY_DURATION; - - $langs->load("propal"); - $this->labelstatut[0]=(! empty($conf->global->PROPAL_STATUS_DRAFT_LABEL) ? $conf->global->PROPAL_STATUS_DRAFT_LABEL : $langs->trans("PropalStatusDraft")); - $this->labelstatut[1]=(! empty($conf->global->PROPAL_STATUS_VALIDATED_LABEL) ? $conf->global->PROPAL_STATUS_VALIDATED_LABEL : $langs->trans("PropalStatusValidated")); - $this->labelstatut[2]=(! empty($conf->global->PROPAL_STATUS_SIGNED_LABEL) ? $conf->global->PROPAL_STATUS_SIGNED_LABEL : $langs->trans("PropalStatusSigned")); - $this->labelstatut[3]=(! empty($conf->global->PROPAL_STATUS_NOTSIGNED_LABEL) ? $conf->global->PROPAL_STATUS_NOTSIGNED_LABEL : $langs->trans("PropalStatusNotSigned")); - $this->labelstatut[4]=(! empty($conf->global->PROPAL_STATUS_BILLED_LABEL) ? $conf->global->PROPAL_STATUS_BILLED_LABEL : $langs->trans("PropalStatusBilled")); - $this->labelstatut_short[0]=(! empty($conf->global->PROPAL_STATUS_DRAFTSHORT_LABEL) ? $conf->global->PROPAL_STATUS_DRAFTSHORT_LABEL : $langs->trans("PropalStatusDraftShort")); - $this->labelstatut_short[1]=(! empty($conf->global->PROPAL_STATUS_VALIDATEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_VALIDATEDSHORT_LABEL : $langs->trans("Opened")); - $this->labelstatut_short[2]=(! empty($conf->global->PROPAL_STATUS_SIGNEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_SIGNEDSHORT_LABEL : $langs->trans("PropalStatusSignedShort")); - $this->labelstatut_short[3]=(! empty($conf->global->PROPAL_STATUS_NOTSIGNEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_NOTSIGNEDSHORT_LABEL : $langs->trans("PropalStatusNotSignedShort")); - $this->labelstatut_short[4]=(! empty($conf->global->PROPAL_STATUS_BILLEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_BILLEDSHORT_LABEL : $langs->trans("PropalStatusBilledShort")); } @@ -3091,10 +3079,24 @@ class Propal extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - function LibStatut($statut,$mode=1) + function LibStatut($statut,$mode=1) { - global $langs; - $langs->load("propal"); + // Init/load array of translation of status + if (empty($this->labelstatut) || empty($this->labelstatut_short)) + { + global $langs; + $langs->load("propal"); + $this->labelstatut[0]=(! empty($conf->global->PROPAL_STATUS_DRAFT_LABEL) ? $conf->global->PROPAL_STATUS_DRAFT_LABEL : $langs->trans("PropalStatusDraft")); + $this->labelstatut[1]=(! empty($conf->global->PROPAL_STATUS_VALIDATED_LABEL) ? $conf->global->PROPAL_STATUS_VALIDATED_LABEL : $langs->trans("PropalStatusValidated")); + $this->labelstatut[2]=(! empty($conf->global->PROPAL_STATUS_SIGNED_LABEL) ? $conf->global->PROPAL_STATUS_SIGNED_LABEL : $langs->trans("PropalStatusSigned")); + $this->labelstatut[3]=(! empty($conf->global->PROPAL_STATUS_NOTSIGNED_LABEL) ? $conf->global->PROPAL_STATUS_NOTSIGNED_LABEL : $langs->trans("PropalStatusNotSigned")); + $this->labelstatut[4]=(! empty($conf->global->PROPAL_STATUS_BILLED_LABEL) ? $conf->global->PROPAL_STATUS_BILLED_LABEL : $langs->trans("PropalStatusBilled")); + $this->labelstatut_short[0]=(! empty($conf->global->PROPAL_STATUS_DRAFTSHORT_LABEL) ? $conf->global->PROPAL_STATUS_DRAFTSHORT_LABEL : $langs->trans("PropalStatusDraftShort")); + $this->labelstatut_short[1]=(! empty($conf->global->PROPAL_STATUS_VALIDATEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_VALIDATEDSHORT_LABEL : $langs->trans("Opened")); + $this->labelstatut_short[2]=(! empty($conf->global->PROPAL_STATUS_SIGNEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_SIGNEDSHORT_LABEL : $langs->trans("PropalStatusSignedShort")); + $this->labelstatut_short[3]=(! empty($conf->global->PROPAL_STATUS_NOTSIGNEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_NOTSIGNEDSHORT_LABEL : $langs->trans("PropalStatusNotSignedShort")); + $this->labelstatut_short[4]=(! empty($conf->global->PROPAL_STATUS_BILLEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_BILLEDSHORT_LABEL : $langs->trans("PropalStatusBilledShort")); + } $statuttrans=''; if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 7364199fca5..ba486e066cc 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -34,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; class Fournisseur extends Societe { var $next_prev_filter="te.fournisseur = 1"; // Used to add a filter in Form::showrefnav method - - + + /** * Constructor * @@ -44,10 +44,9 @@ class Fournisseur extends Societe function __construct($db) { $this->db = $db; + $this->client = 0; - $this->fournisseur = 0; - $this->effectif_id = 0; - $this->forme_juridique_code = 0; + $this->fournisseur = 1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7c683a35121..2f36fd59035 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -160,16 +160,16 @@ class Product extends CommonObject //! Average price value for product entry into stock (PMP) public $pmp; - /** + /** * Stock alert * @var int */ - public $seuil_stock_alerte; + public $seuil_stock_alerte=0; /** * Ask for replenishment when $desiredstock < $stock_reel */ - public $desiredstock; + public $desiredstock=0; /* * Service expiration @@ -185,13 +185,13 @@ class Product extends CommonObject * Status indicates whether the product is on sale '1' or not '0' * @var int */ - public $status; + public $status=0; /** * Status indicate whether the product is available for purchase '1' or not '0' * @var int */ - public $status_buy; + public $status_buy=0; /** * Status indicates whether the product is a finished product '1' or a raw material '0' @@ -203,7 +203,7 @@ class Product extends CommonObject * We must manage lot/batch number, sell-by date and so on : '1':yes '0':no * @var int */ - public $status_batch; + public $status_batch=0; /** * Customs code @@ -266,7 +266,7 @@ class Product extends CommonObject //! Product ID already linked to a reference supplier public $product_id_already_linked; - public $nbphoto; + public $nbphoto=0; //! Contains detail of stock of product into each warehouse public $stock_warehouse=array(); @@ -332,14 +332,7 @@ class Product extends CommonObject global $langs; $this->db = $db; - $this->status = 0; - $this->status_buy = 0; - $this->nbphoto = 0; - $this->stock_reel = 0; - $this->seuil_stock_alerte = 0; - $this->desiredstock = 0; $this->canvas = ''; - $this->status_batch=0; } /** diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 6db71eb4218..59eea72c2c7 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -29,9 +29,9 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; */ class Client extends Societe { - var $next_prev_filter="te.client in (1,2,3)"; // Used to add a filter in Form::showrefnav method + public $next_prev_filter="te.client in (1,2,3)"; // Used to add a filter in Form::showrefnav method - var $cacheprospectstatus=array(); + public $cacheprospectstatus=array(); /** @@ -42,6 +42,9 @@ class Client extends Societe function __construct($db) { $this->db = $db; + + $this->client = 3; + $this->fournisseur = 0; } /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 1fb99e3c5d2..32f29522268 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -107,22 +107,22 @@ class Societe extends CommonObject * Thirdparty status : 0=activity ceased, 1= in activity * @var int */ - var $status; + public $status=1; /** * Id of department * @var int */ - var $state_id; - var $state_code; - var $state; + public $state_id; + public $state_code; + public $state; /** * Id of region * @var int */ - var $region_code; - var $region; + public $region_code; + public $region; /** * State code @@ -130,54 +130,54 @@ class Societe extends CommonObject * @deprecated Use state_code instead * @see state_code */ - var $departement_code; + public $departement_code; /** * @var string * @deprecated Use state instead * @see state */ - var $departement; + public $departement; /** * @var string * @deprecated Use country instead * @see country */ - var $pays; + public $pays; /** * Phone number * @var string */ - var $phone; + public $phone; /** * Fax number * @var string */ - var $fax; + public $fax; /** * Email * @var string */ - var $email; + public $email; /** * Skype username * @var string */ - var $skype; + public $skype; /** * Webpage * @var string */ - var $url; + public $url; //! barcode /** * Barcode value * @var string */ - var $barcode; + public $barcode; // 6 professional id (usage depends on country) @@ -185,68 +185,68 @@ class Societe extends CommonObject * Professional ID 1 (Ex: Siren in France) * @var string */ - var $idprof1; + public $idprof1; /** * Professional ID 2 (Ex: Siret in France) * @var string */ - var $idprof2; + public $idprof2; /** * Professional ID 3 (Ex: Ape in France) * @var string */ - var $idprof3; + public $idprof3; /** * Professional ID 4 (Ex: RCS in France) * @var string */ - var $idprof4; + public $idprof4; /** * Professional ID 5 * @var string */ - var $idprof5; + public $idprof5; /** * Professional ID 6 * @var string */ - var $idprof6; + public $idprof6; - var $prefix_comm; + public $prefix_comm; - var $tva_assuj; + public $tva_assuj=1; /** * Intracommunitary VAT ID * @var string */ - var $tva_intra; + public $tva_intra; // Local taxes - var $localtax1_assuj; - var $localtax1_value; - var $localtax2_assuj; - var $localtax2_value; + public $localtax1_assuj; + public $localtax1_value; + public $localtax2_assuj; + public $localtax2_value; - var $managers; - var $capital; - var $typent_id; - var $typent_code; - var $effectif; - var $effectif_id; - var $forme_juridique_code; - var $forme_juridique; + public $managers; + public $capital; + public $typent_id=0; + public $typent_code; + public $effectif; + public $effectif_id=0; + public $forme_juridique_code; + public $forme_juridique=0; - var $remise_percent; - var $remise_supplier_percent; - var $mode_reglement_supplier_id; - var $cond_reglement_supplier_id; - var $fk_prospectlevel; - var $name_bis; + public $remise_percent; + public $remise_supplier_percent; + public $mode_reglement_supplier_id; + public $cond_reglement_supplier_id; + public $fk_prospectlevel; + public $name_bis; //Log data @@ -254,127 +254,127 @@ class Societe extends CommonObject * Date of last update * @var string */ - var $date_modification; + public $date_modification; /** * User that made last update * @var string */ - var $user_modification; + public $user_modification; /** * Date of creation * @var string */ - var $date_creation; + public $date_creation; /** * User that created the thirdparty * @var User */ - var $user_creation; + public $user_creation; - var $specimen; + public $specimen; /** * 0=no customer, 1=customer, 2=prospect, 3=customer and prospect * @var int */ - var $client; + public $client=0; /** * 0=no prospect, 1=prospect * @var int */ - var $prospect; + public $prospect=0; /** * 0=no supplier, 1=supplier * @var int */ - var $fournisseur; + public $fournisseur; /** * Client code. E.g: CU2014-003 * @var string */ - var $code_client; + public $code_client; /** * Supplier code. E.g: SU2014-003 * @var string */ - var $code_fournisseur; + public $code_fournisseur; /** * Accounting code for client * @var string */ - var $code_compta; + public $code_compta; /** * Accounting code for suppliers * @var string */ - var $code_compta_fournisseur; + public $code_compta_fournisseur; /** * @var string * @deprecated Note is split in public and private notes * @see note_public, note_private */ - var $note; + public $note; /** * Private note * @var string */ - var $note_private; + public $note_private; /** * Public note * @var string */ - var $note_public; + public $note_public; //! code statut prospect - var $stcomm_id; - var $statut_commercial; + public $stcomm_id; + public $statut_commercial; /** * Assigned price level * @var int */ - var $price_level; - var $outstanding_limit; + public $price_level; + public $outstanding_limit; /** * Min order amounts */ - var $order_min_amount; - var $supplier_order_min_amount; + public $order_min_amount; + public $supplier_order_min_amount; /** * Id of sales representative to link (used for thirdparty creation). Not filled by a fetch, because we can have several sales representatives. * @var int */ - var $commercial_id; + public $commercial_id; /** * Id of parent thirdparty (if one) * @var int */ - var $parent; + public $parent; /** * Default language code of thirdparty (en_US, ...) * @var string */ - var $default_lang; + public $default_lang; - var $ref; - var $ref_int; + public $ref; + public $ref_int; /** * External user reference. * This is to allow external systems to store their id and make self-developed synchronizing functions easier to * build. * @var string */ - var $ref_ext; + public $ref_ext; /** * Import key. @@ -382,45 +382,39 @@ class Societe extends CommonObject * to an import process * @var string */ - var $import_key; + public $import_key; /** * Supplier WebServices URL * @var string */ - var $webservices_url; + public $webservices_url; /** * Supplier WebServices Key * @var string */ - var $webservices_key; + public $webservices_key; - var $logo; - var $logo_small; - var $logo_mini; + public $logo; + public $logo_small; + public $logo_mini; - var $array_options; + public $array_options; // Incoterms - var $fk_incoterms; - var $location_incoterms; - var $libelle_incoterms; //Used into tooltip + public $fk_incoterms; + public $location_incoterms; + public $libelle_incoterms; //Used into tooltip // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; + public $fk_multicurrency; + public $multicurrency_code; // END MODULEBUILDER PROPERTIES - /** - * To contains a clone of this when we need to save old properties of object - * @var Societe - */ - var $oldcopy; - /** * Constructor * @@ -1972,7 +1966,7 @@ class Societe extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $name=$this->name?$this->name:$this->nom; - + if(!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ if(empty($option) && $this->client > 0) $option = 'customer'; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 17981be69b9..fbbbce0f9a8 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -191,18 +191,6 @@ class SupplierProposal extends CommonObject $this->remise = 0; $this->remise_percent = 0; $this->remise_absolue = 0; - - $langs->load("supplier_proposal"); - $this->labelstatut[0]=$langs->trans("SupplierProposalStatusDraft"); - $this->labelstatut[1]=$langs->trans("SupplierProposalStatusValidated"); - $this->labelstatut[2]=$langs->trans("SupplierProposalStatusSigned"); - $this->labelstatut[3]=$langs->trans("SupplierProposalStatusNotSigned"); - $this->labelstatut[4]=$langs->trans("SupplierProposalStatusClosed"); - $this->labelstatut_short[0]=$langs->trans("SupplierProposalStatusDraftShort"); - $this->labelstatut_short[1]=$langs->trans("Opened"); - $this->labelstatut_short[2]=$langs->trans("SupplierProposalStatusSignedShort"); - $this->labelstatut_short[3]=$langs->trans("SupplierProposalStatusNotSignedShort"); - $this->labelstatut_short[4]=$langs->trans("SupplierProposalStatusClosedShort"); } @@ -2072,9 +2060,24 @@ class SupplierProposal extends CommonObject */ function LibStatut($statut,$mode=1) { - global $langs; - $langs->load("supplier_proposal"); + // Init/load array of translation of status + if (empty($this->labelstatut) || empty($this->labelstatut_short)) + { + global $langs; + $langs->load("supplier_proposal"); + $this->labelstatut[0]=$langs->trans("SupplierProposalStatusDraft"); + $this->labelstatut[1]=$langs->trans("SupplierProposalStatusValidated"); + $this->labelstatut[2]=$langs->trans("SupplierProposalStatusSigned"); + $this->labelstatut[3]=$langs->trans("SupplierProposalStatusNotSigned"); + $this->labelstatut[4]=$langs->trans("SupplierProposalStatusClosed"); + $this->labelstatut_short[0]=$langs->trans("SupplierProposalStatusDraftShort"); + $this->labelstatut_short[1]=$langs->trans("Opened"); + $this->labelstatut_short[2]=$langs->trans("SupplierProposalStatusSignedShort"); + $this->labelstatut_short[3]=$langs->trans("SupplierProposalStatusNotSignedShort"); + $this->labelstatut_short[4]=$langs->trans("SupplierProposalStatusClosedShort"); + } + $statuttrans=''; if ($statut==0) $statuttrans='statut0'; if ($statut==1) $statuttrans='statut1'; if ($statut==2) $statuttrans='statut3';