From f93e11468861363787a33bd22a6539daaf36904c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2019 15:37:15 +0100 Subject: [PATCH 01/13] do not trim int --- htdocs/don/class/paymentdonation.class.php | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index d38e19e62f5..5e7a2fdad6f 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -121,14 +121,14 @@ class PaymentDonation extends CommonObject } // Clean parameters - if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation); + if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation; if (isset($this->amount)) $this->amount=trim($this->amount); if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment); if (isset($this->note_public)) $this->note_public=trim($this->note_public); - if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); - if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat); - if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); + if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; + if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; $totalamount = 0; foreach ($this->amounts as $key => $value) // How payment is dispatch @@ -275,14 +275,14 @@ class PaymentDonation extends CommonObject // Clean parameters - if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation); + if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation; if (isset($this->amount)) $this->amount=trim($this->amount); if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment); if (isset($this->note_public)) $this->note_public=trim($this->note_public); - if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); - if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat); - if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); + if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank; + if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat; + if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif; // Check parameters // Put here code to add control on parameters values @@ -306,7 +306,10 @@ class PaymentDonation extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $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) { @@ -609,7 +612,7 @@ class PaymentDonation extends CommonObject public function update_fk_bank($id_bank) { // phpcs:enable - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".(int) $this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); $result = $this->db->query($sql); From f379f510fa797f53684a7001f87bbcbfa7c116d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2019 15:44:13 +0100 Subject: [PATCH 02/13] Update paymentdonation.class.php --- htdocs/don/class/paymentdonation.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 5e7a2fdad6f..22b75cd777b 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -300,7 +300,7 @@ class PaymentDonation extends CommonObject $sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").","; $sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").","; $sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null").""; - $sql.= " WHERE rowid=".$this->id; + $sql.= " WHERE rowid=".(int) $this->id; $this->db->begin(); @@ -361,7 +361,7 @@ class PaymentDonation extends CommonObject if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url"; - $sql.= " WHERE type='payment_donation' AND url_id=".$this->id; + $sql.= " WHERE type='payment_donation' AND url_id=".(int) $this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); @@ -375,7 +375,10 @@ class PaymentDonation extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $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) @@ -612,7 +615,7 @@ class PaymentDonation extends CommonObject public function update_fk_bank($id_bank) { // phpcs:enable - $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".(int) $this->id; + $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".(int) $id_bank." WHERE rowid = ".(int) $this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); $result = $this->db->query($sql); From 4d3ed4ffd39ef5aa75e854ebe563908eef5ff848 Mon Sep 17 00:00:00 2001 From: ATM John BOTELLA Date: Sat, 7 Dec 2019 17:41:13 +0100 Subject: [PATCH 03/13] Fix dolGetBadge class --- htdocs/core/lib/functions.lib.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6306162af34..7530b9a7fc5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8132,7 +8132,7 @@ function roundUpToNextMultiple($n, $x = 5) function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array()) { $attr = array( - 'class'=>'badge badge-status'.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css']) + 'class'=>'badge '.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css']) ); if (empty($html)) { @@ -8153,7 +8153,15 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = ' // Override attr if (!empty($params['attr']) && is_array($params['attr'])) { foreach ($params['attr']as $key => $value) { - $attr[$key] = $value; + if ($key == 'class') { + $attr['class'] .= ' '.$value; + } + elseif ($key == 'classOverride') { + $attr['class'] = $value; + } + else { + $attr[$key] = $value; + } } } @@ -8260,6 +8268,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { $statusLabelShort = !empty($statusLabelShort) ? $statusLabelShort : $statusLabel; + $dolGetBadgeParams['attr']['class'] = 'badge-status'; + if ($displayMode == 3) { $return = dolGetBadge($statusLabel, '', $statusType, 'dot', $url, $dolGetBadgeParams); } From 72c30c4101f95dde8636d7c7be4146a2889217b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 7 Dec 2019 23:39:09 +0100 Subject: [PATCH 04/13] Update server_order.php --- htdocs/webservices/server_order.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 4f1a2bf64e2..59ccbc29df0 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -444,10 +444,10 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') 'total' => $order->total_ttc, 'project_id' => $order->fk_project, - 'date' => $order->date_commande ?dol_print_date($order->date_commande, 'dayrfc') : '', - 'date_creation' => $invoice->date_creation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', - 'date_validation' => $invoice->date_validation ?dol_print_date($invoice->date_creation, 'dayhourrfc') : '', - 'date_modification' => $invoice->datem ?dol_print_date($invoice->datem, 'dayhourrfc') : '', + 'date' => $order->date ?dol_print_date($order->date, 'dayrfc') : '', + 'date_creation' => $order->date_creation ?dol_print_date($order->date_creation, 'dayhourrfc') : '', + 'date_validation' => $order->date_validation ?dol_print_date($order->date_creation, 'dayhourrfc') : '', + 'date_modification' => $order->datem ?dol_print_date($order->datem, 'dayhourrfc') : '', 'remise' => $order->remise, 'remise_percent' => $order->remise_percent, @@ -476,13 +476,15 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') else { $error++; - $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; + $errorcode = 'NOT_FOUND'; + $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } else { $error++; - $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; + $errorcode = 'PERMISSION_DENIED'; + $errorlabel = 'User does not have permission for this request'; } } @@ -552,7 +554,8 @@ function getOrdersForThirdParty($authentication, $idthirdparty) if( $socid && ( $socid != $order->socid) ) { $error++; - $errorcode='PERMISSION_DENIED'; $errorlabel=$order->socid.' User does not have permission for this request'; + $errorcode='PERMISSION_DENIED'; + $errorlabel=$order->socid.' User does not have permission for this request'; } if(!$error) From ab33bb1d3b9beedfd18083945e86a24ca874917d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 13:37:50 +0100 Subject: [PATCH 05/13] The property datem does not exist on Societe --- htdocs/societe/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a56762ce447..f0206175d0d 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -239,7 +239,7 @@ $sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur"; $sql .= ", s.code_client"; $sql .= ", s.code_fournisseur"; $sql .= ", s.logo"; -$sql .= ", s.canvas, s.tms as datem, s.status as status"; +$sql .= ", s.canvas, s.tms as date_modification, s.status as status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ' WHERE s.entity IN ('.getEntity('societe').')'; @@ -279,7 +279,7 @@ if ($result) $thirdparty_static->client = $objp->client; $thirdparty_static->fournisseur = $objp->fournisseur; $thirdparty_static->logo = $objp->logo; - $thirdparty_static->datem = $db->jdate($objp->datem); + $thirdparty_static->date_modification = $db->jdate($objp->date_modification); $thirdparty_static->status = $objp->status; $thirdparty_static->code_client = $objp->code_client; $thirdparty_static->code_fournisseur = $objp->code_fournisseur; @@ -313,7 +313,7 @@ if ($result) print ''; // Last modified date print ''; - print dol_print_date($thirdparty_static->datem, 'day'); + print dol_print_date($thirdparty_static->date_modification, 'day'); print ""; print ''; print $thirdparty_static->getLibStatut(3); From f0af4504940d175312aa2b80c946f16f596f8069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 13:40:55 +0100 Subject: [PATCH 06/13] The variable $db seems to be never defined The variable $db seems to be never defined on line 154 --- htdocs/societe/canvas/actions_card_common.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index aafcd8ffc69..a76e9aa34cb 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -82,7 +82,7 @@ abstract class ActionsCardCommon public function assign_values(&$action, $id = 0, $ref = '') { // phpcs:enable - global $conf, $langs, $user, $mysoc, $canvas; + global $conf, $langs, $db, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; if ($action == 'add' || $action == 'update') $this->assign_post($action); From 48564ea760adef644fb2a353308d162a54f779a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 14:26:59 +0100 Subject: [PATCH 07/13] doxygen societe class --- htdocs/install/mysql/tables/llx_societe.sql | 18 +-- htdocs/societe/class/societe.class.php | 157 +++++++++++++++++--- 2 files changed, 148 insertions(+), 27 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index fc3100b823d..a98be7912f7 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -52,15 +52,15 @@ create table llx_societe email varchar(128), -- socialnetworks text DEFAULT NULL, -- json with socialnetworks - skype varchar(255), -- - twitter varchar(255), -- - facebook varchar(255), -- - linkedin varchar(255), -- - instagram varchar(255), -- - snapchat varchar(255), -- - googleplus varchar(255), -- - youtube varchar(255), -- - whatsapp varchar(255), -- + skype varchar(255), -- deprecated + twitter varchar(255), -- deprecated + facebook varchar(255), -- deprecated + linkedin varchar(255), -- deprecated + instagram varchar(255), -- deprecated + snapchat varchar(255), -- deprecated + googleplus varchar(255), -- deprecated + youtube varchar(255), -- deprecated + whatsapp varchar(255), -- deprecated fk_effectif integer DEFAULT 0, -- fk_typent integer DEFAULT 0, -- diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 788fc45ee7e..c2017c894c0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -59,16 +59,51 @@ class Societe extends CommonObject */ public $fk_element = 'fk_soc'; + /** + * @var string Fields for combobox + */ public $fieldsforcombobox = 'nom,name_alias'; /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables = array("supplier_proposal"=>'SupplierProposal', "propal"=>'Proposal', "commande"=>'Order', "facture"=>'Invoice', "facture_rec"=>'RecurringInvoiceTemplate', "contrat"=>'Contract', "fichinter"=>'Fichinter', "facture_fourn"=>'SupplierInvoice', "commande_fournisseur"=>'SupplierOrder', "projet"=>'Project', "expedition"=>'Shipment', "prelevement_lignes"=>'DirectDebitRecord'); + protected $childtables = array( + "supplier_proposal" => 'SupplierProposal', + "propal" => 'Proposal', + "commande" => 'Order', + "facture" => 'Invoice', + "facture_rec" => 'RecurringInvoiceTemplate', + "contrat" => 'Contract', + "fichinter" => 'Fichinter', + "facture_fourn" => 'SupplierInvoice', + "commande_fournisseur" => 'SupplierOrder', + "projet" => 'Project', + "expedition" => 'Shipment', + "prelevement_lignes" => 'DirectDebitRecord', + ); + /** * @var array List of child tables. To know object to delete on cascade. */ - protected $childtablesoncascade = array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); + protected $childtablesoncascade = array( + "societe_prices", + "societe_log", + "societe_address", + "product_fournisseur_price", + "product_customer_price_log", + "product_customer_price", + "socpeople", + "adherent", + "societe_account", + "societe_rib", + "societe_remise", + "societe_remise_except", + "societe_commerciaux", + "categorie", + "notify", + "notify_def", + "actioncomm", + ); /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -87,8 +122,6 @@ class Societe extends CommonObject */ public $restrictiononfksoc = 1; - - // BEGIN MODULEBUILDER PROPERTIES /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ @@ -123,7 +156,7 @@ class Societe extends CommonObject public $nom; /** - * @var string name + * @var string Thirdparty name */ public $name; @@ -133,6 +166,9 @@ class Societe extends CommonObject */ public $name_alias; + /** + * @var int Physical thirdparty not a company + */ public $particulier; /** @@ -140,7 +176,14 @@ class Societe extends CommonObject */ public $address; + /** + * @var string Zip code of thirdparty + */ public $zip; + + /** + * @var string Town of thirdparty + */ public $town; /** @@ -154,7 +197,15 @@ class Societe extends CommonObject * @var int */ public $state_id; + + /** + * @var string State code + */ public $state_code; + + /** + * @var string State name + */ public $state; /** @@ -162,11 +213,14 @@ class Societe extends CommonObject * @var int */ public $region_code; + + /** + * @var string Region name + */ public $region; /** - * State code - * @var string + * @var string State code * @deprecated Use state_code instead * @see $state_code */ @@ -220,25 +274,27 @@ class Societe extends CommonObject * @deprecated */ public $twitter; + /** * Facebook username * @var string * @deprecated */ public $facebook; + /** * LinkedIn username * @var string * @deprecated */ - public $linkedin; + public $linkedin; + /** * Webpage * @var string */ public $url; - //! barcode /** * Barcode value * @var string @@ -283,9 +339,16 @@ class Societe extends CommonObject */ public $idprof6; + /** + * @var string Prefix comm + */ public $prefix_comm; + /** + * @var int Vat concerned + */ public $tva_assuj = 1; + /** * Intracommunitary VAT ID * @var string @@ -298,8 +361,19 @@ class Societe extends CommonObject public $localtax2_assuj; public $localtax2_value; + /** + * @var string Manager + */ public $managers; + + /** + * @var float Capital + */ public $capital; + + /** + * @var int Type thirdparty + */ public $typent_id = 0; public $typent_code; public $effectif; @@ -317,6 +391,9 @@ class Societe extends CommonObject */ public $fk_prospectlevel; + /** + * @var string second name + */ public $name_bis; //Log data @@ -326,6 +403,7 @@ class Societe extends CommonObject * @var string */ public $date_modification; + /** * User that made last update * @var string @@ -351,11 +429,13 @@ class Societe extends CommonObject * @var int */ public $client = 0; + /** * 0=no prospect, 1=prospect * @var int */ public $prospect = 0; + /** * 0=no supplier, 1=supplier * @var int @@ -416,6 +496,7 @@ class Societe extends CommonObject * @var int */ public $stcomm_id; + /** * Status prospect label * @var int @@ -427,12 +508,20 @@ class Societe extends CommonObject * @var int */ public $price_level; + + /** + * @var string outstanding limit + */ public $outstanding_limit; /** - * Min order amounts + * @var string Min order amount */ public $order_min_amount; + + /** + * @var string Supplier min order amount + */ public $supplier_order_min_amount; /** @@ -440,11 +529,13 @@ class Societe extends CommonObject * @var int */ public $commercial_id; + /** * Id of parent thirdparty (if one) * @var int */ public $parent; + /** * Default language code of thirdparty (en_US, ...) * @var string @@ -456,7 +547,11 @@ class Societe extends CommonObject */ public $ref; + /** + * @var string Internal 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 @@ -485,22 +580,49 @@ class Societe extends CommonObject */ public $webservices_key; + /** + * @var string Logo + */ public $logo; + + /** + * @var string logo small + */ public $logo_small; + + /** + * @var string Logo mini + */ public $logo_mini; + + /** + * @var string Logo squarred + */ public $logo_squarred; + + /** + * @var string Logo squarred small + */ public $logo_squarred_small; + + /** + * @var string Logo squarred mini + */ public $logo_squarred_mini; - public $array_options; - - // Incoterms /** - * @var int ID + * @var int ID Incoterms */ public $fk_incoterms; + /** + * @var string Incoterms Location + */ public $location_incoterms; + + /** + * @var string Incoterm label + */ public $label_incoterms; //Used into tooltip // Multicurrency @@ -509,12 +631,11 @@ class Societe extends CommonObject */ public $fk_multicurrency; + /** + * @var string Multicurrency code + */ public $multicurrency_code; - - // END MODULEBUILDER PROPERTIES - - /** * Constructor * From 49f22faceffe66655f5f1d2e16b5cfa4dead2793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:37:19 +0100 Subject: [PATCH 08/13] doxygen --- htdocs/compta/deplacement/class/deplacement.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 0601c62fd80..5d6221e5135 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2019 Frédéric France * * 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 @@ -82,8 +83,16 @@ class Deplacement extends CommonObject public $fk_user; public $km; + + /** + * @var int Thirdparty id + */ public $socid; - public $statut; // 0=draft, 1=validated + + /** + * @var int Status 0=draft, 1=validated, 2=Refunded + */ + public $statut; public $extraparams=array(); public $statuts=array(); From 6c5629b5a53998e62eea297c72dfd9a40c217700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:39:33 +0100 Subject: [PATCH 09/13] Update deplacement.class.php --- htdocs/compta/deplacement/class/deplacement.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 5d6221e5135..242ae5f6211 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -82,7 +82,10 @@ class Deplacement extends CommonObject */ public $fk_user; - public $km; + /** + * @var string km value formatted + */ + public $km; /** * @var int Thirdparty id From 3db84df60e8654d8621dc44888b8fce1cdea3260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:45:10 +0100 Subject: [PATCH 10/13] Update card.php --- htdocs/compta/deplacement/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 5f469a2cef6..c121ee7836d 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * 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 @@ -63,7 +63,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if ($action == 'validate' && $user->rights->deplacement->creer) { $object->fetch($id); - if ($object->statut == 0) + if ($object->statut == Deplacement::STATUS_DRAFT) { $result = $object->setStatut(1); if ($result > 0) @@ -81,9 +81,9 @@ if ($action == 'validate' && $user->rights->deplacement->creer) elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { $object->fetch($id); - if ($object->statut == 1) + if ($object->statut == Deplacement::STATUS_VALIDATED) { - $result = $object->setStatut(2); + $result = $object->setStatut(Deplacement::STATUS_REFUNDED); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); @@ -116,14 +116,14 @@ elseif ($action == 'add' && $user->rights->deplacement->creer) { $error = 0; - $object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + $object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount - $object->type = GETPOST('type', 'alpha'); - $object->socid = GETPOST('socid', 'int'); - $object->fk_user = GETPOST('fk_user', 'int'); + $object->type = GETPOST('type', 'alpha'); + $object->socid = (int) GETPOST('socid', 'int'); + $object->fk_user = (int) GETPOST('fk_user', 'int'); $object->note_private = GETPOST('note_private', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha'); - $object->statut = 0; + $object->statut = Deplacement::STATUS_DRAFT; if (!$object->date) { @@ -178,8 +178,8 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) $object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount $object->type = GETPOST('type', 'alpha'); - $object->socid = GETPOST('socid', 'int'); - $object->fk_user = GETPOST('fk_user', 'int'); + $object->socid = (int) GETPOST('socid', 'int'); + $object->fk_user = (int) GETPOST('fk_user', 'int'); $object->note_private = GETPOST('note_private', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha'); @@ -523,7 +523,7 @@ elseif ($id) print '
'; - if ($object->statut < 2) // if not refunded + if ($object->statut < Deplacement::STATUS_REFUNDED) // if not refunded { if ($user->rights->deplacement->creer) { @@ -535,7 +535,7 @@ elseif ($id) } } - if ($object->statut == 0) // if draft + if ($object->statut == Deplacement::STATUS_DRAFT) // if draft { if ($user->rights->deplacement->creer) { @@ -547,7 +547,7 @@ elseif ($id) } } - if ($object->statut == 1) // if validated + if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated { if ($user->rights->deplacement->creer) { From c05ba624ce153471b974950baecdd3d8f2459ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 22:46:22 +0100 Subject: [PATCH 11/13] Update deplacement.class.php --- .../deplacement/class/deplacement.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 242ae5f6211..be46e1dfd14 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -101,6 +101,21 @@ class Deplacement extends CommonObject public $statuts=array(); public $statuts_short=array(); + /** + * Draft status + */ + const STATUS_DRAFT = 0; + + /** + * Validated status + */ + const STATUS_VALIDATED = 1; + + /** + * Refunded status + */ + const STATUS_REFUNDED = 2; + /** * Constructor * From fbb5fbae139029dacde9a0775427791b204a81b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 8 Dec 2019 23:02:34 +0100 Subject: [PATCH 12/13] Update new.php --- htdocs/public/members/new.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index a6e06dfb5ff..72c49b6e9fd 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -4,7 +4,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -567,7 +567,7 @@ $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''.$langs->trans('Nature').' *'."\n"; + print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } From 76cf54e6e7d5e18892ca731d468104bcc4e81800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 9 Dec 2019 08:07:59 +0100 Subject: [PATCH 13/13] typo + doxygen --- htdocs/mrp/class/mo.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0536ee41b8d..195a3805c32 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -120,7 +120,15 @@ class Mo extends CommonObject public $qty; public $fk_warehouse; public $fk_soc; + + /** + * @var string public note + */ public $note_public; + + /** + * @var string private note + */ public $note_private; /** @@ -245,7 +253,7 @@ class Mo extends CommonObject // Insert lines in mrp_production table if (! $error && $this->fk_bom > 0) { - include_once DOL_DOCULENT_ROOT.'/bom/class/bom.class.php'; + include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $bom = new Bom($this->db); $bom->fetch($this->fk_bom); if ($bom->id > 0)