From 1cf786acff1dc3c31c0006e47238c349e5179fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Tue, 22 Jan 2019 00:09:36 +0100 Subject: [PATCH 001/190] Fix #10278 Fix #10278 --- htdocs/core/class/commonobject.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 676e76fe16a..d8d27a0378a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4932,8 +4932,6 @@ abstract class CommonObject $new_array_options[$key] = price2num($this->array_options[$key]); break; case 'date': - $new_array_options[$key] = $this->db->idate($this->array_options[$key]); - break; case 'datetime': // If data is a string instead of a timestamp, we convert it if (! is_int($this->array_options[$key])) { From aa08e3276140499836516baf59feb7ac172cef5b Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 04:48:59 +0100 Subject: [PATCH 002/190] Add links and related documents for a stock movement @eldy you can clone in movement_card.php if you prefer this structure --- htdocs/product/stock/movement_list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 68ad4d96789..ce77f120db4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -403,12 +403,12 @@ if ($action == "transfert_stock" && ! $cancel) /* * Build document */ -/* The builddoc action for object of a movement must be on the movement card +// The builddoc action for object of a movement must be on the movement card // Actions to build doc -$upload_dir = $conf->stock->dir_output; +$upload_dir = $conf->stock->dir_output . "movement/"; $permissioncreate = $user->rights->stock->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; -*/ + if (empty($reshook) && $action != 'remove_file') { @@ -416,7 +416,7 @@ if (empty($reshook) && $action != 'remove_file') $objectlabel='Movements'; $permtoread = $user->rights->stock->lire; $permtodelete = $user->rights->stock->supprimer; - $uploaddir = $conf->stock->dir_output; + $uploaddir = $conf->stock->dir_output . "/movement/"; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -1145,8 +1145,8 @@ else /* * Documents generes */ -/* Area for doc and last events of warehouse are stored on the main card of warehouse -$modulepart='mouvement'; +//Area for doc and last events of warehouse are stored on the main card of warehouse +$modulepart='movement'; if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) { @@ -1183,11 +1183,11 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product + $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product print ''; } -*/ + // End of page llxFooter(); From 49ccdb96027960ad4f583ddf10cc403c35ba9b13 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 05:06:02 +0100 Subject: [PATCH 003/190] Update movement_list.php For it to work you have to create this script htdocs\core\modules\stock\doc\pdf_stdmouvement.modules.php instead htdocs\core\modules\stock\doc\pdf_stdmovement.modules.php this mixture of fr/en confused me and I'm sure you better control the structure to make it work properly it tested & works but with htdocs\core\modules\stock\doc\pdf_stdmouvement.modules.php thx --- htdocs/product/stock/movement_list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ce77f120db4..4435ea98f42 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1160,14 +1160,14 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; if($search_type_mouvement) $objectref.="_".$search_type_mouvement; $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->stock->dir_output . '/movement/' . $objectref; + $filedir = $conf->stock->dir_output . '/' . $modulepart .'/' . $objectref; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; $genallowed=$usercanread; $delallowed=$usercancreate; - $genallowed=$user->rights->stock->mouvement->lire; - $delallowed=$user->rights->stock->mouvement->creer; + $genallowed=$user->rights->stock->lire; + $delallowed=$user->rights->stock->creer; print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); $somethingshown=$formfile->numoffiles; @@ -1183,7 +1183,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) // List of actions on element include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'mouvement', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product + $somethingshown = $formactions->showactions($object, $modulepart, 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product print ''; } From 8546c801a568b73021fa182baf5536b62151845e Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Mon, 28 Jan 2019 05:17:09 +0100 Subject: [PATCH 004/190] to make it work with movement_card.php --- htdocs/product/stock/movement_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 4435ea98f42..b790226cc61 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1031,7 +1031,7 @@ if ($resql) { // Inventory code print ''.'stock->dir_output . "movement/"; -$permissioncreate = $user->rights->stock->creer; -include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - - -if (empty($reshook) && $action != 'remove_file') -{ - $objectclass='MouvementStock'; - $objectlabel='Movements'; - $permtoread = $user->rights->stock->lire; - $permtodelete = $user->rights->stock->supprimer; - $uploaddir = $conf->stock->dir_output . "/movement/"; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; -} - - - /* * View */ @@ -1141,54 +1119,6 @@ else } - -/* - * Documents generes - */ -//Area for doc and last events of warehouse are stored on the main card of warehouse -$modulepart='movement'; - -if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) -{ - print '
'; - print '
'; - print ''; // ancre - - // Documents - $objectref = dol_sanitizeFileName($object->ref); - // Add inventorycode & type_mouvement to filename of the pdf - if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; - if($search_type_mouvement) $objectref.="_".$search_type_mouvement; - $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->stock->dir_output . '/' . $modulepart .'/' . $objectref; - - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; - $genallowed=$usercanread; - $delallowed=$usercancreate; - - $genallowed=$user->rights->stock->lire; - $delallowed=$user->rights->stock->creer; - - print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); - $somethingshown=$formfile->numoffiles; - - print '
'; - - $MAXEVENT = 10; - - $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $modulepart, 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product - - print '
'; -} - - // End of page llxFooter(); $db->close(); From 4624f1b1b84d036b6eac7ca9e747217affef2555 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 6 Feb 2019 17:19:16 +0100 Subject: [PATCH 006/190] FIX positive values creating diff on addline rounding --- htdocs/fourn/class/fournisseur.facture.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 086f154184d..a006b5391b1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1665,9 +1665,9 @@ class FactureFournisseur extends CommonInvoice $this->line->rang=$rang; $this->line->info_bits=$info_bits; $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva= $total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; + $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); + $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); + $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $this->line->special_code=$this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; @@ -1837,11 +1837,11 @@ class FactureFournisseur extends CommonInvoice $line->localtax2_tx = $txlocaltax2; $line->localtax1_type = $localtaxes_type[0]; $line->localtax2_type = $localtaxes_type[2]; - $line->total_ht = $total_ht; - $line->total_tva = $total_tva; + $line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); + $line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); $line->total_localtax1 = $total_localtax1; $line->total_localtax2 = $total_localtax2; - $line->total_ttc = $total_ttc; + $line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $line->fk_product = $idproduct; $line->product_type = $product_type; $line->info_bits = $info_bits; From 288a876491ec67529bc0166ba266ec345fa18234 Mon Sep 17 00:00:00 2001 From: Dan Rusu Date: Mon, 11 Feb 2019 09:14:06 +0200 Subject: [PATCH 007/190] add API method to create credit note from invoice --- .../facture/class/api_invoices.class.php | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 555b6179677..0fb203f50d1 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -839,6 +839,118 @@ class Invoices extends DolibarrApi return $this->_cleanObjectDatas($this->invoice); } + /** + * Make credt note from invoice + * + * @param int $id Invoice ID + * @url POST {id}/makecreditnote + * + * @return array An invoice object + * + * @throws 200 + * @throws 304 + * @throws 401 + * @throws 404 + * @throws 500 + */ + function makecreditnote($id) + { + if(! DolibarrApiAccess::$user->rights->facture->creer) { + throw new RestException(401); + } + + $this->db->begin(); + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->invoice->fetch_thirdparty(); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if (! $object->paye) // protection against multiple submit + { + $this->invoice->fetch_lines(); + + // Boucle sur chaque taux de tva + $i=0; + foreach($this->invoice->lines as $line) + { + $amount_ht[$line->tva_tx]+=$line->total_ht; + $amount_tva[$line->tva_tx]+=$line->total_tva; + $amount_ttc[$line->tva_tx]+=$line->total_ttc; + $i++; + } + + // Insert one discount by VAT rate category + $discount = new DiscountAbsolute($this->db); + if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)'; + elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)'; + else { + $this->error="CantConvertToReducAnInvoiceOfThisType"; + return -1; + } + $discount->tva_tx=abs($this->invoice->total_ttc); + $discount->fk_soc=$this->invoice->socid; + $discount->fk_facture_source=$this->invoice->id; + + $error=0; + foreach($amount_ht as $tva_tx => $xxx) + { + $discount->amount_ht=abs($amount_ht[$tva_tx]); + $discount->amount_tva=abs($amount_tva[$tva_tx]); + $discount->amount_ttc=abs($amount_ttc[$tva_tx]); + $discount->tva_tx=abs($tva_tx); + + $result=$discount->create(DolibarrApiAccess::$user); + if ($result < 0) + { + $error++; + break; + } + } + + if (! $error) + { + // Classe facture + $result=$this->invoice->set_paid(DolibarrApiAccess::$user); + if ($result > 0) + { + //$mesg='OK'.$discount->id; + $this->db->commit(); + } + else + { + throw new RestException(500, 'Could not set paid'); + $this->db->rollback(); + } + } + else + { + throw new RestException(500, 'Discount error'); + $this->db->rollback(); + } + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->invoice); + } + /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount * From 0698ddbd7779a6eec7c546c470d63c8c65e6d1cc Mon Sep 17 00:00:00 2001 From: Dan Rusu Date: Mon, 11 Feb 2019 09:24:16 +0200 Subject: [PATCH 008/190] Revert "add API method to create credit note from invoice" This reverts commit 288a876491ec67529bc0166ba266ec345fa18234. --- .../facture/class/api_invoices.class.php | 112 ------------------ 1 file changed, 112 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 0fb203f50d1..555b6179677 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -839,118 +839,6 @@ class Invoices extends DolibarrApi return $this->_cleanObjectDatas($this->invoice); } - /** - * Make credt note from invoice - * - * @param int $id Invoice ID - * @url POST {id}/makecreditnote - * - * @return array An invoice object - * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 - */ - function makecreditnote($id) - { - if(! DolibarrApiAccess::$user->rights->facture->creer) { - throw new RestException(401); - } - - $this->db->begin(); - - $result = $this->invoice->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Invoice not found'); - } - - if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - - $result = $this->invoice->fetch_thirdparty(); - if( ! $result ) { - throw new RestException(404, 'Thirdparty not found'); - } - - if (! $object->paye) // protection against multiple submit - { - $this->invoice->fetch_lines(); - - // Boucle sur chaque taux de tva - $i=0; - foreach($this->invoice->lines as $line) - { - $amount_ht[$line->tva_tx]+=$line->total_ht; - $amount_tva[$line->tva_tx]+=$line->total_tva; - $amount_ttc[$line->tva_tx]+=$line->total_ttc; - $i++; - } - - // Insert one discount by VAT rate category - $discount = new DiscountAbsolute($this->db); - if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)'; - elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)'; - else { - $this->error="CantConvertToReducAnInvoiceOfThisType"; - return -1; - } - $discount->tva_tx=abs($this->invoice->total_ttc); - $discount->fk_soc=$this->invoice->socid; - $discount->fk_facture_source=$this->invoice->id; - - $error=0; - foreach($amount_ht as $tva_tx => $xxx) - { - $discount->amount_ht=abs($amount_ht[$tva_tx]); - $discount->amount_tva=abs($amount_tva[$tva_tx]); - $discount->amount_ttc=abs($amount_ttc[$tva_tx]); - $discount->tva_tx=abs($tva_tx); - - $result=$discount->create(DolibarrApiAccess::$user); - if ($result < 0) - { - $error++; - break; - } - } - - if (! $error) - { - // Classe facture - $result=$this->invoice->set_paid(DolibarrApiAccess::$user); - if ($result > 0) - { - //$mesg='OK'.$discount->id; - $this->db->commit(); - } - else - { - throw new RestException(500, 'Could not set paid'); - $this->db->rollback(); - } - } - else - { - throw new RestException(500, 'Discount error'); - $this->db->rollback(); - } - } - - $result = $this->invoice->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Invoice not found'); - } - - if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - - return $this->_cleanObjectDatas($this->invoice); - } - /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount * From 9ce4b91f5d17e07617abe5c818f7b49289b39fa2 Mon Sep 17 00:00:00 2001 From: Dan Rusu Date: Mon, 11 Feb 2019 09:31:43 +0200 Subject: [PATCH 009/190] NEW | make credit note from invoice inspired from the action of the button "Make credit note" from UI. - load invoice data and lines - check invoice type - calculate totals and create new credit notes - create DiscountAbsolute & commit changes --- .../facture/class/api_invoices.class.php | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 555b6179677..dede6f735c6 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -839,6 +839,118 @@ class Invoices extends DolibarrApi return $this->_cleanObjectDatas($this->invoice); } + /** + * Make credt note from invoice + * + * @param int $id Invoice ID + * @url POST {id}/makecreditnote + * + * @return array An invoice object + * + * @throws 200 + * @throws 304 + * @throws 401 + * @throws 404 + * @throws 500 + */ + function makecreditnote($id) + { + if(! DolibarrApiAccess::$user->rights->facture->creer) { + throw new RestException(401); + } + + $this->db->begin(); + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $result = $this->invoice->fetch_thirdparty(); + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if (! $object->paye) // protection against multiple submit + { + $this->invoice->fetch_lines(); + + // Boucle sur chaque taux de tva + $i=0; + foreach($this->invoice->lines as $line) + { + $amount_ht[$line->tva_tx]+=$line->total_ht; + $amount_tva[$line->tva_tx]+=$line->total_tva; + $amount_ttc[$line->tva_tx]+=$line->total_ttc; + $i++; + } + + // Insert one discount by VAT rate category + $discount = new DiscountAbsolute($this->db); + if ($this->invoice->type == 2) $discount->description='(CREDIT_NOTE)'; + elseif ($this->invoice->type == 3) $discount->description='(DEPOSIT)'; + else { + $this->error="CantConvertToReducAnInvoiceOfThisType"; + return -1; + } + $discount->tva_tx=abs($this->invoice->total_ttc); + $discount->fk_soc=$this->invoice->socid; + $discount->fk_facture_source=$this->invoice->id; + + $error=0; + foreach($amount_ht as $tva_tx => $xxx) + { + $discount->amount_ht=abs($amount_ht[$tva_tx]); + $discount->amount_tva=abs($amount_tva[$tva_tx]); + $discount->amount_ttc=abs($amount_ttc[$tva_tx]); + $discount->tva_tx=abs($tva_tx); + + $result=$discount->create(DolibarrApiAccess::$user); + if ($result < 0) + { + $error++; + break; + } + } + + if (! $error) + { + // Classe facture + $result=$this->invoice->set_paid(DolibarrApiAccess::$user); + if ($result > 0) + { + //$mesg='OK'.$discount->id; + $this->db->commit(); + } + else + { + throw new RestException(500, 'Could not set paid'); + $this->db->rollback(); + } + } + else + { + throw new RestException(500, 'Discount error'); + $this->db->rollback(); + } + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->invoice); + } + /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount * From 57e2971a22ad350b96e2a1bc8f303d909e9d7d41 Mon Sep 17 00:00:00 2001 From: Dan Rusu Date: Mon, 11 Feb 2019 19:58:01 +0200 Subject: [PATCH 010/190] fix code indent --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index dede6f735c6..8fbfa34bce9 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -866,7 +866,7 @@ class Invoices extends DolibarrApi throw new RestException(404, 'Invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -944,7 +944,7 @@ class Invoices extends DolibarrApi throw new RestException(404, 'Invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } From 45d05da6ed7d563b44c8b0e77c3e2d5c5a918d6a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 14 Feb 2019 16:14:19 +0100 Subject: [PATCH 011/190] FIX missing $ismultientitymanaged for previous/next ref --- htdocs/product/stock/class/entrepot.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index add121b902e..850c652c59f 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -36,6 +36,7 @@ class Entrepot extends CommonObject public $element='stock'; public $table_element='entrepot'; public $picto='stock'; + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** * Warehouse closed, inactive @@ -716,7 +717,7 @@ class Entrepot extends CommonObject return $TChildWarehouses; } - + /** * Create object on disk * From d31aadf5dab74fd1cba6f8b5fb53d34db57b01a6 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 15 Feb 2019 05:20:33 +0100 Subject: [PATCH 012/190] Add Default Warehouse to user --- htdocs/user/class/user.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a6bc202d17f..451a5abda80 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -173,6 +173,8 @@ class User extends CommonObject public $default_c_exp_tax_cat; public $default_range; + + public $fk_warehouse; public $fields = array( 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), @@ -248,6 +250,7 @@ class User extends CommonObject $sql.= " u.weeklyhours,"; $sql.= " u.color,"; $sql.= " u.dateemployment, u.dateemploymentend,"; + $sql.= " u.fk_warehouse,"; $sql.= " u.ref_int, u.ref_ext,"; $sql.= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode $sql.= " c.code as country_code, c.label as country,"; @@ -368,6 +371,7 @@ class User extends CommonObject $this->default_range = $obj->default_range; $this->default_c_exp_tax_cat = $obj->default_c_exp_tax_cat; + $this->fk_warehouse = $obj->fk_warehouse; // Protection when module multicompany was set, admin was set to first entity and then, the module was disabled, // in such case, this admin user must be admin for ALL entities. @@ -1482,6 +1486,7 @@ class User extends CommonObject $this->color = empty($this->color)?'':$this->color; $this->dateemployment = empty($this->dateemployment)?'':$this->dateemployment; $this->dateemploymentend = empty($this->dateemploymentend)?'':$this->dateemploymentend; + $this->fk_warehouse = trim(empty($this->fk_warehouse)?'':$this->fk_warehouse); // Check parameters if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -1539,6 +1544,7 @@ class User extends CommonObject $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); $sql.= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); + $sql.= ", fk_warehouse = ".($this->fk_warehouse?"'".$this->db->escape($this->fk_warehouse)."'":"null"); $sql.= " WHERE rowid = ".$this->id; @@ -1977,7 +1983,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } -$mailfile = new CMailFile( + $mailfile = new CMailFile( $subject, $this->email, $conf->global->MAIN_MAIL_EMAIL_FROM, From 4dc4a25bb500fb0683f61e9484b2fc0a3af454d6 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 15 Feb 2019 05:24:25 +0100 Subject: [PATCH 013/190] Add Default Warehouse to user card --- htdocs/user/card.php | 46 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 63a2a598d41..f4482a9e872 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -48,6 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -91,7 +92,7 @@ $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); // Load translation files required by page -$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm')); +$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks')); $object = new User($db); $extrafields = new ExtraFields($db); @@ -237,6 +238,8 @@ if (empty($reshook)) { $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth'), GETPOST('dateemploymentendday'), GETPOST('dateemploymentendyear')); $object->dateemploymentend = $dateemploymentend; + $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels, $object); if ($ret < 0) { @@ -383,6 +386,8 @@ if (empty($reshook)) { $object->dateemployment = $dateemployment; $dateemploymentend = dol_mktime(0, 0, 0, GETPOST('dateemploymentendmonth', 'int'), GETPOST('dateemploymentendday', 'int'), GETPOST('dateemploymentendyear', 'int')); $object->dateemploymentend = $dateemploymentend; + + $object->fk_warehouse = GETPOST('fk_warehouse', 'int'); if (! empty($conf->multicompany->enabled)) { @@ -639,6 +644,7 @@ $form = new Form($db); $formother=new FormOther($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); +$formproduct = new FormProduct($db); llxHeader('', $langs->trans("UserCard")); @@ -1104,7 +1110,8 @@ if ($action == 'create' || $action == 'adduserldap') { print '' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); - print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%'); + print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, + null, '90%' ); print ""; } @@ -1165,6 +1172,10 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print ''; + // Default warehouse + print ''.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ''; if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) @@ -1517,6 +1528,14 @@ else print ''.$langs->trans("PostOrFunction").''; print ''.$object->job.''; print ''."\n"; + + // Default warehouse + require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php'; + $warehousestatic=new Entrepot($db); + $warehousestatic->fetch($object->fk_warehouse); + print ''.$langs->trans("DefaultWarehouse").''; + print $warehousestatic->getNomUrl(); + print ''; //$childids = $user->getAllChildIds(1); @@ -1611,9 +1630,9 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '' . $langs->trans("Categories") . ''; + print '' . $langs->trans( "Categories" ) . ''; print ''; - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories( $object->id, 'user', 1 ); print ''; } @@ -2378,21 +2397,21 @@ else print ''; // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) + if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) { print '' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . ''; print ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER, null, null, null, null, 1); - $c = new Categorie($db); + $cate_arbo = $form->select_all_categories( Categorie::TYPE_USER, null, null, null, null, 1 ); + $c = new Categorie( $db ); $cats = $c->containing($object->id, Categorie::TYPE_USER); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } if ($caneditfield) { - print $form->multiselectarray('usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print $form->multiselectarray( 'usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' ); }else{ - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories( $object->id, 'user', 1 ); } print ""; } @@ -2518,6 +2537,15 @@ else print $object->job; } print ''; + + // Default warehouse + if (! empty($conf->stock->enabled)) + { + print ''.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ' '.$langs->trans("AddWarehouse").''; + print ''; + } if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) From fd4f82b1b72828d06ba3b13c77ec21edc513cb5c Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 15 Feb 2019 05:32:01 +0100 Subject: [PATCH 014/190] Fix conflict --- htdocs/user/card.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f4482a9e872..fc6d7793330 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1110,8 +1110,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . ''; $cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1); - print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, - null, '90%' ); + print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null, null, '90%'); print ""; } @@ -1630,9 +1629,9 @@ else // Categories if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { - print '' . $langs->trans( "Categories" ) . ''; + print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories( $object->id, 'user', 1 ); + print $form->showCategories($object->id, 'user', 1); print ''; } @@ -2397,21 +2396,21 @@ else print ''; // Categories - if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print '' . $form->editfieldkey('Categories', 'usercats', '', $object, 0) . ''; print ''; - $cate_arbo = $form->select_all_categories( Categorie::TYPE_USER, null, null, null, null, 1 ); - $c = new Categorie( $db ); + $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER, null, null, null, null, 1); + $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_USER); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } if ($caneditfield) { - print $form->multiselectarray( 'usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%' ); + print $form->multiselectarray('usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); }else{ - print $form->showCategories( $object->id, 'user', 1 ); + print $form->showCategories($object->id, 'user', 1); } print ""; } From 03c5e040c59691fc532eaa36957e5c7b786fe56d Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 15 Feb 2019 05:48:56 +0100 Subject: [PATCH 015/190] Fix backtopage url --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index fc6d7793330..ff4253df646 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2542,7 +2542,7 @@ else { print ''.$langs->trans("DefaultWarehouse").''; print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); - print ' '.$langs->trans("AddWarehouse").''; + print ' '.$langs->trans("AddWarehouse").''; print ''; } From 63ffb7a87341a1024fa6b888fe78e044e0f8aae8 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 15 Feb 2019 06:04:58 +0100 Subject: [PATCH 016/190] Fix backtopage url --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ff4253df646..84d83acf483 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2542,7 +2542,7 @@ else { print ''.$langs->trans("DefaultWarehouse").''; print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); - print ' '.$langs->trans("AddWarehouse").''; + print ' '.$langs->trans("AddWarehouse").''; print ''; } From 70f1a9d13d63d7e6392fd1392d5a718a6557c6d5 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 15 Feb 2019 11:26:29 +0100 Subject: [PATCH 017/190] FIX : we want to be able to reopen fourn credit note --- htdocs/fourn/facture/card.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bbec3ea6ed6..c6f6d560f34 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3014,8 +3014,13 @@ else print ''; } + $discount = new DiscountAbsolute($db); + $result = $discount->fetch(0, 0, $object->id); + // Reopen a standard paid invoice - if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) + if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT + || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && empty($discount->id))) + && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely) { if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer) // Not replaced by another invoice { From 8390ed346bd6d2909e18dafb660f1b0439bc25b4 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Fri, 15 Feb 2019 17:12:39 +0100 Subject: [PATCH 018/190] Hidden for users not using the stock module --- htdocs/user/card.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 84d83acf483..048ee72e688 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -48,7 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; if (! empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -644,7 +644,7 @@ $form = new Form($db); $formother=new FormOther($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); -$formproduct = new FormProduct($db); +if (! empty($conf->stock->enabled)) $formproduct = new FormProduct($db); llxHeader('', $langs->trans("UserCard")); @@ -1172,9 +1172,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; // Default warehouse - print ''.$langs->trans("DefaultWarehouse").''; - print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); - print ''; + if (! empty($conf->stock->enabled)) + { + print ''.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); + print ''; + } if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->hrm->enabled) && ! empty($user->rights->hrm->employee->read))) @@ -1529,12 +1532,15 @@ else print ''."\n"; // Default warehouse - require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php'; - $warehousestatic=new Entrepot($db); - $warehousestatic->fetch($object->fk_warehouse); - print ''.$langs->trans("DefaultWarehouse").''; - print $warehousestatic->getNomUrl(); - print ''; + if (! empty($conf->stock->enabled)) + { + require_once DOL_DOCUMENT_ROOT .'/product/stock/class/entrepot.class.php'; + $warehousestatic=new Entrepot($db); + $warehousestatic->fetch($object->fk_warehouse); + print ''.$langs->trans("DefaultWarehouse").''; + print $warehousestatic->getNomUrl(); + print ''; + } //$childids = $user->getAllChildIds(1); @@ -2543,7 +2549,7 @@ else print ''.$langs->trans("DefaultWarehouse").''; print $formproduct->selectWarehouses($object->fk_warehouse, 'fk_warehouse', 'warehouseopen', 1); print ' '.$langs->trans("AddWarehouse").''; - print ''; + print ''; } if ((! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) From b017213131e278ab1603d0e1a78402bed704e100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 17 Feb 2019 20:59:39 +0100 Subject: [PATCH 019/190] selectMulticurrency avoid malformed empty value --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 58df0ad4e22..c451a83a4fb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4517,7 +4517,7 @@ class Form $out=''; $out.= ''; +print ''; + +// Define main accounts for closure +print ''; + +foreach ($list_account_main as $key) { + + print ''; + // Param + $label = $langs->trans($key); + $keydesc=$key.'_Desc'; + + $htmltext = $langs->trans($keydesc); + print ''; + // Value + print ''; + print ''; +} + +// Journal +print ''; +print ''; +print ''; + +print "
'; + print $form->textwithpicto($label, $htmltext); + print ''; // Do not force align=right, or it align also the content of the select box + print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); + print '
' . $langs->trans("ACCOUNTING_CLOSURE_DEFAULT_JOURNAL") . ''; +$defaultjournal=$conf->global->ACCOUNTING_CLOSURE_DEFAULT_JOURNAL; +print $formaccounting->select_journal($defaultjournal, "ACCOUNTING_CLOSURE_DEFAULT_JOURNAL", 9, 1, 0, 0); +print '
\n"; + +print '
'; + +print ''; + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index fc5f5980df5..5b39a38657f 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -53,8 +53,6 @@ $list_account_main = array ( ); $list_account = array ( - 'ACCOUNTING_RESULT_PROFIT', - 'ACCOUNTING_RESULT_LOSS', 'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 028e6569378..a5b0a574c35 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -89,7 +89,7 @@ class FormAccounting extends Form $sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal"; $sql.= " WHERE active = 1"; $sql.= " AND entity = ".$conf->entity; - //if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature; + if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature; $sql.= " ORDER BY code"; dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG); diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index f49c4cb6027..50d1862f39f 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -249,7 +249,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 54, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2463__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 55, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2464__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2464__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_export', 2451__+MAX_llx_menu__, '/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'ExportOptions', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2465__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_closure', 2451__+MAX_llx_menu__, '/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuClosureAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__); -- Accounting period insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__); -- Binding diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7a43aa43d60..ab2599728d8 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1058,6 +1058,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 55); $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 60); + $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 70); // Fiscal year if ($conf->global->MAIN_FEATURES_LEVEL > 1) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 1a153d1f80d..014cc9827f9 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -96,6 +96,7 @@ MenuTaxAccounts=Tax accounts MenuExpenseReportAccounts=Expense report accounts MenuLoanAccounts=Loan accounts MenuProductsAccounts=Product accounts +MenuClosureAccounts=Closure accounts ProductsBinding=Products accounts Ventilation=Binding to accounts CustomersVentilation=Customer invoice binding @@ -149,8 +150,9 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal -ACCOUNTING_RESULT_PROFIT=Accounting account of profit result -ACCOUNTING_RESULT_LOSS=Accounting account of loss result +ACCOUNTING_RESULT_PROFIT=Result accounting account (Profit) +ACCOUNTING_RESULT_LOSS=Result accounting account (Loss) +ACCOUNTING_CLOSURE_DEFAULT_JOURNAL=Journal of closure ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transfer ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait @@ -289,6 +291,7 @@ ChartofaccountsId=Chart of accounts Id InitAccountancy=Init accountancy InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accounting account defined for sales and purchases. DefaultBindingDesc=This page can be used to set a default account to use to link transactions record about payment salaries, donation, taxes and vat when no specific accounting account were already set. +DefaultClosureDesc=This page can be used to set accounts to use to enclose a balance sheet. Options=Options OptionModeProductSell=Mode sales OptionModeProductBuy=Mode purchases From f5b5859089958d21c8019958aeb4ce669c41105d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 18 Feb 2019 07:16:00 +0100 Subject: [PATCH 022/190] Language --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 014cc9827f9..86c510dfe00 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -291,7 +291,7 @@ ChartofaccountsId=Chart of accounts Id InitAccountancy=Init accountancy InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accounting account defined for sales and purchases. DefaultBindingDesc=This page can be used to set a default account to use to link transactions record about payment salaries, donation, taxes and vat when no specific accounting account were already set. -DefaultClosureDesc=This page can be used to set accounts to use to enclose a balance sheet. +DefaultClosureDesc=This page can be used to set parameters to use to enclose a balance sheet. Options=Options OptionModeProductSell=Mode sales OptionModeProductBuy=Mode purchases From ad7b8371dae4868273fb12645129a15654d35bfe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Feb 2019 18:27:06 +0100 Subject: [PATCH 023/190] FIX Mark credit note as available for credit note in other currency Conflicts: htdocs/compta/paiement.php htdocs/core/class/discount.class.php --- htdocs/compta/facture/card.php | 3 ++- htdocs/compta/paiement.php | 23 +++++++++++-------- .../compta/paiement/class/paiement.class.php | 9 +++++++- htdocs/core/class/discount.class.php | 8 +++++-- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 73b2bfdb314..6568ac03eba 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -688,6 +688,7 @@ if (empty($reshook)) $db->begin(); $amount_ht = $amount_tva = $amount_ttc = array(); + $multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array(); // Loop on each vat rate $i = 0; @@ -701,7 +702,7 @@ if (empty($reshook)) $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht; $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva; $multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc; - $i ++; + $i++; } } diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index c2ce95dd827..805bdbdf79e 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -250,11 +250,14 @@ if (empty($reshook)) $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement','code','id',1); - $paiement->num_paiement = GETPOST('num_paiement'); - $paiement->note = GETPOST('comment'); + $paiement->num_paiement = GETPOST('num_paiement', 'alpha'); + $paiement->note = GETPOST('comment', 'alpha'); + if (! $error) { + // Create payment and update this->multicurrency_amounts if this->amounts filled or + // this->amounts if this->multicurrency_amounts filled. $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents if ($paiement_id < 0) { @@ -279,7 +282,7 @@ if (empty($reshook)) { $db->commit(); - // If payment dispatching on more than one invoice, we keep on summary page, otherwise jump on invoice card + // If payment dispatching on more than one invoice, we stay on summary page, otherwise jump on invoice card $invoiceid=0; foreach ($paiement->amounts as $key => $amount) { @@ -649,12 +652,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print ''; - // Multicurrency Price + // Multicurrency remain to pay print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); print ''; - print ''; + print ''; // Add remind multicurrency amount $namef = 'multicurrency_amount_'.$objp->facid; @@ -666,12 +669,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { if (!empty($conf->use_javascript_ajax)) print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); + print ''; print ''; - print ''; } else { - print ''; + print ''; print ''; } } @@ -692,7 +695,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie //$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)); // Amount - print ''; + print ''; // Add remind amount $namef = 'amount_'.$objp->facid; @@ -702,12 +705,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { if (!empty($conf->use_javascript_ajax)) print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); + print ''; print ''; - print ''; } else { - print ''; + print ''; print ''; } print ""; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 539c70f591b..65574f31591 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -292,6 +292,7 @@ class Paiement extends CommonObject if ($invoice->type == Facture::TYPE_DEPOSIT) { $amount_ht = $amount_tva = $amount_ttc = array(); + $multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array(); // Insert one discount by VAT rate category $discount = new DiscountAbsolute($this->db); @@ -310,6 +311,9 @@ class Paiement extends CommonObject $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; $amount_ttc[$line->tva_tx] += $line->total_ttc; + $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht; + $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva; + $multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc; $i++; } } @@ -318,6 +322,9 @@ class Paiement extends CommonObject $discount->amount_ht = abs($amount_ht[$tva_tx]); $discount->amount_tva = abs($amount_tva[$tva_tx]); $discount->amount_ttc = abs($amount_ttc[$tva_tx]); + $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); + $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); + $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); $discount->tva_tx = abs($tva_tx); $result = $discount->create($user); @@ -995,7 +1002,7 @@ class Paiement extends CommonObject /** * get the right way of payment * - * @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs + * @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs */ function getWay() { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index e3098911418..cfe7ac24dea 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -33,10 +33,14 @@ class DiscountAbsolute public $id; // Id discount public $fk_soc; - public $discount_type; // 0 => customer discount, 1 => supplier discount - public $amount_ht; // + + public $discount_type; // 0 => customer discount, 1 => supplier discount + public $amount_ht; // public $amount_tva; // public $amount_ttc; // + public $multicurrency_amount_ht; + public $multicurrency_amount_tva; + public $multicurrency_amount_ttc; public $tva_tx; // Vat rate public $fk_user; // Id utilisateur qui accorde la remise public $description; // Description libre From c22be202d9d16022efa87c4752170a2fda3e3f09 Mon Sep 17 00:00:00 2001 From: bomuux Date: Mon, 18 Feb 2019 23:17:03 +0100 Subject: [PATCH 024/190] SQL error in box_project.php Corrected a bug : for an internal user with no rights to see all projects, the project box on home cause an error in log. Finally a lot of simplification because Project::getProjectsAuthorizedForUser do most of the filtering. --- htdocs/core/boxes/box_project.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 7ab97832637..a969d2126e6 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -89,21 +89,14 @@ class box_project extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $projectstatic = new Project($this->db); - $socid=$user->societe_id; - - // Get list of project id allowed to user (in a string list separated by coma) + // Get list of project id allowed to user (in a string list separated by coma) $projectsListId=''; - if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); + if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $user->socid); $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; - if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; - $sql.= " WHERE p.entity IN (".getEntity('project').')'; - if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users - if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; - $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; + $sql.= " WHERE p.fk_statut = 1"; // Only open projects + if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users $sql.= " ORDER BY p.datec DESC"; //$sql.= $db->plimit($max, 0); From 226b1e24888501963ac36d630079323d9510bd3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Feb 2019 14:01:08 +0100 Subject: [PATCH 025/190] Fix error management --- htdocs/multicurrency/class/multicurrency.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 549f0fd411a..84833e38070 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -631,7 +631,7 @@ class MultiCurrency extends CommonObject */ public static function syncRates($response) { - global $db,$conf; + global $conf, $db, $langs; $ch = curl_init('http://apilayer.net/api/live?access_key='.$key.''); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); From 7fdf4be7dda28a897186655ca99ef5b79caa144c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Feb 2019 14:02:17 +0100 Subject: [PATCH 026/190] Bad return of error --- htdocs/multicurrency/class/multicurrency.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 84833e38070..b77e94021fe 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -624,10 +624,10 @@ class MultiCurrency extends CommonObject } /** - * Sync rates from api + * Sync rates from api * - * @param array $response array of reponse from api to sync dolibarr rates - * @return void + * @param array $response array of reponse from api to sync dolibarr rates + * @return void */ public static function syncRates($response) { @@ -639,9 +639,8 @@ class MultiCurrency extends CommonObject curl_close($ch); $response = json_decode($response); - if ($response->success) - { - + if ($response->success) + { $TRate = $response->quotes; $timestamp = $response->timestamp; From d3627c143808a01ba73979876ec05686e0b77216 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 15:49:54 +0100 Subject: [PATCH 027/190] NEW options for alternative method payment request api (ex apple pay) and sepa direct debit --- htdocs/stripe/admin/stripe.php | 56 ++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 100a85f6c30..056c993bcec 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov - * Copyright (C) 2018 ptibogxiv + * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -78,9 +78,6 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); - if (! $result > 0) - $error ++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; @@ -166,17 +163,11 @@ print "\n"; print ''; print ''; print $langs->trans("StripeLiveEnabled").''; -if (!empty($conf->global->STRIPE_LIVE)) -{ - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; -} -else -{ - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_LIVE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); } print ''; @@ -272,16 +263,36 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? print ''; } -// Minimal amount for force 3Dsecure if it's optionnal +// Activate Payment Request API +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code +{ + print ''; + print $langs->trans("STRIPE_PAYMENT_REQUEST_API").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); +} + print ''; +} + +// Activate SEPA DIRECT_DEBIT if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code { print ''; - print $langs->trans("STRIPE_MINIMAL_3DSECURE").''; - print ''.$langs->getCurrencySymbol($conf->currency).''; + print $langs->trans("STRIPE_SEPA_DIRECT_DEBIT").''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('STRIPE_SEPA_DIRECT_DEBIT'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); +} + print ''; } // Warehouse for automatic decrement -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment { print ''; print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; @@ -329,7 +340,12 @@ print ''; print ''; print $langs->trans("SecurityTokenIsUnique").''; -print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE", (empty($conf->global->PAYMENT_SECURITY_TOKEN)?0:$conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE), 1); +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PAYMENT_SECURITY_TOKEN_UNIQUE'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PAYMENT_SECURITY_TOKEN_UNIQUE", $arrval, $conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE); +} print ''; print ''; From 97620e91c948c65808ea01cd490a0d3eaa0fccc5 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 16:31:39 +0100 Subject: [PATCH 028/190] add link to webhook --- htdocs/stripe/admin/stripe.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 056c993bcec..dc63efbd99b 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -2,7 +2,7 @@ /* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov - * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2018 ptibogxiv * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -186,9 +186,14 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; - print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; + print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; + $url = dol_buildpath('/public/stripe/ipn.php?test', 2); + $out.= ''; + $out.= ajax_autoselect("onlinetestwebhookurl", 0); + print '
'.$out; print ''; } else { print ''.$langs->trans("StripeConnect").''; @@ -216,9 +221,14 @@ if (empty($conf->stripeconnect->enabled)) print ''; print ''; - print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; + print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; + $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").'
'; + $url = dol_buildpath('/public/stripe/ipn.php', 2); + $out.= ''; + $out.= ajax_autoselect("onlinelivewebhookurl", 0); + print '
'.$out; print ''; } else From 2c5956907400e0d2c5c57e4481fd00f62696c60a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 19 Feb 2019 17:02:07 +0100 Subject: [PATCH 029/190] update with html5 compliant code --- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 7dab385681a..d63df9f87b9 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -51,7 +51,7 @@ foreach($linkedObjectBlock as $key => $objectlink) getNomUrl(1); ?> date_contrat, 'day'); ?> - $objectlink) } echo price($totalcontrat); } ?> - getLibStatut(7); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + getLibStatut(7); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> From 5b7294e9e18b2f221b19d9da24ec7dcae43a0e16 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 19 Feb 2019 17:06:25 +0100 Subject: [PATCH 030/190] update with html5 compliant code --- htdocs/contrat/card.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 40242ee8068..799c06564df 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1563,14 +1563,14 @@ else print ''; print ''.$langs->trans("ServiceNb", $cursorline).''; print ''.$langs->trans("VAT").''; - print ''.$langs->trans("PriceUHT").''; + print ''.$langs->trans("PriceUHT").''; if (!empty($conf->multicurrency->enabled)) { - print ''.$langs->trans("PriceUHTCurrency").''; + print ''.$langs->trans("PriceUHTCurrency").''; } print ''.$langs->trans("Qty").''; - if ($conf->global->PRODUCT_USE_UNITS) print ''.$langs->trans("Unit").''; - print ''.$langs->trans("ReductionShort").''; - if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''.$langs->trans("BuyingPrice").''; + if ($conf->global->PRODUCT_USE_UNITS) print ''.$langs->trans("Unit").''; + print ''.$langs->trans("ReductionShort").''; + if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''.$langs->trans("BuyingPrice").''; print ' '; print "\n"; @@ -1618,10 +1618,10 @@ else print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits); print ''; // Price - print ''.($objp->subprice != '' ? price($objp->subprice) : '')."\n"; + print ''.($objp->subprice != '' ? price($objp->subprice) : '')."\n"; // Price multicurrency if (!empty($conf->multicurrency->enabled)) { - print ''.price($objp->multicurrency_subprice).''; + print ''.price($objp->multicurrency_subprice).''; } // Quantite print ''.$objp->qty.''; @@ -1630,7 +1630,7 @@ else // Remise if ($objp->remise_percent > 0) { - print ''.$objp->remise_percent."%\n"; + print ''.$objp->remise_percent."%\n"; } else { @@ -1641,7 +1641,7 @@ else if (! empty($conf->margin->enabled) && ! empty($conf->global->MARGIN_SHOW_ON_CONTRACT)) print ''.price($objp->pa_ht).''; // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) - print ''; + print ''; if ($user->rights->contrat->creer && count($arrayothercontracts) && ($object->statut >= 0)) { print ''; @@ -1746,10 +1746,10 @@ else $doleditor->Create(); print ''; - print ''; + print ''; print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1); print ''; - print ''; + print ''; print ''; if ($conf->global->PRODUCT_USE_UNITS) { @@ -1757,10 +1757,10 @@ else print $form->selectUnits($objp->fk_unit, "unit"); print ''; } - print '%'; + print '%'; if (! empty($usemargins)) { - print ''; + print ''; if ($objp->fk_product) print ''; print ''; } @@ -1880,7 +1880,7 @@ else print ''; print ''.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; - print ''; + print ''; if ($user->societe_id == 0) { if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline') From f24356ae10b646a892112f4de9877ea5e99fa5cb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 19 Feb 2019 17:08:35 +0100 Subject: [PATCH 031/190] update with html5 compliant code --- htdocs/contrat/index.php | 24 ++++++++++++------------ htdocs/contrat/list.php | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index dfcb1e8457c..05135f39aeb 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -189,7 +189,7 @@ foreach($listofstatus as $status) print ''; print ''.$staticcontratligne->LibStatut($status, 0, ($bool?1:0)).''; - print ''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).''; + print ''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).''; print "\n"; } if ($status==4 && ! $bool) $bool=true; @@ -218,15 +218,15 @@ foreach($listofstatus as $status) { print ''; print ''.$staticcontratligne->LibStatut($status, 0, ($bool?1:0)).''; - print ''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).''; + print ''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status, 3, ($bool?1:0)).''; if ($status==4 && ! $bool) $bool=true; else $bool=false; print "\n"; } } //if ($totalinprocess != $total) -//print ''.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')'.$totalinprocess.''; -print ''.$langs->trans("Total").''.$total.''; +//print ''.$langs->trans("Total").' ('.$langs->trans("ServicesRunning").')'.$totalinprocess.''; +print ''.$langs->trans("Total").''.$total.''; print "
"; @@ -332,7 +332,7 @@ if ($result) print ''.$langs->trans("LastContracts", 5).''; print ''.$langs->trans("DateModification").''; - //print ''.$langs->trans("Status").''; + //print ''.$langs->trans("Status").''; print ''.$langs->trans("Services").''; print "\n"; @@ -354,10 +354,10 @@ if ($result) print ''; print ''.dol_print_date($db->jdate($obj->tms), 'dayhour').''; //print ''.$staticcontrat->LibStatut($obj->statut,2).''; - print ''.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3):'').''; - print ''.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0):'').''; - print ''.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1):'').''; - print ''.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3):'').''; + print ''.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0, 3):'').''; + print ''.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4, 3, 0):'').''; + print ''.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4, 3, 1):'').''; + print ''.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5, 3):'').''; print "\n"; $i++; } @@ -432,7 +432,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; + print ''; $dateend=$db->jdate($obj->date_fin_validite); print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0); print ''; @@ -511,7 +511,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; + print ''; print $staticcontratligne->LibStatut($obj->statut, 3); print ''; print "\n"; @@ -590,7 +590,7 @@ if ($resql) $staticcompany->name=$obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''; + print ''; print $staticcontratligne->LibStatut($obj->statut, 3, 1); print ''; print "\n"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 24dccaae25d..fb2422b7762 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -559,7 +559,7 @@ if (! empty($arrayfields['lower_planned_end_date']['checked'])) // Status if (! empty($arrayfields['status']['checked'])) { - print ''; + print ''; } print ''; $searchpicto=$form->showFilterButtons(); From 3a2b5e28c4ef7fa6944498968aa8bcc81822d2a5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 19 Feb 2019 17:17:11 +0100 Subject: [PATCH 032/190] update with html5 compliant code --- htdocs/contrat/services_list.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 68f8595c294..f2d827b87cb 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -394,7 +394,7 @@ $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // N print $hookmanager->resPrint; if (! empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'], $_SERVER["PHP_SELF"], "cd.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); if (! empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'], $_SERVER["PHP_SELF"], "cd.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, 'align="right"', $sortfield, $sortorder); +if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "cd.statut,c.statut", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -511,7 +511,7 @@ if (! empty($arrayfields['cd.tms']['checked'])) if (! empty($arrayfields['status']['checked'])) { // Status - print ''; + print ''; $arrayofstatus=array( '0'=>$langs->trans("ServiceStatusInitial"), '4'=>$langs->trans("ServiceStatusRunning"), @@ -523,7 +523,7 @@ if (! empty($arrayfields['status']['checked'])) print ''; } // Action column -print ''; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -589,7 +589,7 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['cd.total_ht']['checked'])) { - print ''; + print ''; print price($obj->total_ht); print ''; $totalarray['totalht'] += $obj->total_ht; @@ -601,7 +601,7 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['cd.total_tva']['checked'])) { - print ''; + print ''; print price($obj->total_tva); print ''; $totalarray['totalvat'] += $obj->total_tva; @@ -613,14 +613,14 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['cd.tva_tx']['checked'])) { - print ''; + print ''; print price2num($obj->tva_tx).'%'; print ''; if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['cd.subprice']['checked'])) { - print ''; + print ''; print price($obj->subprice); print ''; if (! $i) $totalarray['nbfield']++; @@ -698,7 +698,7 @@ while ($i < min($num, $limit)) // Status if (! empty($arrayfields['status']['checked'])) { - print ''; + print ''; if ($obj->cstatut == 0) // If contract is draft, we say line is also draft { print $contractstatic->LibStatut(0, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)); @@ -735,9 +735,9 @@ if (isset($totalarray['displaytotalline'])) { if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; else print ''; } print ''; From 047ec90d78fd32f6348c73aabb14d4c0b091b972 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 19 Feb 2019 17:38:14 +0100 Subject: [PATCH 033/190] update with html5 compliant code --- htdocs/core/ajax/ajaxdirtree.php | 10 ++--- htdocs/core/class/html.formmail.class.php | 2 +- htdocs/core/class/html.formmargin.class.php | 42 ++++++++++----------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 1e5e31b4385..46a5e0e6d7d 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -425,7 +425,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, print '';*/ // Nb of docs - print ''; + print ''; print (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:' '; print ''; print ''; @@ -433,19 +433,19 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, print ''; // Edit link - print ''.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').''; // Add link - //print ''.img_edit_add().''; - //print ' '; + //print ''.img_edit_add().''; + //print ' '; // Info if ($modulepart == 'ecm') { - print ''; + print ''; $userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0; $userstatic->lastname=isset($val['login_c'])?$val['login_c']:0; $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].'
'; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 752d2406ea4..f983565250b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -455,7 +455,7 @@ class FormMail extends Form } if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this. { - $out.= ''; + $out.= ''; //$out.='
'; if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // New usage diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index cce12ae5f8b..5aecb6efc71 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -223,16 +223,16 @@ class FormMargin print ''; print ''; print ''; - print ''; + print ''; if ($conf->global->MARGIN_TYPE == "1") - print ''; + print ''; else - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; if (! empty($conf->product->enabled)) @@ -240,13 +240,13 @@ class FormMargin //if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; } @@ -254,13 +254,13 @@ class FormMargin { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; } @@ -268,13 +268,13 @@ class FormMargin { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print ''; + print ''; if (! empty($conf->global->DISPLAY_MARK_RATES)) - print ''; + print ''; print ''; } print '
'.$langs->trans('Margins').''.$langs->trans('SellingPrice').''.$langs->trans('SellingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('BuyingPrice').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('CostPrice').''.$langs->trans('Margin').''.$langs->trans('MarginRate').''.$langs->trans('MarginRate').''.$langs->trans('MarkRate').''.$langs->trans('MarkRate').'
'.$langs->trans('MarginOnProducts').''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''.price($marginInfo['pv_products'], null, null, null, null, $rounding).''.price($marginInfo['pa_products'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').'
'.$langs->trans('MarginOnServices').''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''.price($marginInfo['pv_services'], null, null, null, null, $rounding).''.price($marginInfo['pa_services'], null, null, null, null, $rounding).''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').'
'.$langs->trans('TotalMargin').''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''.price($marginInfo['total_margin'], null, null, null, null, $rounding).''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').'
'; From d83b77432d1c158cddd51232df597841910f555f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 19 Feb 2019 17:42:12 +0100 Subject: [PATCH 034/190] update with html5 compliant code --- .../browser/default/frmresourceslist.php | 2 +- htdocs/core/lib/admin.lib.php | 6 +++--- htdocs/core/lib/agenda.lib.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php index f7df05acdde..81f536f5228 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php +++ b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php @@ -101,7 +101,7 @@ oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) sLink + fileName + '<\/a>' + - '<\/td> ' + + '<\/td> ' + fileSize + ' KB' + '<\/td><\/tr>' ; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index b58c9107cf8..004762d2810 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -367,7 +367,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle $listofinsertedrowid[$cursorinsert]=$insertedrowid; dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG); } - // print 'OK'; + // print 'OK'; } else { @@ -410,13 +410,13 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if ($error == 0) { if (! $silent) print ''.$langs->trans("ProcessMigrateScript").''; - if (! $silent) print ''.$langs->trans("OK").''."\n"; + if (! $silent) print ''.$langs->trans("OK").''."\n"; $ok = 1; } else { if (! $silent) print ''.$langs->trans("ProcessMigrateScript").''; - if (! $silent) print ''.$langs->trans("KO").''."\n"; + if (! $silent) print ''.$langs->trans("KO").''."\n"; $ok = 0; } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index c24cc0928ed..531b90b75e3 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -239,7 +239,7 @@ function show_array_actions_to_do($max = 5) print ''; print ''; - print ''; + print ''; print ''; $var = true; @@ -276,7 +276,7 @@ function show_array_actions_to_do($max = 5) $datep2=$db->jdate($obj->dp2); // Date - print '"; // Statut - print "\n"; + print '\n"; print "\n"; @@ -336,7 +336,7 @@ function show_array_last_actions_done($max = 5) print '
'.$langs->trans("LastActionsToDo", $max).''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.dol_print_date($datep, 'day').' '; + print ''.dol_print_date($datep, 'day').' '; $late=0; if ($obj->percent == 0 && $datep && $datep < time()) $late=1; if ($obj->percent == 0 && ! $datep && $datep2 && $datep2 < time()) $late=1; @@ -286,7 +286,7 @@ function show_array_actions_to_do($max = 5) print "".$staticaction->LibStatut($obj->percent, 3)."'.$staticaction->LibStatut($obj->percent, 3)."
'; print ''; - print ''; + print ''; print ''; $var = true; $i = 0; @@ -369,11 +369,11 @@ function show_array_last_actions_done($max = 5) print ''; // Date - print '"; // Statut - print "\n"; + print "\n"; print "\n"; $i++; From 7128270a950d0af9d310384daa8a849be688cd4b Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Tue, 19 Feb 2019 11:37:46 -0600 Subject: [PATCH 035/190] [FIX] Variable $i is already declared It was preventing displaying of the other accounts --- htdocs/compta/resultat/clientfourn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index fef607ac0dd..f0a01d1ae04 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -301,7 +301,7 @@ if ($modecompta == 'BOOKKEEPING') // Get cpts of category/group $cpts = $AccCat->getCptsCat(0, $tmppredefinedgroupwhere); - foreach($cpts as $i => $cpt) + foreach($cpts as $j => $cpt) { $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']); if ($return < 0) { From 8e55802e92e55aa321dabc971dc8dc4050fc70e2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 19:40:47 +0100 Subject: [PATCH 036/190] Update stripe.php --- htdocs/stripe/admin/stripe.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index dc63efbd99b..ac86a893903 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -165,7 +165,7 @@ print ''; } else { print ''; @@ -228,7 +228,7 @@ if (empty($conf->stripeconnect->enabled)) $url = dol_buildpath('/public/stripe/ipn.php', 2); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); - print '
'.$out; + print '
'.$out; print ''; } else @@ -280,7 +280,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print $langs->trans("STRIPE_PAYMENT_REQUEST_API").''; if (empty($conf->stripeconnect->enabled)) @@ -282,8 +282,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); -} + print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API): + } print ''; } @@ -297,7 +297,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); -} + } print ''; } From 0a3e0bc2682592987b24c2f083a000f1f8d64b03 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 22:56:07 +0100 Subject: [PATCH 038/190] Update stripe.php --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 4a3b189a71e..46c12801c51 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -282,7 +282,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API): + print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); } print ''; } From 0af6426f8c7ec6fb924e35eafafd6612c02b46dc Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 23:36:59 +0100 Subject: [PATCH 039/190] Update stripe.php --- htdocs/stripe/admin/stripe.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 46c12801c51..172e1897417 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -193,7 +193,7 @@ if (empty($conf->stripeconnect->enabled)) $url = dol_buildpath('/public/stripe/ipn.php?test', 2); $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); - print '
'.$out; + print '
'.$out; print ''; } else { print '
'; @@ -228,7 +228,7 @@ if (empty($conf->stripeconnect->enabled)) $url = dol_buildpath('/public/stripe/ipn.php', 2); $out.= ''; $out.= ajax_autoselect("onlinelivewebhookurl", 0); - print '
'.$out; + print '
'.$out; print ''; } else From d490dd4deca15b87495c8da1c5c70ec10ac9d1cd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 12:15:43 +0100 Subject: [PATCH 040/190] NEW POS support in order Save informations for online / API shopping and push to invoice --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 6e188240a43..dc6856b719e 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -100,7 +100,6 @@ ALTER TABLE llx_prelevement_facture_demande ADD COLUMN sourcetype varchar(32); ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(128) NULL; ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL; - -- Fix if table exists ALTER TABLE llx_c_units DROP INDEX uk_c_units_code; ALTER TABLE llx_c_units ADD COLUMN scale integer; @@ -119,7 +118,6 @@ CREATE TABLE llx_c_units( ALTER TABLE llx_c_units ADD UNIQUE uk_c_units_code(code); - INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('T', '3','WeightUnitton','T', 'weight', 1); INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('KG', '0','WeightUnitkg','Kg', 'weight', 1); INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('G', '-3','WeightUnitg','g', 'weight', 1); @@ -162,3 +160,7 @@ INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VAL -- Default Warehouse id for a user ALTER TABLE llx_user ADD COLUMN fk_warehouse INTEGER NULL; + +-- Save informations for online / API shopping and push to invoice +ALTER TABLE llx_commande ADD COLUMN module_source varchar(32); +ALTER TABLE llx_commande ADD COLUMN pos_source varchar(32); From c54c4f8667263e9c7ebb427ad0c4cf702fad413c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 12:18:20 +0100 Subject: [PATCH 041/190] Update llx_commande.sql --- htdocs/install/mysql/tables/llx_commande.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index d0522f7e5e3..35b6798e77a 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -57,6 +57,8 @@ create table llx_commande model_pdf varchar(255), last_main_doc varchar(255), -- relative filepath+filename of last main generated document + module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...) + pos_source varchar(32), -- name of POS station when order is generated by a POS module facture tinyint default 0, fk_account integer, -- bank account fk_currency varchar(3), -- currency code From c0de2b5b0735597eaf69ba8852b701507ed634ed Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 12:22:02 +0100 Subject: [PATCH 042/190] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8233a50aca3..acba64e6c4e 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1120,6 +1120,9 @@ class Facture extends CommonInvoice $this->note_private = $object->note_private; $this->note_public = $object->note_public; + $this->module_source = $object->module_source; + $this->pos_source = $object->pos_source; + $this->origin = $object->element; $this->origin_id = $object->id; From 25d4be07722669dc4857a498e1c3279095238390 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 12:29:47 +0100 Subject: [PATCH 043/190] Update commande.class.php --- htdocs/commande/class/commande.class.php | 28 ++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8272b2534bf..26151fd8b72 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -203,7 +203,12 @@ class Commande extends CommonOrder public $multicurrency_total_ttc; public $oldcopy; - + + //! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...) + public $module_source; + //! key of pos source ('0', '1', ...) + public $pos_source; + /** * ERR Not enough stock */ @@ -820,7 +825,7 @@ class Commande extends CommonOrder $sql.= ", fk_warehouse"; $sql.= ", remise_absolue, remise_percent"; $sql.= ", fk_incoterms, location_incoterms"; - $sql.= ", entity"; + $sql.= ", entity, module_source, pos_source"; $sql.= ", fk_multicurrency"; $sql.= ", multicurrency_code"; $sql.= ", multicurrency_tx"; @@ -849,6 +854,8 @@ class Commande extends CommonOrder $sql.= ", ".(int) $this->fk_incoterms; $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; $sql.= ", ".$conf->entity; + $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); + $sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql.= ", ".(int) $this->fk_multicurrency; $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql.= ", ".(double) $this->multicurrency_tx; @@ -1633,7 +1640,8 @@ class Commande extends CommonOrder $sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams'; $sql.= ', c.fk_incoterms, c.location_incoterms'; $sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; - $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ", c.module_source, c.pos_source"; + $sql.= ", i.libelle as libelle_incoterms"; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', ca.code as availability_code, ca.label as availability_label'; @@ -1680,7 +1688,7 @@ class Commande extends CommonOrder $this->date_commande = $this->db->jdate($obj->date_commande); $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_validation = $this->db->jdate($obj->date_valid); - $this->date_modification = $this->db->jdate($obj->tms); + $this->date_modification = $this->db->jdate($obj->tms); $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; @@ -1707,13 +1715,15 @@ class Commande extends CommonOrder $this->demand_reason_code = $obj->demand_reason_code; $this->date_livraison = $this->db->jdate($obj->date_livraison); $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; - $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null; + $this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null; $this->fk_delivery_address = $obj->fk_delivery_address; - + $this->module_source = $obj->module_source; + $this->pos_source = $obj->pos_source; + //Incoterms - $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; From 6416f24d5f2a73849353b4cdb0c900cd5075bfa2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 12:35:13 +0100 Subject: [PATCH 044/190] FIX fetch module / pos source --- htdocs/compta/facture/class/facture.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 8233a50aca3..70ba4c9ede6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1324,6 +1324,7 @@ class Facture extends CommonInvoice $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', f.fk_incoterms, f.location_incoterms'; + $sql.= ', f.module_source, f.pos_source'; $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; @@ -1357,7 +1358,7 @@ class Facture extends CommonInvoice $this->date_pointoftax = $this->db->jdate($obj->date_pointoftax); $this->date_creation = $this->db->jdate($obj->datec); $this->date_validation = $this->db->jdate($obj->datev); - $this->date_modification = $this->db->jdate($obj->datem); + $this->date_modification = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem); $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; @@ -1396,9 +1397,12 @@ class Facture extends CommonInvoice $this->extraparams = (array) json_decode($obj->extraparams, true); //Incoterms - $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + + $this->module_source = $obj->module_source; + $this->pos_source = $obj->pos_source; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; From ef5372f4762cf0e92293ace3c34e4d39ee8ad3cf Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 13:04:22 +0100 Subject: [PATCH 045/190] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 70ba4c9ede6..2a0aa66561f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1324,7 +1324,7 @@ class Facture extends CommonInvoice $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', f.fk_incoterms, f.location_incoterms'; - $sql.= ', f.module_source, f.pos_source'; + $sql.= ', f.module_source, f.pos_source'; $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; @@ -1400,7 +1400,6 @@ class Facture extends CommonInvoice $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; - $this->module_source = $obj->module_source; $this->pos_source = $obj->pos_source; @@ -2654,7 +2653,7 @@ class Facture extends CommonInvoice * @return int <0 if KO, Id of line if OK */ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) - { + { // Deprecation warning if ($label) { dol_syslog(__METHOD__ . ": using line label is deprecated", LOG_WARNING); From 152585c1b8a88d88ed05384abc930e57f12d6077 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 13:20:46 +0100 Subject: [PATCH 046/190] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2a0aa66561f..656d4eed82b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1401,7 +1401,7 @@ class Facture extends CommonInvoice $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; $this->module_source = $obj->module_source; - $this->pos_source = $obj->pos_source; + $this->pos_source = $obj->pos_source; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; From 98affe0921c8792df769ad33fe9db2a53055127e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 14:25:25 +0100 Subject: [PATCH 047/190] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 656d4eed82b..f7054dfc29a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1401,7 +1401,7 @@ class Facture extends CommonInvoice $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; $this->module_source = $obj->module_source; - $this->pos_source = $obj->pos_source; + $this->pos_source = $obj->pos_source; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; From d10c5cab3424307ae42321fbd4b768e7c83e839d Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Wed, 20 Feb 2019 15:14:50 +0100 Subject: [PATCH 048/190] Company Lib : Fix url for emailing type event (link to emailing card) --- htdocs/core/lib/company.lib.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index be9c660a499..c0369921b4d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1378,7 +1378,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin } // Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing. - if (! empty($conf->mailing->enabled) && ! empty($objcon->email)) + if (! empty($conf->mailing->enabled) && ! empty($objcon->email) + && (empty($actioncode) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING')) { $langs->load("mails"); @@ -1528,7 +1529,13 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin // Ref $out.=''; // Author of event From 31aa3ec376c4befb9f1355d837994f1ccf00258f Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Wed, 20 Feb 2019 11:45:07 -0600 Subject: [PATCH 049/190] [FIX] ORDER BY before custom filters for where When filtering data "and cac.libelle" would be appended after ORDER BY --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index d170675aa81..fc2c173d90c 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -418,6 +418,6 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; + $this->export_sql_order[$r] .=' ORDER BY ac.datep'; } } From cdc2c5ae7747bdd59c8d19f6919d2c6e0dd07586 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Thu, 21 Feb 2019 09:49:46 +0100 Subject: [PATCH 050/190] Company Lib : Fix contact events with no thirdparty --- htdocs/core/lib/company.lib.php | 46 ++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c0369921b4d..94707467166 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1266,27 +1266,31 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o"; $sql.= " WHERE a.entity IN (".getEntity('agenda').")"; - if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; - elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') - { - $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'Product') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; - } - elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') - { - $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; - if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + if (is_object($objcon) && $objcon->id) { + $sql.= " AND a.fk_contact = ".$objcon->id; + } else { + if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; + elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') + { + $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'Product') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } + elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') + { + $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; + if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; + } } // Condition on actioncode From 58d82eb4779d9adcd15397034ad1b71b18d7356c Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 21 Feb 2019 11:08:55 +0100 Subject: [PATCH 051/190] FIX : function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it --- htdocs/admin/agenda_reminder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index fac49dcfcde..3ea0e397c92 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -194,7 +194,7 @@ print ''."\n"; // AGENDA REMINDER EMAIL -if ($conf->global->MAIN_FEATURES_LEVEL > 0) +if ($conf->global->MAIN_FEATURES_LEVEL == 2) { print ''."\n"; print ''."\n"; @@ -211,7 +211,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) } // AGENDA REMINDER BROWSER -if ($conf->global->MAIN_FEATURES_LEVEL > 0) +if ($conf->global->MAIN_FEATURES_LEVEL == 2) { print ''."\n"; print ''."\n"; From 33164bcb3ec423b747c92d814245cd1808c32724 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 21 Feb 2019 14:25:09 +0100 Subject: [PATCH 052/190] fix : When comparing two booleans, it is generally considered safer to use the strict comparison operator. --- htdocs/accountancy/customer/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 873018cf6c9..6a7d59a46ce 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -456,7 +456,7 @@ if ($result) { if ($objp->country_sell == '1') { $objp->code_sell_p = $objp->code_sell; $objp->aarowid_suggest = $objp->aarowid; - } elseif ($isinEEC == true) { + } elseif ($isinEEC === true) { $objp->code_sell_p = $objp->code_sell_intra; $objp->aarowid_suggest = $objp->aarowid_intra; } else { From 5a889300624a82a8a68365fca064e8f4a2c0cf7e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 21 Feb 2019 14:38:12 +0100 Subject: [PATCH 053/190] fix : The property total_vat does not exist on Reception --- .../modules/reception/doc/doc_generic_reception_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index fb93998ef84..bcae2c990af 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -300,7 +300,7 @@ class doc_generic_reception_odt extends ModelePdfReception '__FROM_EMAIL__' => $this->emetteur->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook From 0428e026c9a53c8a5ab0e04ecf7d78b2520b60be Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 21 Feb 2019 15:08:19 +0100 Subject: [PATCH 054/190] Update stripe.php --- htdocs/stripe/admin/stripe.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 172e1897417..0c6e195910d 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -187,7 +187,7 @@ if (empty($conf->stripeconnect->enabled)) print ''; @@ -580,7 +580,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; print ''."\n"; @@ -646,7 +646,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + if (! empty($totalarray['pos'][$i])) print ''; else { if ($i == 1) diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 2366ac30610..5eb206057c3 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -260,16 +260,16 @@ if (! in_array($nowyear, $arrayyears)) $arrayyears[$nowyear]=$nowyear; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; -print ''; +print ''; print '
'.$langs->trans("LastDoneTasks", $max).''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.dol_print_date($db->jdate($obj->da2), 'day'); + print ''.dol_print_date($db->jdate($obj->da2), 'day'); print "".$staticaction->LibStatut($obj->percent, 3)."".$staticaction->LibStatut($obj->percent, 3)."
'; print $langs->trans("StripeLiveEnabled").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STRIPE_LIVE'); -} else { + } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); } @@ -193,7 +193,7 @@ if (empty($conf->stripeconnect->enabled)) $url = dol_buildpath('/public/stripe/ipn.php?test', 2); $out.= ''; $out.= ajax_autoselect("onlinetestwebhookurl", 0); - print '
'.$out; + print '
'.$out; print '
'.$langs->trans("StripeConnect").'
'; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STRIPE_PAYMENT_REQUEST_API'); -} else { + } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_PAYMENT_REQUEST_API", $arrval, $conf->global->STRIPE_PAYMENT_REQUEST_API); } @@ -294,7 +294,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code print $langs->trans("STRIPE_SEPA_DIRECT_DEBIT").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STRIPE_SEPA_DIRECT_DEBIT'); -} else { + } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_SEPA_DIRECT_DEBIT", $arrval, $conf->global->STRIPE_SEPA_DIRECT_DEBIT); } From ea6e397d18a9bffc78d5e943e739151a9441295a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 19 Feb 2019 22:28:26 +0100 Subject: [PATCH 037/190] Update stripe.php --- htdocs/stripe/admin/stripe.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index ac86a893903..4a3b189a71e 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -168,7 +168,7 @@ print $langs->trans("StripeLiveEnabled").''; } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); print $form->selectarray("STRIPE_LIVE", $arrval, $conf->global->STRIPE_LIVE); -} + } print '
'.$langs->trans("StripeConnect").'
'; - $out.=$actionstatic->getNomUrl(1, -1); + if (isset($histo[$key]['type']) && $histo[$key]['type']=='mailing') { + $out.=''.img_object($langs->trans("ShowEMailing"), "email").' '; + $out.=$histo[$key]['id']; + $out.=''; + } else { + $out.=$actionstatic->getNomUrl(1, -1); + } $out.='
'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'
'.$langs->trans('AGENDA_REMINDER_BROWSER').'
'; print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; - print ''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForTestWebhook").'
'; $url = dol_buildpath('/public/stripe/ipn.php?test', 2); @@ -222,7 +222,7 @@ if (empty($conf->stripeconnect->enabled)) print '
'; print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; - print ''; + print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; $out = img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForLiveWebhook").'
'; $url = dol_buildpath('/public/stripe/ipn.php', 2); From afae29198dc6745ab0b398748148a102a7368c6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Feb 2019 17:03:24 +0100 Subject: [PATCH 055/190] Missing function 'getFormatedCustomerRef' and 'getFormatedsupplierRef' --- htdocs/contrat/contact.php | 4 ++-- htdocs/contrat/document.php | 4 ++-- htdocs/contrat/info.php | 4 ++-- htdocs/contrat/note.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 5b3493a7249..1e8fbcbfdee 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -156,11 +156,11 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 60daaa22ce4..64ecff642f7 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -128,11 +128,11 @@ if ($object->id) $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 1170c7e9f9e..7d2b897f761 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -92,11 +92,11 @@ $morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2); $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); -$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); +$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); -$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); +$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 1ab0edfbcf3..886e836f10e 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -96,11 +96,11 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.='
'; // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref.='
'; $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project From 54da44b5065c81b92ba8dbf7f817e480f9535e9a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 21 Feb 2019 19:50:03 +0100 Subject: [PATCH 056/190] Translation --- htdocs/core/class/html.formcompany.class.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index c60b6675a1d..f92bee4519f 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -188,11 +188,10 @@ class FormCompany // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne. - * Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays. - * La cle de la liste est le code (il peut y avoir plusieurs entree pour - * un code donnee mais dans ce cas, le champ pays differe). - * Ainsi les liens avec les departements se font sur un departement independemment de son nom. + * Returns the drop-down list of departments/provinces/cantons for all countries or for a given country. + * In the case of an all-country list, the display breaks on the country. + * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). + * Thus the links with the departments are done on a department independently of its name. * * @param string $selected Code state preselected * @param int $country_codeid 0=list for all countries, otherwise country code or country rowid to show @@ -207,11 +206,10 @@ class FormCompany // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne. - * Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays. - * La cle de la liste est le code (il peut y avoir plusieurs entree pour - * un code donnee mais dans ce cas, le champ pays differe). - * Ainsi les liens avec les departements se font sur un departement independemment de son nom. + * Returns the drop-down list of departments/provinces/cantons for all countries or for a given country. + * In the case of an all-country list, the display breaks on the country. + * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). + * Thus the links with the departments are done on a department independently of its name. * * @param string $selected Code state preselected (mus be state id) * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show From 4a3751a05407a51a9e0467d3fbc0cd3c9218232b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Feb 2019 19:50:54 +0100 Subject: [PATCH 057/190] Fix html5 --- htdocs/admin/stock.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 4a1fb7eea1a..2e934211970 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -409,12 +409,12 @@ print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print ''; print ''; -print '\n"; print ''; print ''; -print '\n"; print "\n"; if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { - print ''; print ''; - print '\n"; @@ -1280,7 +1278,7 @@ class FormFile $fulllink=$urlwithroot.'/document.php'.($paramlink?'?'.$paramlink:''); print img_picto($langs->trans("FileSharedViaALink"), 'object_globe.png').' '; - print ''; + print ''; } else { From c38b0c4dbec7414a21f94f8457aa3495b3d1261f Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 22 Feb 2019 12:17:34 +0100 Subject: [PATCH 060/190] FIX fk_default_warehouse missing in group by --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 761cce030f7..77fd4b1aa69 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -499,7 +499,7 @@ if ($id > 0 || ! empty($ref)) { $sql .= " WHERE l.fk_commande = " . $object->id; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND l.product_type = 0"; - $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product + $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product $sql .= " ORDER BY p.ref, p.label"; $resql = $db->query($sql); From 7360e1c0d45a032b8d6f77ea2cb76c93b5214b0d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:19:21 +0100 Subject: [PATCH 061/190] Fix servicestatus list of payment stripe --- htdocs/stripe/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index bf8802f4c89..f9599984fd0 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -85,7 +85,7 @@ if (! empty($conf->stripe->enabled)) if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; - $servicestatus = 0; + $servicestatus = 1; } $stripe=new Stripe($db); From 5021252622ca321979c6ef39d0b70e75b49b55df Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:23:28 +0100 Subject: [PATCH 062/190] Fix stripe payment list of transaction --- htdocs/stripe/transaction.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 467d242a0c8..9620e3399c9 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -60,19 +60,20 @@ $stripe = new Stripe($db); llxHeader('', $langs->trans("StripeTransactionList")); -if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) +if (! empty($conf->stripe->enabled)) { $service = 'StripeTest'; - $servicestatus = '0'; - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); -} -else -{ - $service = 'StripeLive'; - $servicestatus = '1'; + $servicestatus = 0; + if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) + { + $service = 'StripeLive'; + $servicestatus = 1; + } + + $stripe=new Stripe($db); + $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) } -$stripeacc = $stripe->getStripeAccount($service); /*if (empty($stripeaccount)) { print $langs->trans('ErrorStripeAccountNotDefined'); From 232741d9198ba3525f4900ecca605c32948b5568 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:27:50 +0100 Subject: [PATCH 063/190] Update payment.php --- htdocs/stripe/payment.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index f9599984fd0..fd1b9fcc84b 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -78,19 +78,22 @@ if ($facid > 0) $ret=$object->fetch($facid); } -if (! empty($conf->stripe->enabled)) +if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; - $servicestatus = 0; - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) - { - $service = 'StripeLive'; - $servicestatus = 1; - } - - $stripe=new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) + $servicestatus = '0'; + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } +else +{ + $service = 'StripeLive'; + $servicestatus = '1'; +} +$stripeacc = $stripe->getStripeAccount($service); +/*if (empty($stripeaccount)) +{ + print $langs->trans('ErrorStripeAccountNotDefined'); +}*/ // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('paiementcard','globalcard')); From 3416d2bdd1a04b488ddba549609c9419e5cb6675 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:29:38 +0100 Subject: [PATCH 064/190] Update transaction.php --- htdocs/stripe/transaction.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 9620e3399c9..b0575a53ee4 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -60,20 +60,18 @@ $stripe = new Stripe($db); llxHeader('', $langs->trans("StripeTransactionList")); -if (! empty($conf->stripe->enabled)) +if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { $service = 'StripeTest'; - $servicestatus = 0; - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) - { - $service = 'StripeLive'; - $servicestatus = 1; - } - - $stripe=new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here) + $servicestatus = '0'; + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } - +else +{ + $service = 'StripeLive'; + $servicestatus = '1'; +} +$stripeacc = $stripe->getStripeAccount($service); /*if (empty($stripeaccount)) { print $langs->trans('ErrorStripeAccountNotDefined'); From f027bd2b08b53bd4a67da0aa4043e44b189d8927 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:30:25 +0100 Subject: [PATCH 065/190] Update payment.php --- htdocs/stripe/payment.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index fd1b9fcc84b..bb6a6f1dbb2 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -8,7 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -98,7 +98,6 @@ $stripeacc = $stripe->getStripeAccount($service); // Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('paiementcard','globalcard')); - /* * Actions */ From 454ab2e866d23d875d6db6419ef0b60549e4d2a7 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:54:26 +0100 Subject: [PATCH 066/190] FIX Stripe live Oauth --- htdocs/admin/oauthlogintokens.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index aa0dd0978d9..e284d4b4834 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -154,6 +154,13 @@ if ($mode == 'setup' && $user->admin) $urltodelete=''; $urltocheckperms=''; } + elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME') + { + $OAUTH_SERVICENAME='StripeLive'; + $urltorenew=$urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete=''; + $urltocheckperms=''; + } else { $urltorenew=''; From dd160a62425b11032736fa16798f6e6f4761b726 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Feb 2019 14:56:39 +0100 Subject: [PATCH 067/190] Create stripelive_oauthcallback.php --- .../oauth/stripelive_oauthcallback.php | 179 ++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 htdocs/core/modules/oauth/stripelive_oauthcallback.php diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php new file mode 100644 index 00000000000..cf2c2418092 --- /dev/null +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -0,0 +1,179 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/modules/oauth/stripe_oauthcallback.php + * \ingroup oauth + * \brief Page to get oauth callback + */ + +require '../../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; +use OAuth\Common\Storage\DoliStorage; +use OAuth\Common\Consumer\Credentials; +use OAuth\OAuth2\Service\GitHub; + +// Define $urlwithroot +$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + + +$action = GETPOST('action', 'alpha'); +$backtourl = GETPOST('backtourl', 'alpha'); + + +/** + * Create a new instance of the URI class with the current URI, stripping the query string + */ +$uriFactory = new \OAuth\Common\Http\Uri\UriFactory(); +//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER); +//$currentUri->setQuery(''); +$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php'); + + +/** + * Load the credential for the service + */ + +/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */ +$serviceFactory = new \OAuth\ServiceFactory(); +$httpClient = new \OAuth\Common\Http\Client\CurlClient(); +// TODO Set options for proxy and timeout +// $params=array('CURLXXX'=>value, ...) +//$httpClient->setCurlParameters($params); +$serviceFactory->setHttpClient($httpClient); + +// Dolibarr storage +$storage = new DoliStorage($db, $conf); + +// Setup the credentials for the requests +$credentials = new Credentials( + $conf->global->OAUTH_STRIPE_TEST_ID, + $conf->global->STRIPE_LIVE_SECRET_KEY, + $currentUri->getAbsoluteUri() +); + +$requestedpermissionsarray=array(); +if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back +/*if ($action != 'delete' && empty($requestedpermissionsarray)) +{ + print 'Error, parameter state is not defined'; + exit; +}*/ +//var_dump($requestedpermissionsarray);exit; + +// Instantiate the Api service using the credentials, http client and storage mechanism for the token +/** @var $apiService Service */ +//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray); + +$sql="INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeLive', entity=".$conf->entity; +$db->query($sql); + +// access type needed to have oauth provider refreshing token +//$apiService->setAccessType('offline'); + +$langs->load("oauth"); + + +/* + * Actions + */ + + +if ($action == 'delete') +{ + $storage->clearToken('StripeLive'); + + setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs'); + + header('Location: ' . $backtourl); + exit(); +} + +if (! empty($_GET['code'])) // We are coming from oauth provider page +{ + // We should have + //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16)) + + dol_syslog("We are coming from the oauth provider page"); + //llxHeader('',$langs->trans("OAuthSetup")); + + //$linkback=''.$langs->trans("BackToModuleList").''; + //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup'); + + //dol_fiche_head(); + // retrieve the CSRF state parameter + $state = isset($_GET['state']) ? $_GET['state'] : null; + //print '
".$langs->trans("Other")."'.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UserWarehouseAutoCreate").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_USERSTOCK_AUTOCREATE'); } else { @@ -428,7 +428,7 @@ print '
'; print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")); print ''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_SUPPORTS_SERVICES'); } else { @@ -440,7 +440,7 @@ print "
'.$langs->trans("AllowAddLimitStockByWarehouse").''; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE'); } else { @@ -451,10 +451,9 @@ print "
'.$langs->trans("UseDispatchStatus").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); } else { From 2891758c23d809f8fbcd860617b2821e710977f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Feb 2019 20:13:03 +0100 Subject: [PATCH 058/190] FIX Stock visibility for service when option stock on service is on NEW Add option STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO --- htdocs/core/class/html.form.class.php | 44 +++++++++++++++++++++------ 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 647460e049c..2fb4e4ca228 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2266,7 +2266,7 @@ class Form $objp->remise_percent = $objp2->remise_percent; $objp->remise = $objp2->remise; - $this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel); + $this->constructProductListOption($objp, $opt, $optJson, 0, $selected, $hidepriceinlabel, $filterkey); $j++; @@ -2293,7 +2293,7 @@ class Form $objp->price_ttc = price2num($objp->price_ttc, 'MU'); } } - $this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel); + $this->constructProductListOption($objp, $opt, $optJson, $price_level, $selected, $hidepriceinlabel, $filterkey); // Add new entry // "key" value of json key array is used by jQuery automatically as selected value // "label" value of json key array is used by jQuery automatically as text for combo box @@ -2318,7 +2318,8 @@ class Form } /** - * constructProductListOption + * constructProductListOption. + * This define value for &$opt and &$optJson. * * @param resultset $objp Resultset of fetch * @param string $opt Option (var used for returned value in string option format) @@ -2326,11 +2327,12 @@ class Form * @param int $price_level Price level * @param string $selected Preselected value * @param int $hidepriceinlabel Hide price in label + * @param string $filterkey Filter key to highlight * @return void */ - private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0) + private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0, $filterkey = '') { - global $langs,$conf,$user,$db; + global $langs, $conf, $user, $db; $outkey=''; $outval=''; @@ -2368,7 +2370,7 @@ class Form { $opt.= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; } - if (! empty($conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) + if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"'; elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; @@ -2509,14 +2511,38 @@ class Form $outtva_tx=$objp->tva_tx; } - if (! empty($conf->stock->enabled) && isset($objp->stock) && $objp->fk_product_type == 0) + if (! empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) { $opt.= ' - '.$langs->trans("Stock").':'.$objp->stock; if ($objp->stock > 0) { - $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + $outval.= ' - '; }elseif ($objp->stock <= 0) { - $outval.= ' - '.$langs->transnoentities("Stock").':'.$objp->stock.''; + $outval.= ' - '; + } + $outval.= $langs->transnoentities("Stock").':'.$objp->stock; + $outval.= ''; + if (! empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) // Warning, this option may slow down combo list generation + { + $langs->load("stocks"); + + $tmpproduct=new Product($this->db); + $tmpproduct->fetch($objp->rowid); + $tmpproduct->load_virtual_stock(); + $virtualstock = $tmpproduct->stock_theorique; + + $opt.= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; + + $outval.=' - '.$langs->transnoentities("VirtualStock").':'; + if ($virtualstock > 0) { + $outval.= ' - '; + }elseif ($virtualstock <= 0) { + $outval.= ' - '; + } + $outval.=$virtualstock; + $outval.=''; + + unset($tmpproduct); } } From 5a18588bb77dfafd5d2497fb9196c2f67868a5a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Feb 2019 22:27:56 +0100 Subject: [PATCH 059/190] CSS --- htdocs/core/class/html.formfile.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index bfd84a1795e..49ecd40b4e8 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1202,8 +1202,6 @@ class FormFile } // Preview link if (! $editline) print $this->showPreview($file, $modulepart, $filepath); - // Public share link - //if (! $editline && ! empty($filearray[$key]['hashp'])) print pictowithlinktodirectdownload; print "
'; + + // This was a callback request from service, get the token + try { + //var_dump($_GET['code']); + //var_dump($state); + //var_dump($apiService); // OAuth\OAuth2\Service\GitHub + + //$token = $apiService->requestAccessToken($_GET['code'], $state); + $token = $apiService->requestAccessToken($_GET['code']); + // Github is a service that does not need state to be stored. + // Into constructor of GitHub, the call + // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri) + // has not the ending parameter to true like the Google class constructor. + + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + + $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; + unset($_SESSION["backtourlsavedbeforeoauthjump"]); + + header('Location: ' . $backtourl); + exit(); + } catch (Exception $e) { + print $e->getMessage(); + } +} +else // If entry on page with no parameter, we arrive here +{ + $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; + + // This may create record into oauth_state before the header redirect. + // Creation of record with state in this tables depend on the Provider used (see its constructor). + if (GETPOST('state')) + { + $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); + } + else + { + //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated + //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write + $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write'; + } + + // we go on oauth provider authorization page + header('Location: ' . $url); + exit(); +} + + +/* + * View + */ + +// No view at all, just actions + +$db->close(); From f7c0044e6004ab47c349092b398b4b633482b83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 09:33:21 +0100 Subject: [PATCH 068/190] doc comment --- htdocs/core/class/html.formfile.class.php | 38 +++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 49ecd40b4e8..6e7914d9206 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1550,20 +1550,20 @@ class FormFile // To show ref or specific information according to view to show (defined by $module) if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices - if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} + elseif ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices + elseif ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); } + elseif ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} + elseif ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} + elseif ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} + elseif ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');} + elseif ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');} if (! $id && ! $ref) continue; $found=0; @@ -1720,7 +1720,7 @@ class FormFile print '
'; print ''; -print_liste_field_titre( + print_liste_field_titre( $langs->trans("Links"), $_SERVER['PHP_SELF'], "name", @@ -1730,7 +1730,7 @@ print_liste_field_titre( $sortfield, $sortorder ); -print_liste_field_titre( + print_liste_field_titre( "", "", "", @@ -1738,7 +1738,7 @@ print_liste_field_titre( "", 'class="right"' ); -print_liste_field_titre( + print_liste_field_titre( $langs->trans("Date"), $_SERVER['PHP_SELF'], "date", @@ -1748,7 +1748,7 @@ print_liste_field_titre( $sortfield, $sortorder ); -print_liste_field_titre( + print_liste_field_titre( '', $_SERVER['PHP_SELF'], "", @@ -1825,7 +1825,7 @@ print_liste_field_titre( * @param array $file Array with data of file. Example: array('name'=>...) * @param string $modulepart propal, facture, facture_fourn, ... * @param string $relativepath Relative path of docs - * @param string $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) + * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links * @return string $out Output string with HTML */ From 6ee29559f9beeafd066b02d479da96b018f4e6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 09:44:45 +0100 Subject: [PATCH 069/190] doc comment entrepot.class.php --- htdocs/product/stock/class/entrepot.class.php | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index a872bdae8ae..81e8680034e 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2008 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2016 Francis Appels + * 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 @@ -76,8 +77,14 @@ class Entrepot extends CommonObject */ public $address; - //! Code Postal + /** + * @var string Zipcode + */ public $zip; + + /** + * @var string Town + */ public $town; /** @@ -573,26 +580,26 @@ class Entrepot extends CommonObject { return $label; } - if ($mode == 1) + elseif ($mode == 1) { return $label; } - if ($mode == 2) + elseif ($mode == 2) { if ($statut > 0) $picto = 'statut4'; return img_picto($label, $picto).' '.$label; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut > 0) $picto = 'statut4'; return img_picto($label, $picto).' '.$label; } - if ($mode == 4) + elseif ($mode == 4) { if ($statut > 0) $picto = 'statut4'; return img_picto($label, $picto).' '.$label; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut > 0) $picto = 'statut4'; return $label.' '.img_picto($label, $picto); @@ -617,7 +624,6 @@ class Entrepot extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result=''; - $label = ''; $label = '' . $langs->trans("ShowWarehouse").''; $label.= '
' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref); @@ -724,9 +730,9 @@ class Entrepot extends CommonObject /** * Return array of children warehouses ids from $id warehouse (recursive function) * - * @param int $id id parent warehouse - * @param array $TChildWarehouses array which will contain all children (param by reference) - * @return array $TChildWarehouses array which will contain all children + * @param int $id id parent warehouse + * @param integer[] $TChildWarehouses array which will contain all children (param by reference) + * @return integer[] $TChildWarehouses array which will contain all children */ function get_children_warehouses($id, &$TChildWarehouses) { From c3d1ed73d2be807b7956c1fb0b8682d0c46382e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 11:17:07 +0100 Subject: [PATCH 070/190] variables does not seem to be defined for all execution paths --- htdocs/core/boxes/box_produits_alerte_stock.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index c8c3d9c94b6..e041c0ab197 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005-2012 Maxime Kohlhaas - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2019 Frédéric France * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -117,6 +117,8 @@ class box_produits_alerte_stock extends ModeleBoxes while ($line < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); + $price = ''; + $price_base_type = ''; // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active From b75519fefea8885092077fc2ebf4c6a98627fcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 11:25:49 +0100 Subject: [PATCH 071/190] Update html.formmail.class.php --- htdocs/core/class/html.formmail.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 752d2406ea4..90809c68a05 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2015-2017 Marcos García * Copyright (C) 2015-2017 Nicolas ZABOURI - * 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 @@ -1140,7 +1140,7 @@ class FormMail extends Form * @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found) * @param int $active 1=Only active template, 0=Only disabled, -1=All * @param string $label Label of template - * @return ModelMail One instance of ModelMail + * @return ModelMail|integer One instance of ModelMail or -1 if error */ public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { From 8ca6935f8b00cde18544fcdcf14278d8f19b54ac Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Tue, 19 Feb 2019 11:37:46 -0600 Subject: [PATCH 072/190] [FIX] Variable $i is already declared It was preventing displaying of the other accounts --- htdocs/compta/resultat/clientfourn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index ee94b4ab5fc..f25a6baf87a 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -301,7 +301,7 @@ if ($modecompta == 'BOOKKEEPING') // Get cpts of category/group $cpts = $AccCat->getCptsCat(0, $tmppredefinedgroupwhere); - foreach($cpts as $i => $cpt) + foreach($cpts as $j => $cpt) { $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']); if ($return < 0) { From b8df685186a839ae7ed6664ff7439591b1a479e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 14:11:53 +0100 Subject: [PATCH 073/190] Update payment.php --- htdocs/stripe/payment.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index bb6a6f1dbb2..50d64521621 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -78,7 +78,12 @@ if ($facid > 0) $ret=$object->fetch($facid); } -if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) +if (! empty($conf->stripe->enabled)) +{ + access_forbidden(); +} + +if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) { $service = 'StripeTest'; $servicestatus = '0'; From 3d0af97e79934afeff07f80383dfb2e6d3db87ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 14:24:37 +0100 Subject: [PATCH 074/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index ceaca36e39d..3a36f711e4e 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -921,10 +921,10 @@ class Invoices extends DolibarrApi } /** - * Make credt note from invoice + * Create credit note from invoice * * @param int $id Invoice ID - * @url POST {id}/makecreditnote + * @url POST {id}/createCreditNote * * @return array An invoice object * @@ -934,7 +934,7 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 500 */ - function makecreditnote($id) + function createCreditNote($id) { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -960,7 +960,7 @@ class Invoices extends DolibarrApi { $this->invoice->fetch_lines(); - // Boucle sur chaque taux de tva + // Loop on each vat rate $i=0; foreach($this->invoice->lines as $line) { From 5bf3a1f175fff94df4f39be7660dfd7eb5995b2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 14:36:51 +0100 Subject: [PATCH 075/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 3a36f711e4e..60c034bc240 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -921,7 +921,7 @@ class Invoices extends DolibarrApi } /** - * Create credit note from invoice + * Create a discount (credit available) for a credit note or a deposit. * * @param int $id Invoice ID * @url POST {id}/createCreditNote @@ -934,7 +934,7 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 500 */ - function createCreditNote($id) + function markAsCreditAvailable($id) { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); From eb733728c3420aae5c02568f4e07f2900bfd7274 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 14:37:09 +0100 Subject: [PATCH 076/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 60c034bc240..0cb005ddba5 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -924,7 +924,7 @@ class Invoices extends DolibarrApi * Create a discount (credit available) for a credit note or a deposit. * * @param int $id Invoice ID - * @url POST {id}/createCreditNote + * @url POST {id}/markAsCreditAvailable * * @return array An invoice object * From ca456512657be03f972cbcd6cb16e21844011b34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 14:38:13 +0100 Subject: [PATCH 077/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 0cb005ddba5..afecfd33b45 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -956,7 +956,7 @@ class Invoices extends DolibarrApi throw new RestException(404, 'Thirdparty not found'); } - if (! $object->paye) // protection against multiple submit + if (! $this->invoice->paye) // protection against multiple submit { $this->invoice->fetch_lines(); @@ -1015,7 +1015,7 @@ class Invoices extends DolibarrApi } else { - throw new RestException(500, 'Discount error'); + throw new RestException(500, 'Discount creation error'); $this->db->rollback(); } } From 9aa8de3367306c8121f84fb8be51fc39709ddd78 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 15:10:18 +0100 Subject: [PATCH 078/190] FIX #10644 --- htdocs/langs/es_HN/main.lang | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/htdocs/langs/es_HN/main.lang b/htdocs/langs/es_HN/main.lang index 8b731814285..0d6b013ca18 100644 --- a/htdocs/langs/es_HN/main.lang +++ b/htdocs/langs/es_HN/main.lang @@ -2,26 +2,20 @@ DIRECTION=ltr FONTFORPDF=helvetica FONTSIZEFORPDF=10 -SeparatorDecimal=, +SeparatorDecimal=. SeparatorThousand=None -FormatDateShort=%d/%m/%Y -FormatDateShortInput=%d/%m/%Y -FormatDateShortJava=dd/MM/yyyy -FormatDateShortJavaInput=dd/MM/yyyy -FormatDateShortJQuery=dd/mm/yy -FormatDateShortJQueryInput=dd/mm/yy +FormatDateShort=%m/%d/%Y +FormatDateShortInput=%m/%d/%Y +FormatDateShortJava=MM/dd/yyyy +FormatDateShortJavaInput=MM/dd/yyyy +FormatDateShortJQuery=mm/dd/yy +FormatDateShortJQueryInput=mm/dd/yy FormatHourShortJQuery=HH:MI -FormatHourShort=%H:%M +FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M -FormatDateTextShort=%d %b %Y -FormatDateText=%d %B %Y -FormatDateHourShort=%d/%m/%Y %H:%M -FormatDateHourSecShort=%d/%m/%Y %H:%M:%S -FormatDateHourTextShort=%d %b %Y %H:%M -FormatDateHourText=%d %B %Y %H:%M -AmountVAT=Importe ISV -TotalVAT=Total ISV -HT=Sin ISV -TTC=ISV incluido -VAT=ISV -VATRate=Tasa ISV +FormatDateTextShort=%b %d, %Y +FormatDateText=%B %d, %Y +FormatDateHourShort=%m/%d/%Y %I:%M %p +FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p +FormatDateHourTextShort=%b %d, %Y, %I:%M %p +FormatDateHourText=%B %d, %Y, %I:%M %p From b4e3bb37af7f7ed2f854b7eedc43be49c12614f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 15:11:41 +0100 Subject: [PATCH 079/190] Sync transifex --- htdocs/langs/ar_EG/admin.lang | 1 - htdocs/langs/de_AT/main.lang | 1 - htdocs/langs/en_GB/admin.lang | 4 ---- htdocs/langs/en_GB/companies.lang | 1 - htdocs/langs/en_GB/errors.lang | 2 -- htdocs/langs/en_GB/products.lang | 2 -- htdocs/langs/es_CL/admin.lang | 1 - htdocs/langs/es_CL/main.lang | 1 - htdocs/langs/es_EC/admin.lang | 1 - htdocs/langs/es_EC/main.lang | 1 - htdocs/langs/es_MX/main.lang | 1 - htdocs/langs/fr_CA/main.lang | 1 - htdocs/langs/pt_BR/admin.lang | 2 -- 13 files changed, 19 deletions(-) diff --git a/htdocs/langs/ar_EG/admin.lang b/htdocs/langs/ar_EG/admin.lang index e4b07918378..53393c74233 100644 --- a/htdocs/langs/ar_EG/admin.lang +++ b/htdocs/langs/ar_EG/admin.lang @@ -25,6 +25,5 @@ Module25Desc=إدارة أوامر الشراء Module700Name=تبرعات Module1780Name=الأوسمة/التصنيفات Permission81=قراءة أوامر الشراء -Audit=Audit LogEventDesc=You can enable here the logging for Dolibarr security events. Administrators can then see its content via menu System tools - Audit. Warning, this feature can consume a large amount of data in database. NoEventOrNoAuditSetup=No security event has been recorded yet. This can be normal if audit has not been enabled on "setup - security - audit" page. diff --git a/htdocs/langs/de_AT/main.lang b/htdocs/langs/de_AT/main.lang index 8a51e29cb85..e3be90a6cc4 100644 --- a/htdocs/langs/de_AT/main.lang +++ b/htdocs/langs/de_AT/main.lang @@ -33,7 +33,6 @@ ConfirmClone=Klonen/Duplizieren - Optionen: Of=Von Search=Suche SearchOf=Suche -Upload=Upload PasswordRetype=Geben Sie das Passwort erneut ein DateStart=Start-Datum DateEnd=End-Datum diff --git a/htdocs/langs/en_GB/admin.lang b/htdocs/langs/en_GB/admin.lang index d5046722e24..6f2ae713012 100644 --- a/htdocs/langs/en_GB/admin.lang +++ b/htdocs/langs/en_GB/admin.lang @@ -35,7 +35,6 @@ ProtectAndEncryptPdfFilesDesc=Protection of a PDF document keeps it available to MeasuringUnit=Measurement unit MAIN_MAIL_AUTOCOPY_TO=Copy (Cc) all sent emails to ModuleFamilyCrm=Customer Relations Management (CRM) -ModuleFamilyProducts=Product Management (PM) ModuleFamilyHr=Human Resources Management (HR) ModuleFamilyTechnic=Multi-module tools ThisIsProcessToFollow=These are steps to process: @@ -56,9 +55,6 @@ FollowingSubstitutionKeysCanBeUsed=
To learn how to create your .odt document DescWeather=The following pictures will be shown on the dashboard when the number of late actions reaches the following values: ThisForceAlsoTheme=This menu manager will use its own theme irrespective of user choice. This menu manager is also specialised for some but not all, smartphones. Use another menu manager if you experience problems with yours. Module50200Name=PayPal -Permission300=Read barcodes -Permission301=Create/modify barcodes -Permission302=Delete barcodes DictionaryAccountancyJournal=Finance journals CompanyZip=Postcode LDAPFieldZip=Postcode diff --git a/htdocs/langs/en_GB/companies.lang b/htdocs/langs/en_GB/companies.lang index db4c81a57bd..560fcec6832 100644 --- a/htdocs/langs/en_GB/companies.lang +++ b/htdocs/langs/en_GB/companies.lang @@ -1,3 +1,2 @@ # Dolibarr language file - Source file is en_US - companies Zip=Postcode -Gencod=Barcode diff --git a/htdocs/langs/en_GB/errors.lang b/htdocs/langs/en_GB/errors.lang index 77442968d1a..24123f479a8 100644 --- a/htdocs/langs/en_GB/errors.lang +++ b/htdocs/langs/en_GB/errors.lang @@ -1,4 +1,2 @@ # Dolibarr language file - Source file is en_US - errors ErrorBadBarCodeSyntax=Bad syntax for barcode. Perhaps you selected the wrong barcode type or you defined a barcode mask for numbering that does not match the value scanned. -ErrorBarCodeRequired=Barcode required -ErrorBarCodeAlreadyUsed=Barcode already used diff --git a/htdocs/langs/en_GB/products.lang b/htdocs/langs/en_GB/products.lang index 398b1e76bde..fc9c683916c 100644 --- a/htdocs/langs/en_GB/products.lang +++ b/htdocs/langs/en_GB/products.lang @@ -1,5 +1,3 @@ # Dolibarr language file - Source file is en_US - products -BarCodePrintsheet=Print barcode PageToGenerateBarCodeSheets=With this tool, you can print sheets of barcode labels. Choose format of your label page, type of barcode and value of barcode, then click on button %s. PrintsheetForOneBarCode=Print several labels for one barcode -DefinitionOfBarCodeForProductNotComplete=Definition of type or value of barcode not complete for product %s. diff --git a/htdocs/langs/es_CL/admin.lang b/htdocs/langs/es_CL/admin.lang index 93ee3101ef4..ec427601415 100644 --- a/htdocs/langs/es_CL/admin.lang +++ b/htdocs/langs/es_CL/admin.lang @@ -931,7 +931,6 @@ FCKeditorForProduct=WYSIWIG creación / edición de productos / servicios descri FCKeditorForMailing=Creación / edición WYSIWIG para eMailings masivos (Herramientas-> eMailing) FCKeditorForUserSignature=Creación / edición WYSIWIG de la firma del usuario FCKeditorForMail=Creación / edición WYSIWIG para todo el correo (excepto Herramientas-> correo electrónico) -OSCommerceTestKo2=La conexión al servidor '%s' con el usuario '%s' falló. StockSetup=Configuración del módulo de stock MenuDeleted=Menú borrado NotTopTreeMenuPersonalized=Menús personalizados no vinculados a una entrada del menú superior diff --git a/htdocs/langs/es_CL/main.lang b/htdocs/langs/es_CL/main.lang index 9bb6dd7f295..9dbe998903c 100644 --- a/htdocs/langs/es_CL/main.lang +++ b/htdocs/langs/es_CL/main.lang @@ -313,7 +313,6 @@ MailSentBy=Correo electrónico enviado por TextUsedInTheMessageBody=Cuerpo del correo electronico SendAcknowledgementByMail=Enviar correo electrónico de confirmación SendMail=Enviar correo electrónico -EMail=Email NoEMail=Sin correo electrónico FollowingConstantsWillBeSubstituted=Las siguientes constantes se reemplazarán por el valor correspondiente. BackToList=Volver a la lista diff --git a/htdocs/langs/es_EC/admin.lang b/htdocs/langs/es_EC/admin.lang index 4da30a203a0..1ee4ce793e6 100644 --- a/htdocs/langs/es_EC/admin.lang +++ b/htdocs/langs/es_EC/admin.lang @@ -975,7 +975,6 @@ FCKeditorForProduct=WYSIWIG creación / edición de productos / servicios descri FCKeditorForMailing= WYSIWIG creación / edición para eMailings masivos (Herramientas->eMailing) FCKeditorForUserSignature=WYSIWIG creación / edición de firma de usuario FCKeditorForMail=WYSIWIG Creación / edición para todo el correo (excepto Herramientas->eMailing) -OSCommerceTestKo2=Conexión al servidor '%s' con el usuario '%s' falló. StockSetup=Configuración del módulo de stock/inventario NotTopTreeMenuPersonalized=Menús personalizados no vinculados a una entrada de menú superior Menu=Selección del menú diff --git a/htdocs/langs/es_EC/main.lang b/htdocs/langs/es_EC/main.lang index d391ac58b14..4f2591c0c42 100644 --- a/htdocs/langs/es_EC/main.lang +++ b/htdocs/langs/es_EC/main.lang @@ -342,7 +342,6 @@ MailSentBy=Correo electrónico enviado por TextUsedInTheMessageBody=Cuerpo del correo electronico SendAcknowledgementByMail=Enviar correo electrónico de confirmación SendMail=Enviar correo electrónico -EMail=Correo electrónico NoEMail=Sin correo electrónico Email=Correo electrónico NotRead=No leer diff --git a/htdocs/langs/es_MX/main.lang b/htdocs/langs/es_MX/main.lang index 5d9a6b2fcda..aa4bac2bdb1 100644 --- a/htdocs/langs/es_MX/main.lang +++ b/htdocs/langs/es_MX/main.lang @@ -182,7 +182,6 @@ FeatureNotYetSupported=Característica aún no soportada SendByMail=Enviar por correo electrónico MailSentBy=Correo electrónico enviado por TextUsedInTheMessageBody=Cuerpo del correo electronico -EMail=Email NoEMail=Sin correo electrónico FollowingConstantsWillBeSubstituted=Las siguientes constantes serán reemplazadas con el valor correspondiente. Refresh=Actualizar diff --git a/htdocs/langs/fr_CA/main.lang b/htdocs/langs/fr_CA/main.lang index c7466f9df38..6776c458708 100644 --- a/htdocs/langs/fr_CA/main.lang +++ b/htdocs/langs/fr_CA/main.lang @@ -99,7 +99,6 @@ MonthVeryShort09=D NbOfObjectReferers=Nombre d'articles connexes Referers=Articles connexes SendAcknowledgementByMail=Envoyer un email de confirmation -EMail=Courriel ValueIsNotValid=La valeur n'est pas valide RecordsModified=%s enregistrement modifié RecordsDeleted=%s enregistrement(s) supprimé(s) diff --git a/htdocs/langs/pt_BR/admin.lang b/htdocs/langs/pt_BR/admin.lang index ed1f3794eec..3a6fbb39347 100644 --- a/htdocs/langs/pt_BR/admin.lang +++ b/htdocs/langs/pt_BR/admin.lang @@ -1016,8 +1016,6 @@ FCKeditorForProduct=Criação/edição do WYSIWIG nas descrições de produtos/ FCKeditorForMailing=Criação/edição do WYSIWIG nos E-Mails massivos (ferramentas->emailing) FCKeditorForUserSignature=criação/edição do WYSIWIG nas assinaturas de usuários FCKeditorForMail=Criação/Edição WYSIWIG para todos os e-mails (exceto Ferramentas->eMailing) -OSCommerceTestOk=Conexão para o servidor '%s' no banco de dados '%s' com o usuário '%s' foi bem sucedida. -OSCommerceTestKo2=Conexão ao servidor '%s' com o usuário '%s' falhou. MenuDeleted=Menu Deletado NotTopTreeMenuPersonalized=Menus personalizados não conectados à uma entrada do menu superior NewMenu=Novo Menu From 9ba6e3f8f57c4e0c8c468653f9f9b8ce0c54b879 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Feb 2019 15:57:57 +0100 Subject: [PATCH 080/190] FIX #10638 --- htdocs/accountancy/class/accountancycategory.class.php | 7 ++++--- htdocs/compta/resultat/result.php | 4 ++-- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 5b3282a3b29..a6c9f09c7cb 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -720,7 +720,7 @@ class AccountancyCategory // extends CommonObject * @param int|array $cpt Accounting account or array of accounting account * @param string $date_start Date start * @param string $date_end Date end - * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit + * @param int $sens Sens of the account: 0: credit - debit (use this by default), 1: debit - credit * @param string $thirdparty_code Thirdparty code * @param int $month Specifig month - Can be empty * @param int $year Specifig year - Can be empty @@ -805,7 +805,7 @@ class AccountancyCategory // extends CommonObject exit(); } - $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; + $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " WHERE c.active = 1"; $sql .= " AND c.entity = " . $conf->entity; @@ -829,7 +829,8 @@ class AccountancyCategory // extends CommonObject 'label' => $obj->label, 'formula' => $obj->formula, 'position' => $obj->position, - 'category_type' => $obj->category_type + 'category_type' => $obj->category_type, + 'bc' => $obj->sens ); $i++; } diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 16d2631686c..d3ec7082bfb 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -405,7 +405,7 @@ elseif ($modecompta=="BOOKKEEPING") // N-1 if (! empty($arrayofaccountforfilter)) { - $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cpt['dc']?$cpt['dc']:0); + $return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cat['dc']?$cat['dc']:0); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); @@ -438,7 +438,7 @@ elseif ($modecompta=="BOOKKEEPING") if (($k+1) < $start_month) $yeartoprocess++; //var_dump($monthtoprocess.'_'.$yeartoprocess); - $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']?$cpt['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess); + $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cat['dc']?$cat['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess); if ($return < 0) { setEventMessages(null, $AccCat->errors, 'errors'); $resultM=0; diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index f2a8ca9f380..8e9d82c5fd1 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -266,6 +266,12 @@ CREATE TABLE llx_pos_cash_fence( UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; +-- Delete duplicate accounting account not used + + ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); + + + From d7ffcca59bbb312cdb3e08598637d7d37ddccd1a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Feb 2019 12:35:13 +0100 Subject: [PATCH 081/190] FIX fetch module / pos source --- htdocs/compta/facture/class/facture.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 2fb31440e56..fd050297fe5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1324,6 +1324,7 @@ class Facture extends CommonInvoice $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', f.fk_incoterms, f.location_incoterms'; + $sql.= ', f.module_source, f.pos_source'; $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; @@ -1357,7 +1358,7 @@ class Facture extends CommonInvoice $this->date_pointoftax = $this->db->jdate($obj->date_pointoftax); $this->date_creation = $this->db->jdate($obj->datec); $this->date_validation = $this->db->jdate($obj->datev); - $this->date_modification = $this->db->jdate($obj->datem); + $this->date_modification = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem); $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; @@ -1396,9 +1397,12 @@ class Facture extends CommonInvoice $this->extraparams = (array) json_decode($obj->extraparams, true); //Incoterms - $this->fk_incoterms = $obj->fk_incoterms; - $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->fk_incoterms = $obj->fk_incoterms; + $this->location_incoterms = $obj->location_incoterms; + $this->libelle_incoterms = $obj->libelle_incoterms; + + $this->module_source = $obj->module_source; + $this->pos_source = $obj->pos_source; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; From f1e4c8077119fb9ced89c5dce71e77dc7b43f5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 16:39:15 +0100 Subject: [PATCH 082/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index afecfd33b45..cf3bb133558 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -587,7 +587,7 @@ class Invoices extends DolibarrApi * * @param int $id Id of invoice * @param array $request_data InvoiceLine data - * + *$this->db->begin(); * @url POST {id}/lines * * @return int @@ -940,8 +940,6 @@ class Invoices extends DolibarrApi throw new RestException(401); } - $this->db->begin(); - $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Invoice not found'); @@ -958,10 +956,14 @@ class Invoices extends DolibarrApi if (! $this->invoice->paye) // protection against multiple submit { + $this->db->begin(); $this->invoice->fetch_lines(); // Loop on each vat rate $i=0; + $amount_ht = array(); + $amount_tva = array(); + $amount_ttc = array(); foreach($this->invoice->lines as $line) { $amount_ht[$line->tva_tx]+=$line->total_ht; @@ -1009,14 +1011,14 @@ class Invoices extends DolibarrApi } else { - throw new RestException(500, 'Could not set paid'); $this->db->rollback(); + throw new RestException(500, 'Could not set paid'); } } else { - throw new RestException(500, 'Discount creation error'); $this->db->rollback(); + throw new RestException(500, 'Discount creation error'); } } From 0e093ffb243b72eeb8044df4c12464520ff4c282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 16:41:40 +0100 Subject: [PATCH 083/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index cf3bb133558..7f97658fe8a 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -239,7 +239,7 @@ class Invoices extends DolibarrApi * * @param int $orderid Id of the order * - * @url POST /createfromorder/{orderid} +$this->db->begin(); * @url POST /createfromorder/{orderid} * * @return int * @throws 400 @@ -393,7 +393,7 @@ class Invoices extends DolibarrApi } $result = $this->invoice->fetch($id); - +$this->db->begin(); if(!$result) { throw new RestException(404, 'Invoice not found'); } @@ -587,7 +587,7 @@ class Invoices extends DolibarrApi * * @param int $id Id of invoice * @param array $request_data InvoiceLine data - *$this->db->begin(); + * * @url POST {id}/lines * * @return int From 4b0b8e1c1f1e6882123694e15cd26f57f3a0ad81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 16:44:36 +0100 Subject: [PATCH 084/190] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 7f97658fe8a..0ec6dc19c2f 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -239,7 +239,7 @@ class Invoices extends DolibarrApi * * @param int $orderid Id of the order * -$this->db->begin(); * @url POST /createfromorder/{orderid} + * @url POST /createfromorder/{orderid} * * @return int * @throws 400 @@ -393,7 +393,7 @@ $this->db->begin(); * @url POST /createfromorder/{orderid} } $result = $this->invoice->fetch($id); -$this->db->begin(); + if(!$result) { throw new RestException(404, 'Invoice not found'); } From 9dd58cf9cece6868b77f0501a2811fe57c51b28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 16:52:26 +0100 Subject: [PATCH 085/190] Update html.formfile.class.php --- htdocs/core/class/html.formfile.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 6e7914d9206..d5b7b03ae42 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -7,7 +7,8 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2016-2017 Ferran Marcet - + * 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 * the Free Software Foundation; either version 3 of the License, or @@ -271,7 +272,7 @@ class FormFile * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) - * @param int $genallowed Generation is allowed (1/0 or array list of templates) + * @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates) * @param int $delallowed Remove is allowed (1/0) * @param string $modelselected Model to preselect by default * @param integer $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) From cdf5348b47c2212277f04323072de58932894805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 18:15:56 +0100 Subject: [PATCH 086/190] Update ajax.lib.php --- htdocs/core/lib/ajax.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index bf3626d3e5c..d7d8ee5a5ee 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -541,7 +541,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof /** * On/off button for object * - * @param int $object Id product to set + * @param Object $object Object to set * @param string $code Name of constant : status or status_buy for product by example * @param string $field Name of database field : tosell or tobuy for product by example * @param string $text_on Text if on From 70350231caf81ace1a04c2b77569176852e8c1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 18:49:28 +0100 Subject: [PATCH 087/190] Update accountancycategory.class.php --- htdocs/accountancy/class/accountancycategory.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 50084ba1af0..010f452755d 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016-2017 Alexandre Spangaro - * 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 @@ -661,13 +661,11 @@ class AccountancyCategory // extends CommonObject /** * Function to know all category from accounting account * - * @return array Result in table + * @return array|integer Result in table (array), -1 if KO */ public function getCatsCpts() { - global $mysoc,$conf; - - $sql = ""; + global $mysoc, $conf; if (empty($mysoc->country_id)) { dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); From 49c62a28a06b96d7922c691c278dbfa99be8608d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 18:58:23 +0100 Subject: [PATCH 088/190] Update html.formresource.class.php --- htdocs/resource/class/html.formresource.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 04b9a9f6f13..c850faaa5eb 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -1,5 +1,6 @@ + * 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 @@ -85,7 +86,7 @@ class FormResource $resourcestat = new Dolresource($this->db); - $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, $offset, $filter); + $resources_used = $resourcestat->fetch_all('ASC', 't.rowid', $limit, 0, $filter); if ($outputmode != 2) { @@ -194,17 +195,17 @@ class FormResource if ($empty && empty($arraytypes['code'])) continue; if ($format == 0) print ''; } From a497a81aac9a62991b452dc87c0e001cefc4bba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 19:09:27 +0100 Subject: [PATCH 089/190] Update api_contacts.class.php --- htdocs/societe/class/api_contacts.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 5b29e92b6dd..e6ba5c8beac 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015 Jean-François Ferry + * 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 @@ -177,16 +178,17 @@ class Contacts extends DolibarrApi { $num = $db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); + $i = 0; while ($i < $min) { $obj = $db->fetch_object($result); $contact_static = new Contact($db); if ($contact_static->fetch($obj->rowid)) { - if ($includecount) - { - $contact_static->load_ref_elements(); - } + if ($includecount) + { + $contact_static->load_ref_elements(); + } $obj_ret[] = $this->_cleanObjectDatas($contact_static); } From 6ba5708814627d346a3cf1d8d0a7c7d2e500c368 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 23 Feb 2019 19:26:52 +0100 Subject: [PATCH 090/190] disable online payment warehouse --- htdocs/stripe/admin/stripe.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 0c6e195910d..5e2c27dd392 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -94,9 +94,9 @@ if ($action == 'setvalue' && $user->admin) if (! $result > 0) $error ++; // Stock decrement - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_WAREHOUSE", (GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') > 0 ? GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); - if (! $result > 0) - $error ++; + //$result = dolibarr_set_const($db, "ONLINE_PAYMENT_WAREHOUSE", (GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') > 0 ? GETPOST('ONLINE_PAYMENT_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity); + //if (! $result > 0) + // $error ++; // Payment token for URL $result = dolibarr_set_const($db, "PAYMENT_SECURITY_TOKEN", GETPOST('PAYMENT_SECURITY_TOKEN', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -302,13 +302,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // TODO Not used by current code } // Warehouse for automatic decrement -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment -{ - print '
'; -} +//if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // warehouse to reduce stock for online payment +//{ +// print ''; +//} print ''; if ($action != 'progression' && $object->fk_statut < 8 && !$user->societe_id) { - print ''; + print ''; } print '
'; - print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; - print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); - print '
'; +// print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; +// print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE, 'ONLINE_PAYMENT_WAREHOUSE', '', 1, $disabled); +// print '
'; print $langs->trans("CSSUrlForPaymentForm").''; From 404f497ca4fe475860291541246a2dce5b50b5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 19:27:42 +0100 Subject: [PATCH 091/190] replace html code by html5 in ticket --- htdocs/ticket/card.php | 10 +++++----- htdocs/ticket/list.php | 8 ++++---- htdocs/ticket/stats/index.php | 12 ++++++------ htdocs/ticket/tpl/linkedobjectblock.tpl.php | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 631ee0d3c41..e9c73e321be 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -447,7 +447,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print $langs->trans('Progression') . ''; print '' . img_edit($langs->trans('Modify')) . '' . img_edit($langs->trans('Modify')) . '
'; print '
'; @@ -604,7 +604,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
' . $langs->trans("Contacts") . '
' . $langs->trans("ContactType") . '
' . $langs->trans("Phone") . '
-
' . $langs->trans("Status") . '
'; +
' . $langs->trans("Status") . '
'; print ''; // Contact list @@ -620,7 +620,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $var = !$var; print '
'; - print '
'; + print '
'; if ($tab[$i]['source'] == 'internal') { echo $langs->trans("User"); } @@ -630,7 +630,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } print '
'; - print '
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -669,7 +669,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''.price($totalarray['val'][$totalarray['pos'][$i]]).'
'; print ''; print '

'; print '
'; -print ''; +print '
'; print ''; -print ''; +print ''; print ''; print ''; //print ''; @@ -287,7 +287,7 @@ foreach ($data as $val) $oldyear--; print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -299,7 +299,7 @@ foreach ($data as $val) print ''; - print ''; + print ''; print ''; print ''; //print ''; @@ -318,7 +318,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("Year").''.$langs->trans("NbOfTickets").'%'.$langs->trans("AmountTotal").'
0?'&userid='.$userid:'').'">'.$oldyear.'0?'&userid='.$userid:'').'">'.$oldyear.'00
0?'&userid='.$userid:'').'">'.$year.'0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'], 'MT'), 1).'
'; if ($action != 'editdate_livraison' && ! empty($object->brouillon)) - print ''; + print ''; print '
'; +print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "\n"; @@ -96,10 +96,10 @@ foreach($extrafields->attribute_type as $key => $value) print "\n"; print "\n"; print "\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; print ""; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index b742b0379c5..ebc07e0b529 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1468,7 +1468,7 @@ if ($action == 'create') print $langs->trans('PaymentConditionsShort'); print ''; if ($action != 'editconditions' && ! empty($object->brouillon)) - print ''; + print ''; print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); diff --git a/htdocs/ticket/tpl/linkedobjectblock.tpl.php b/htdocs/ticket/tpl/linkedobjectblock.tpl.php index 21fe9aa78d8..3391437dbb1 100644 --- a/htdocs/ticket/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticket/tpl/linkedobjectblock.tpl.php @@ -37,9 +37,9 @@ print load_fiche_titre($langs->trans('RelatedTickets')); - - - + + + trans("ShowTicket"), "ticket") . ' ' . (! empty($object->subject) ? ' '.$object->subject : ''); ?> - + socid = $object->fk_soc; $object->fetch_thirdparty(); ?> - - + +
trans("Subject"); ?>trans("DateCreation"); ?>trans("Customer"); ?>trans("Status"); ?>trans("DateCreation"); ?>trans("Customer"); ?>trans("Status"); ?>
datec, 'day'); ?>datec, 'day'); ?> thirdparty->getNomUrl(1); ?>getLibstatut(2); ?>thirdparty->getNomUrl(1); ?>getLibstatut(2); ?>
From 452633e877779dd3c610cc59028429d65507f5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 19:43:28 +0100 Subject: [PATCH 092/190] replace html code by html5 in supplier_proposal --- htdocs/stripe/payment.php | 2 +- .../supplier_proposaldet_extrafields.php | 14 ++-- htdocs/supplier_proposal/card.php | 20 ++--- htdocs/supplier_proposal/index.php | 20 ++--- htdocs/supplier_proposal/list.php | 78 +++++++++---------- .../tpl/linkedobjectblock.tpl.php | 18 ++--- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 50d64521621..48adfa2b2b3 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -80,7 +80,7 @@ if ($facid > 0) if (! empty($conf->stripe->enabled)) { - access_forbidden(); + access_forbidden(); } if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) diff --git a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php index 99a00668926..b3b0e482f62 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php @@ -84,9 +84,9 @@ print '
'.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print ''.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; print "  ".img_delete()."
id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '
'; print '
'; if ($action == 'editconditions') { @@ -1486,7 +1486,7 @@ if ($action == 'create') print $langs->trans('DeliveryDate'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'), 1) . '
'; print ''; if ($action == 'editdate_livraison') { @@ -1509,7 +1509,7 @@ if ($action == 'create') print $langs->trans('PaymentMode'); print ''; if ($action != 'editmode' && ! empty($object->brouillon)) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . ''; print ''; print ''; if ($action == 'editmode') { @@ -1529,7 +1529,7 @@ if ($action == 'create') print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencycode') { @@ -1546,7 +1546,7 @@ if ($action == 'create') print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { @@ -1571,7 +1571,7 @@ if ($action == 'create') // Outstanding Bill print ''; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print ''; @@ -1586,7 +1586,7 @@ if ($action == 'create') print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->supplier_proposal->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; print ''; print ''; if ($action == 'editbankaccount') { @@ -1739,7 +1739,7 @@ if ($action == 'create') if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '

'.$langs->trans('SupplierProposalRefFournNotice').'

'; // TODO Suggest a permanent checkbox instead of option $form_close .= ''; $form_close .= ''; - $form_close .= ''; - $form_close .= ''; - $form_close .= ''; print ''; - print ''; + print ''; print "\n"; } } if ($conf->use_javascript_ajax) { - print ''; } - print ''; + print ''; print "
' . $langs->trans("CloseAs") . ''; + $form_close .= '
' . $langs->trans("CloseAs") . ''; $form_close .= ''; $form_close .= ''; $form_close .= '
' . $langs->trans('Note') . '
'; + $form_close .= '
'; $form_close .= ''; $form_close .= '   '; $form_close .= ' '; diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 38146c95645..5a2e6df2f29 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -125,13 +125,13 @@ if ($resql) { print '
'.$supplier_proposalstatic->LibStatut($status, 0).''.(isset($vals[$status])?$vals[$status]:0).''.(isset($vals[$status])?$vals[$status]:0).'
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -146,7 +146,7 @@ if ($resql) print '
'.$langs->trans("Total").''.$total.'
'.$langs->trans("Total").''.$total.'

"; } else @@ -256,7 +256,7 @@ if ($resql) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -272,7 +272,7 @@ if ($resql) print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.dol_print_date($db->jdate($obj->datec), 'day').''; - print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).''; + print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 5).''; print ''; $i++; } @@ -333,7 +333,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos print ''; if ($db->jdate($obj->dfv) < ($now - $conf->supplier_proposal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->supplier_proposalid; @@ -348,10 +348,10 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos $companystatic->canvas=$obj->canvas; print ''.$companystatic->getNomUrl(1, 'customer', 44).''."\n"; - print ''; + print ''; print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; - print ''.price($obj->total_ttc).''; - print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).''."\n"; + print ''.price($obj->total_ttc).''; + print ''.$supplier_proposalstatic->LibStatut($obj->fk_statut, 3).''."\n"; print ''."\n"; $i++; $total += $obj->total_ttc; @@ -362,7 +362,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos } elseif ($total>0) { - print ''.$langs->trans("Total")."".price($total)." "; + print ''.$langs->trans("Total").''.price($total)." "; } print "
"; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 38741bfaf5a..2af2c15f66d 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -476,7 +476,7 @@ if ($resql) } if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; print ''; print ''; } @@ -492,21 +492,21 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } // Date if (! empty($arrayfields['sp.date_valid']['checked'])) { - print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -517,7 +517,7 @@ if ($resql) // Date if (! empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -529,28 +529,28 @@ if ($resql) if (! empty($arrayfields['sp.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['sp.total_vat']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['sp.total_ttc']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['u.login']['checked'])) { // Author - print ''; + print ''; print ''; print ''; } @@ -575,12 +575,12 @@ if ($resql) // Status if (! empty($arrayfields['sp.fk_statut']['checked'])) { - print ''; + print ''; $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'supplier', 'search_status'); print ''; } // Action column - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -594,24 +594,24 @@ if ($resql) if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.date_valid']['checked'])) print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['sp.date_valid']['checked'])) print_liste_field_titre($arrayfields['sp.date_valid']['label'], $_SERVER["PHP_SELF"], 'sp.date_valid', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '; + if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['sp.datec']['checked'])) print_liste_field_titre($arrayfields['sp.datec']['label'], $_SERVER["PHP_SELF"], "sp.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.tms']['checked'])) print_liste_field_titre($arrayfields['sp.tms']['label'], $_SERVER["PHP_SELF"], "sp.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['sp.fk_statut']['checked'])) print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['sp.datec']['checked'])) print_liste_field_titre($arrayfields['sp.datec']['label'], $_SERVER["PHP_SELF"], "sp.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['sp.tms']['checked'])) print_liste_field_titre($arrayfields['sp.tms']['label'], $_SERVER["PHP_SELF"], "sp.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap'); + if (! empty($arrayfields['sp.fk_statut']['checked'])) print_liste_field_titre($arrayfields['sp.fk_statut']['label'], $_SERVER["PHP_SELF"], "sp.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print ''."\n"; $now = dol_now(); @@ -654,7 +654,7 @@ if ($resql) print ''; } // Other picto tool - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -707,7 +707,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; @@ -716,7 +716,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; @@ -726,7 +726,7 @@ if ($resql) // Date proposal if (! empty($arrayfields['sp.date_valid']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_valid), 'day'); print "\n"; if (! $i) $totalarray['nbfield']++; @@ -735,7 +735,7 @@ if ($resql) // Date delivery if (! empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->dp), 'day'); print "\n"; if (! $i) $totalarray['nbfield']++; @@ -744,7 +744,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['sp.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -752,7 +752,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['sp.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -760,7 +760,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['sp.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -772,7 +772,7 @@ if ($resql) // Author if (! empty($arrayfields['u.login']['checked'])) { - print ''; + print ''; if ($userstatic->id) print $userstatic->getLoginUrl(1); else print ' '; print "\n"; @@ -788,7 +788,7 @@ if ($resql) // Date creation if (! empty($arrayfields['sp.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -796,7 +796,7 @@ if ($resql) // Date modification if (! empty($arrayfields['sp.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -804,12 +804,12 @@ if ($resql) // Status if (! empty($arrayfields['sp.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5)."\n"; + print ''.$objectstatic->LibStatut($obj->fk_statut, 5)."\n"; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -845,9 +845,9 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; else print ''; } print ''; diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index 4a2a028777e..bd2a94d1c32 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -47,14 +47,14 @@ foreach($linkedObjectBlock as $key => $objectlink) trans("SupplierProposal"); ?> trans("ShowSupplierProposal"), "supplier_proposal").' '.$objectlink->ref; ?> - datec, 'day'); ?> - datec, 'day'); ?> + rights->supplier_proposal->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?> - getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + getLibStatut(3); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> 1) trans("Total"); ?> - - - - - + + + + + Date: Sat, 23 Feb 2019 19:44:04 +0100 Subject: [PATCH 093/190] replace html code by html5 in supplier_proposal --- .../admin/supplier_proposal_extrafields.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php index 3a0f1eed273..1b5c08119d1 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php @@ -76,13 +76,13 @@ $extrafields->fetch_name_optionals_label($elementtype); print ""; print ''; -print ''; +print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "\n"; @@ -93,10 +93,10 @@ foreach($extrafields->attribute_type as $key => $value) print "\n"; print "\n"; print "\n"; - print '\n"; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; print ""; // $i++; From c000f03e5663885e347df68bf73b73e8d926a655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 19:55:06 +0100 Subject: [PATCH 094/190] replace html code by html5 in stripe --- htdocs/stripe/charge.php | 20 +++--- htdocs/stripe/class/actions_stripe.class.php | 8 +-- htdocs/stripe/payment.php | 66 ++++++++++---------- htdocs/stripe/payout.php | 22 +++---- htdocs/stripe/transaction.php | 33 +++++----- 5 files changed, 75 insertions(+), 74 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 83cbe2755a1..fb122948dd0 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -101,10 +101,10 @@ if (!$rowid) print_liste_field_titre("StripeCustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $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("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print "\n"; print "\n"; @@ -149,9 +149,9 @@ if (!$rowid) } print ''; - + if (!empty($stripeacc)) $connect=$stripeacc.'/'; - + // Ref $url='https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; if ($servicestatus) @@ -169,7 +169,7 @@ if (!$rowid) $url='https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; } print ''.img_picto($langs->trans('ShowInStripe'), 'object_globe').' '.$charge->customer.''; - + print "\n"; // Link print "\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Amount - print ""; + print '"; // Status - print ''; @@ -114,7 +114,7 @@ class ActionsStripeconnect $this->resprints.= ''; $this->resprints.= ''; $this->resprints.= ''; diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 48adfa2b2b3..b909347f007 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -633,7 +633,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie foreach ($customerstripe->sources->data as $src) { print ''; - print ''; // Default - print ''; - print ''; // Default - print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -459,17 +459,17 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ""; print ""; - print '"; - print '"; - print '"; - print '"; - print ''; - print ''; + print '"; + print '"; + print '"; + print '"; + print ''; + print ''; // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); - print ''; } @@ -529,13 +529,13 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; print ''; @@ -545,7 +545,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print ''; // Print the search button - print ''; @@ -564,24 +564,24 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ""; print ""; - print '"; - print '"; - print '"; - print '"; - print ''; - print ''; + print '"; + print '"; + print '"; + print '"; + print ''; + print ''; // User $userstatic = new User($db); $userstatic->fetch($line->fk_user); - print ''; // Action if ($user->rights->produit->creer || $user->rights->service->creer) { - print '\n"; $i=0; @@ -305,7 +305,7 @@ if ($id > 0 || ! empty($ref)) // End of subscription date if ($datefin) { - print ''; @@ -414,7 +414,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; print ''."\n"; @@ -473,7 +473,7 @@ while ($i < min($num, $limit)) $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''."\n"; print ' '; print ' '; print ' '; -print ' '; -print ' '; +print ' '; +print ' '; print "\n"; foreach ($dirsociete as $dirroot) @@ -395,7 +395,7 @@ foreach ($dirsociete as $dirroot) if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file") { - print '\n"; } @@ -403,14 +403,14 @@ foreach ($dirsociete as $dirroot) { $disabled = false; if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); - print ''; } - print ''; @@ -437,8 +437,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; foreach ($dirsociete as $dirroot) @@ -472,17 +472,17 @@ foreach ($dirsociete as $dirroot) if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file") { - print ''; } else { - print ''; } - print ''; @@ -530,9 +530,9 @@ print '
'.$langs->trans("Position").''.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."'.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; + print ''.$extrafields->attribute_size[$key]."'.yn($extrafields->attribute_unique[$key])."'.yn($extrafields->attribute_required[$key])."'.img_edit().''; print "  ".img_delete()."
"; @@ -199,7 +199,7 @@ if (!$rowid) } else print $FULLTAG; print "'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."'.dol_print_date($charge->created, '%d/%m/%Y %H:%M')."'; if ($charge->source->object=='card') @@ -213,9 +213,9 @@ if (!$rowid) } print '".price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'.price(($charge->amount-$charge->amount_refunded)/100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."'; + print ''; if ($charge->refunded=='1'){ print img_picto($langs->trans("refunded"), 'statut6'); } elseif ($charge->paid=='1'){ diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 408d47a407c..598cb19dd62 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -95,7 +95,7 @@ class ActionsStripeconnect $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('StripeCustomer'); - $this->resprints.= ''; + $this->resprints.= ''; // $this->resprints.= ''.img_edit().''; $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('StripeCustomer'); - $this->resprints.= ''; + $this->resprints.= ''; $this->resprints.= '
'; $this->resprints.= '
'; @@ -132,7 +132,7 @@ class ActionsStripeconnect $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('SubscriptionStripe'); - $this->resprints.= ''; + $this->resprints.= ''; $this->resprints.= '
'; $this->resprints.= '
'; @@ -151,7 +151,7 @@ class ActionsStripeconnect $this->resprints.= '
'; $this->resprints.= '
'; $this->resprints.= $langs->trans('PlanStripe'); - $this->resprints.= ''; + $this->resprints.= ''; // $this->resprints.= ''.img_edit().''; $this->resprints.= '
'; $this->resprints.= '
id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"'; } @@ -697,7 +697,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print 'id!=$source) or ($src->object=='source' && $src->card->three_d_secure=='required')) { print'class="opacitymedium"'; } @@ -716,7 +716,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (($account->type=='custom' or $account->type=='express') && $entity==1) { print '
getStripeCustomerAccount($facture->socid)!=$source) { print'class="opacitymedium"'; } @@ -745,7 +745,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print 'id!=$source) { print'class="opacitymedium"'; } @@ -823,21 +823,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; - print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''; } - print ''; + print ''; print "\n"; $total=0; @@ -878,20 +878,20 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print "\n"; // Date - print '\n"; + print '\n"; // Currency - if (!empty($conf->multicurrency->enabled)) print '\n"; + if (!empty($conf->multicurrency->enabled)) print '\n"; // Multicurrency Price if (!empty($conf->multicurrency->enabled)) { - print ''; // Multicurrency Price - print ''; // Multicurrency Price - print ''; } // Price - print ''; + print ''; // Received or paid back - print ''; // Remain to take or to pay back - print ''; + print ''; //$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits)); // Amount - print ''; - print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { print ''; print ''; print ''; } - print ''; - print ''; + print ''; - print ''; - print ''; + print ''; + print ''; if (!empty($conf->multicurrency->enabled)) { - print ''; + print ''; } print "\n"; } @@ -1105,7 +1105,7 @@ if (! GETPOST('action')) print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'ref', '', '', '', $sortfield, $sortorder); print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'dp', '', '', '', $sortfield, $sortorder); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'libelle', '', '', '', $sortfield, $sortorder); - print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; @@ -1116,7 +1116,7 @@ if (! GETPOST('action')) print '\n"; print '\n"; print '\n"; - print ''; + print ''; $parameters=array(); $reshook=$hookmanager->executeHooks('printObjectLine', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 2fec924c2bf..0149775c360 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -103,12 +103,12 @@ if (! $rowid) { //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("DateOperation", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", "", 'align="left"', $sortfield, $sortorder); - print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateOperation", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print "\n"; print "\n"; @@ -198,16 +198,16 @@ if (! $rowid) { //} //print "\n"; // Date payment - print '\n"; + print '\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Amount - print ""; - print ""; + print '"; + print '"; // Status - print "\n"; print "\n"; @@ -161,7 +161,7 @@ if (! $rowid) { // Ref if (!empty($stripeacc)) $connect=$stripeacc.'/'; - + // Ref if (preg_match('/po_/i', $txn->source)){ $origin="payouts"; @@ -207,20 +207,21 @@ if (! $rowid) { //} //print "\n"; // Date payment - print '\n"; + print '\n"; // Type print ''; // Amount - print ""; - print ""; + print '"; + print '"; // Status - print "'; print "\n"; } From c1c61031387dc366132124a74de144cbfb8fd664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 21:02:39 +0100 Subject: [PATCH 095/190] replace html code by html5 in societe --- htdocs/societe/list.php | 74 +++++++++++++++---------------- htdocs/societe/paymentmodes.php | 26 +++++------ htdocs/societe/price.php | 62 +++++++++++++------------- htdocs/societe/societecontact.php | 6 +-- htdocs/societe/website.php | 6 +-- htdocs/supplier_proposal/list.php | 2 +- 6 files changed, 88 insertions(+), 88 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 99a7dbd9a1c..cf42b59f558 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -737,21 +737,21 @@ if (! empty($arrayfields['region.nom']['checked'])) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } // Staff if (! empty($arrayfields['staff.code']['checked'])) { - print ''; } @@ -836,7 +836,7 @@ if (! empty($arrayfields['s.tva_intra']['checked'])) // Type (customer/prospect/supplier) if (! empty($arrayfields['customerorsupplier']['checked'])) { - print ''; @@ -844,14 +844,14 @@ if (! empty($arrayfields['customerorsupplier']['checked'])) // Prospect level if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { - print ''; } // Prospect status if (! empty($arrayfields['s.fk_stcomm']['checked'])) { - print ''; } @@ -899,7 +899,7 @@ if (! empty($arrayfields['s.import_key']['checked'])) print ''; } // Action column -print ''; @@ -919,35 +919,35 @@ if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titr if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder); -if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, 'class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'class="nowrap"', $sortfield, $sortorder); +if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"), $textprofid[3], 1, 0), $_SERVER["PHP_SELF"], "s.ape", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof4", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap '); +if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap '); if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'], $_SERVER["PHP_SELF"], "s.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'], $_SERVER["PHP_SELF"], "s.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'], $_SERVER["PHP_SELF"], "s.status", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'], $_SERVER["PHP_SELF"], "s.import_key", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -1057,7 +1057,7 @@ while ($i < min($num, $limit)) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -1066,7 +1066,7 @@ while ($i < min($num, $limit)) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -1075,7 +1075,7 @@ while ($i < min($num, $limit)) // Staff if (! empty($arrayfields['staff.code']['checked'])) { - print ''; @@ -1139,7 +1139,7 @@ while ($i < min($num, $limit)) // Type if (! empty($arrayfields['customerorsupplier']['checked'])) { - print '"; if (! $i) $totalarray['nbfield']++; @@ -1178,7 +1178,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['s.fk_stcomm']['checked'])) { // Prospect status - print ''; if (! $i) $totalarray['nbfield']++; @@ -1219,7 +1219,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['s.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1227,7 +1227,7 @@ while ($i < min($num, $limit)) // Status if (! empty($arrayfields['s.status']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['s.import_key']['checked'])) @@ -1239,7 +1239,7 @@ while ($i < min($num, $limit)) } // Action column - print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; // Hook fields @@ -905,7 +905,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; print ''; // Default - print ''; // Default - print '\n"; @@ -1177,7 +1177,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } // Default - print ''; // Generate doc - print ''; // Edit/Delete - print '
'.$arraytitle.''.$langs->trans('Date').''.$langs->trans('Date').''.$langs->trans('Currency').''.$langs->trans('MulticurrencyAmountTTC').''.$multicurrencyalreadypayedlabel.''.$multicurrencyremaindertopay.''.$langs->trans('MulticurrencyAmountTTC').''.$multicurrencyalreadypayedlabel.''.$multicurrencyremaindertopay.''.$langs->trans('AmountTTC').''.$alreadypayedlabel.''.$remaindertopay.''.$langs->trans('PaymentAmount').''.$langs->trans('AmountTTC').''.$alreadypayedlabel.''.$remaindertopay.''.$langs->trans('PaymentAmount').''.$langs->trans('MulticurrencyPaymentAmount').''.$langs->trans('MulticurrencyPaymentAmount').'  
'.dol_print_date($db->jdate($objp->df), 'day')."'.dol_print_date($db->jdate($objp->df), 'day')."'.$objp->multicurrency_code."'.$objp->multicurrency_code."'; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $objp->multicurrency_total_ttc); print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($sign * $multicurrency_payment); @@ -901,26 +901,26 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay); print ''.price($sign * $objp->total_ttc).''.price($sign * $objp->total_ttc).''.price($sign * $paiement); + print ''.price($sign * $paiement); if ($creditnotes) print '+'.price($creditnotes); if ($deposits) print '+'.price($deposits); print ''.price($sign * $remaintopay).''.price($sign * $remaintopay).''; + print ''; // Add remind amount $namef = 'amount_'.$objp->facid; @@ -943,7 +943,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Multicurrency Price if (! empty($conf->multicurrency->enabled)) { - print ''; + print ''; // Add remind multicurrency amount $namef = 'multicurrency_amount_'.$objp->facid; @@ -968,7 +968,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Warning - print ''; + print ''; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."
"; if ($amounts[$invoice->id] && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id])) || $multicurrency_amounts[$invoice->id] && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id]))) @@ -994,21 +994,21 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $amount=round(price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT'))*100); // Print total print '
'.$langs->trans('TotalTTC').''.$langs->trans('TotalTTC').''.price($sign * $total_ttc).''.price($sign * $totalrecu); + print ''.price($sign * $total_ttc).''.price($sign * $totalrecu); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'
'.$objp->ref."'.dol_print_date($db->jdate($objp->dp))."'.$objp->paiement_type.' '.$objp->num_paiement."'.price($objp->amount).' '.price($objp->amount).' 
' . dol_print_date($payout->created, '%d/%m/%Y %H:%M') . "' . dol_print_date($payout->created, '%d/%m/%Y %H:%M') . "' . dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M') . "' . dol_print_date($payout->arrival_date, '%d/%m/%Y %H:%M') . "' . $payout->description . '" . price(($payout->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "" . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "' . price(($payout->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "' . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . ""; + print ""; if ($payout->status=='paid') { print img_picto($langs->trans("".$payout->status.""), 'statut4'); } elseif ($payout->status=='pending') { diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index b0575a53ee4..d1ab2ebe50d 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -102,11 +102,11 @@ if (! $rowid) { //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); //print_liste_field_titre("CustomerId", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); //print_liste_field_titre("Origin", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); - print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", 'align="center"', $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("Fee", $_SERVER["PHP_SELF"], "", "", "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'align="right"'); + print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left '); + print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right_'); print "
' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "' . dol_print_date($txn->created, '%d/%m/%Y %H:%M') . "' . $txn->type . '" . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "" . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "' . price(($txn->amount) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . "' . price(($txn->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($txn->currency)) . ""; - if ($txn->status=='available') - {print img_picto($langs->trans("".$txn->status.""), 'statut4');} - elseif ($txn->status=='pending') - {print img_picto($langs->trans("".$txn->status.""), 'statut7');} - elseif ($txn->status=='failed') - {print img_picto($langs->trans("".$txn->status.""), 'statut8');} + print ""; + if ($txn->status=='available') { + print img_picto($langs->trans("".$txn->status.""), 'statut4'); + } elseif ($txn->status=='pending') { + print img_picto($langs->trans("".$txn->status.""), 'statut7'); + } elseif ($txn->status=='failed') { + print img_picto($langs->trans("".$txn->status.""), 'statut8'); + } print '
'; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; print $form->selectarray("search_staff", $formcompany->effectif_array(0), $search_staff, 0, 0, 0, '', 0, 0, 0, $sort, 'maxwidth100'); print ''; + print ''; if ($type != '') print ''; print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list'); print ''; + print ''; print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2); print ''; + print ''; $arraystcomm=array(); foreach($prospectstatic->cacheprospectstatus as $key => $val) { @@ -862,7 +862,7 @@ if (! empty($arrayfields['s.fk_stcomm']['checked'])) } if (! empty($arrayfields['s2.nom']['checked'])) { - print ''; + print ''; print ''; print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; if (! is_array($staffArray) || count($staffArray)==0) $staffArray = $formcompany->effectif_array(1); print $staffArray[$obj->staff_code]; print ''; + print ''; $s=''; if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { @@ -1169,7 +1169,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level - print ''; + print ''; print $companystatic->getLibProspLevel(); print "
'; + print '
'; print '
'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); print '
-
'; foreach($prospectstatic->cacheprospectstatus as $key => $val) @@ -1193,7 +1193,7 @@ while ($i < min($num, $limit)) // Parent company if (! empty($arrayfields['s2.nom']['checked'])) { - print '
'; + print ''; if ($companystatic->fk_parent > 0) { $companyparent->fetch($companystatic->fk_parent); @@ -1211,7 +1211,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['s.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$companystatic->getLibStatut(3).''.$companystatic->getLibStatut(3).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 20df70fda70..fff105d5985 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -772,7 +772,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ' '.img_picto($langs->trans('ShowInStripe'), 'object_globe').''; } - print ''; + print ''; if (empty($stripecu)) { print '
'; @@ -829,7 +829,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'.$langs->trans('Type').''.$langs->trans('Informations').''.$langs->trans('Default').''.$langs->trans('Default').''.$langs->trans('Note').''.$langs->trans('DateModification').''; + print ''; if (empty($companypaymentmodetemp->default_rib)) { print ''; @@ -927,7 +927,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($user->rights->societe->creer) { if ($stripecu && empty($companypaymentmodetemp->stripe_card_ref)) @@ -1034,7 +1034,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ''; + print ''; if (($customerstripe->default_source != $src->id)) { print ''; @@ -1057,7 +1057,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + print ''; if ($user->rights->societe->creer) { print ''; @@ -1103,8 +1103,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print print_liste_field_titre("RUM"); print print_liste_field_titre("WithdrawMode"); } - print_liste_field_titre("DefaultRIB", '', '', '', '', 'align="center"'); - print_liste_field_titre('', '', '', '', '', 'align="center"'); + print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre('', '', '', '', '', '', '', '', 'center '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "
'; + print ''; if (!$rib->default_rib) { print ''; print img_picto($langs->trans("Disabled"), 'off'); @@ -1188,7 +1188,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; + print ''; $buttonlabel = $langs->trans("BuildDoc"); $forname='builddocrib'.$rib->id; @@ -1244,7 +1244,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; + print ''; if ($user->rights->societe->creer) { print ''; @@ -1436,7 +1436,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -1483,7 +1483,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer) dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index c9342e2f41e..11930b3e009 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -319,7 +319,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
'; - print '
'; + print '
'; print ''; print '     '; print ''; @@ -440,13 +440,13 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print '
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx, true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print ''; print $userstatic->getLoginUrl(1); print '
' . $langs->trans("Product") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VAT") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . '' . $langs->trans("ChangedBy") . ' 
 '; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '" . $staticprod->getNomUrl(1) . "" . dol_print_date($line->datec, "dayhour") . "' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . '' . $langs->trans($line->price_base_type) . "' . vatrate($line->tva_tx.($line->default_vat_code?' ('.$line->default_vat_code.')':''), true, $line->recuperableonly) . "' . price($line->price) . "' . price($line->price_ttc) . "' . price($line->price_min) . '' . price($line->price_min_ttc) . ''; + print ''; print $userstatic->getLoginUrl(1); print ''; + print ''; print 'id . '&prodid=' . $line->fk_product . '">'; print img_info(); print ''; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index c86a23c9827..193703a8468 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -249,7 +249,7 @@ if ($id > 0 || ! empty($ref)) print_liste_field_titre("Person", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", '', $sortfield, $sortorder, 'center '); print "
'; + print ''; print dol_print_date($datefin, 'day'); if ($memberstatic->hasDelay()) { print " ".img_warning($langs->trans("SubscriptionLate")); @@ -314,7 +314,7 @@ if ($id > 0 || ! empty($ref)) } else { - print ''; + print ''; if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index ce25f23694f..d106e42aa3f 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -389,7 +389,7 @@ $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 2af2c15f66d..17dc033361e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -600,7 +600,7 @@ if ($resql) if (! empty($arrayfields['sp.date_livraison']['checked'])) print_liste_field_titre($arrayfields['sp.date_livraison']['label'], $_SERVER["PHP_SELF"], 'sp.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['sp.total_ht']['checked'])) print_liste_field_titre($arrayfields['sp.total_ht']['label'], $_SERVER["PHP_SELF"], 'sp.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['sp.total_vat']['checked'])) print_liste_field_titre($arrayfields['sp.total_vat']['label'], $_SERVER["PHP_SELF"], 'sp.total_vat', '', $param, '', $sortfield, $sortorder, 'right '); - if (! empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '; + if (! empty($arrayfields['sp.total_ttc']['checked'])) print_liste_field_titre($arrayfields['sp.total_ttc']['label'], $_SERVER["PHP_SELF"], 'sp.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; From 8b090c165e0655972a9589704cafc535337d45dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 21:18:44 +0100 Subject: [PATCH 096/190] replace html code by html5 in societe --- htdocs/societe/admin/societe.php | 78 +++++++++---------- .../canvas/company/tpl/card_create.tpl.php | 2 +- .../canvas/company/tpl/card_edit.tpl.php | 4 +- .../canvas/company/tpl/card_view.tpl.php | 8 +- .../canvas/individual/tpl/card_create.tpl.php | 2 +- .../canvas/individual/tpl/card_edit.tpl.php | 4 +- .../canvas/individual/tpl/card_view.tpl.php | 6 +- htdocs/societe/card.php | 6 +- htdocs/societe/consumption.php | 52 ++++++------- htdocs/societe/index.php | 20 ++--- htdocs/societe/notify/card.php | 10 +-- 11 files changed, 96 insertions(+), 96 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index ba6d8522ccf..4a614c02312 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -356,8 +356,8 @@ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'."\n"; + print ''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "'; + print ''; if (! $disabled) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); if (! $disabled) print ''; print ''; + print ''; $s=$modCodeTiers->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; $s=$modCodeCompta->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print "\n"; foreach ($dirsociete as $dirroot) @@ -577,7 +577,7 @@ foreach ($dirsociete as $dirroot) // Activate / Disable if (in_array($name, $def)) { - print ""; } else { - print ""; } @@ -616,12 +616,12 @@ foreach ($dirsociete as $dirroot) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1); - print ''; // Preview - print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ print 'scandir.'&label='.urlencode($module->name).'">'; @@ -594,13 +594,13 @@ foreach ($dirsociete as $dirroot) { if (versioncompare($module->phpmin, versionphparray()) > 0) { - print "\n"; + print "\n"; print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", join('.', $module->phpmin))), 'switch_off'); print "\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { $linkspec=''.img_object($langs->trans("Preview"), 'bill').''; @@ -653,9 +653,9 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print "\n"; $profid['IDPROF1'][0]=$langs->trans("ProfId1"); @@ -693,39 +693,39 @@ foreach($profid as $key => $val) if ($verif) { - print ''; } else { - print ''; } if ($mandatory) { - print ''; } else { - print ''; } if ($invoice_mandatory) { - print ''; } else { - print ''; } @@ -753,7 +753,7 @@ print '
'; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").''.$langs->trans("MustBeInvoiceMandatory").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").''.$langs->trans("MustBeInvoiceMandatory").'
'; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
'; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // Utilisation formulaire Ajax sur choix societe @@ -762,20 +762,20 @@ print ''; print ''; if (! $conf->use_javascript_ajax) { - print '"; } else { - print '"; } @@ -786,20 +786,20 @@ print ''; print ''; if (! $conf->use_javascript_ajax) { - print '"; } else { - print '"; } @@ -810,7 +810,7 @@ print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; -print ''; print ''; print ''; print ''; -print ''; print ''; -print ''; print ''; diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index 5007fe32af4..b2921b3108f 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -203,7 +203,7 @@ for ($i=1; $i<=4; $i++) { - +
".$langs->trans("Parameters")."'.$langs->trans("Value").''.$langs->trans("Value").' 
'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"), $langs->trans('UseSearchToSelectCompanyTooltip'), 1).' '; + print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; + print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); - print ''; + print ''; print ''; print "
'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"), $langs->trans('UseSearchToSelectContactTooltip'), 1).''; + print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; + print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); - print ''; + print ''; print ''; print "
'.$langs->trans("AddRefInList").' '; +print ''; if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { print ''; @@ -827,7 +827,7 @@ print '
'.$langs->trans("AddAdressInList").' '; +print ''; if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { print ''; @@ -846,7 +846,7 @@ print '
'.$langs->trans("AskForPreferredShippingMethod").' '; +print ''; if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { print ''; @@ -864,7 +864,7 @@ print '
'.$langs->trans("DisableProspectCustomerType").' '; +print ''; if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print ''; @@ -884,7 +884,7 @@ print ''.$langs->trans("DefaultCustomerType").''; print $formcompany->selectProspectCustomerType($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT, 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; +print ''; print ''; print '
diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index c00264be70c..7cb956e7b8c 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -216,7 +216,7 @@ for ($i=1; $i<=4; $i++) {

-
+
">     "> @@ -224,4 +224,4 @@ for ($i=1; $i<=4; $i++) { - \ No newline at end of file + diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index d75f4ccb464..46990231339 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -183,7 +183,7 @@ for ($i=1; $i<=4; $i++) { -
trans('RIB'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -201,7 +201,7 @@ for ($i=1; $i<=4; $i++) { - @@ -215,7 +215,7 @@ for ($i=1; $i<=4; $i++) {
trans('ParentCompany'); ?> +  
- - +
trans('SalesRepresentatives'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -288,4 +288,4 @@ $result=show_contacts($conf, $langs, $db, $soc); $result=show_projects($conf, $langs, $db, $soc); ?> - \ No newline at end of file + diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index b1d02006f16..9b401cbccb1 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -178,7 +178,7 @@ if (empty($conf) || ! is_object($conf))
diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index a26c834d355..10acd48aca8 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -178,7 +178,7 @@ if ($this->control->tpl['fournisseur']) {

-
+
">     "> @@ -186,4 +186,4 @@ if ($this->control->tpl['fournisseur']) { - \ No newline at end of file + diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index a5b247029c7..72514734fc1 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -142,7 +142,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); - \n"; // Type - print ''; // Last modified date - print '"; - print '"; print "\n"; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 47f25172e59..59c43551f41 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -260,7 +260,7 @@ if ($result > 0) $type=array('email'=>$langs->trans("EMail")); print $form->selectarray("typeid", $type); print ''; - print ''; + print ''; print ''; } else @@ -348,7 +348,7 @@ if ($result > 0) if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'sms') print $langs->trans("SMS"); print ''; - print ''; + print ''; print ''; $i++; } @@ -394,7 +394,7 @@ if ($result > 0) print ''; - print ''; + print ''; print ''; }*/ @@ -471,7 +471,7 @@ if ($result > 0) print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "n.type", '', $param, '', $sortfield, $sortorder); //print_liste_field_titre("Object",$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "n.daten", '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "n.daten", '', $param, '', $sortfield, $sortorder, 'right '); print ''; if ($num > 0) @@ -516,7 +516,7 @@ if ($result > 0) } print '';*/ // print - print''; + print''; print ''; $i++; } From be2cd6453753531a8ed3f1d184b4376625ee0e35 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 23 Feb 2019 21:20:32 +0100 Subject: [PATCH 097/190] Fix travis for recent PR --- htdocs/stripe/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 50d64521621..48adfa2b2b3 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -80,7 +80,7 @@ if ($facid > 0) if (! empty($conf->stripe->enabled)) { - access_forbidden(); + access_forbidden(); } if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) From 0ca5e6e275eb420a480bbb182b98bae50d90f64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 21:47:04 +0100 Subject: [PATCH 098/190] replace html code by html5 in reception --- htdocs/reception/card.php | 54 ++++++++--------- htdocs/reception/index.php | 4 +- htdocs/reception/list.php | 58 +++++++++---------- htdocs/reception/stats/index.php | 34 +++++------ .../reception/tpl/linkedobjectblock.tpl.php | 18 +++--- htdocs/resource/list.php | 10 ++-- 6 files changed, 89 insertions(+), 89 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index a24f85cecad..18b67fb1e4c 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -989,9 +989,9 @@ if ($action == 'create') { print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
trans('RIB'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -160,7 +160,7 @@ dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); - '; - print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; @@ -404,13 +404,13 @@ if ($sql_select) // Titles with sort buttons print ''; - print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); - print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('TotalHT', $_SERVER['PHP_SELF'], 'total_ht', '', $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre('UnitPrice', $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre('TotalHT', $_SERVER['PHP_SELF'], 'total_ht', '', $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre('UnitPrice', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; @@ -432,10 +432,10 @@ if ($sql_select) print ''; - print ''; + print ''; // Status - print ''; - print ''; + print ''; $total_qty+=$objp->prod_qty; - print ''; + print ''; $total_ht+=$objp->total_ht; - print ''; + print ''; print "\n"; $i++; @@ -611,9 +611,9 @@ if ($sql_select) print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print "
trans('SalesRepresentatives'); ?> + rights->societe->creer) { ?> control->tpl['image_edit']; ?> @@ -232,4 +232,4 @@ $result=show_contacts($conf, $langs, $db, $object); $result=show_projects($conf, $langs, $db, $object); ?> - \ No newline at end of file + diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a8a41527af0..dc3627c4922 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2160,7 +2160,7 @@ else dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -2506,7 +2506,7 @@ else print '
'; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->societe->creer) print ''.img_edit('', 1).''; else print ' '; print '
'; @@ -2545,7 +2545,7 @@ else print ''; - if ($action != 'editparentcompany') print ''; + if ($action != 'editparentcompany') print ''; print '
'; print $langs->trans('ParentCompany'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; print '
'; if ($action == 'editparentcompany') diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 225dacd4a38..5d7bd6e70ad 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -380,23 +380,23 @@ if ($sql_select) // Filters print '
'; + print ''; print ''; print ''; // date print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle'); $formother->select_year($year?$year:-1, 'year', 1, 20, 1); print ''; + print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; print $documentstatic->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dateprint), 'day').''.dol_print_date($db->jdate($objp->dateprint), 'day').''; + print ''; if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); @@ -596,13 +596,13 @@ if ($sql_select) //print ''.$prodreftxt.''.$objp->prod_qty.''.$objp->prod_qty.''.price($objp->total_ht).''.price($objp->total_ht).''.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).''.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).'
' . $langs->trans('Total') . '' . $total_qty . '' . price($total_ht) . '' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '' . $total_qty . '' . price($total_ht) . '' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '
"; print ''; @@ -629,11 +629,11 @@ elseif (empty($type_element) || $type_element == -1) print ''."\n"; // Titles with sort buttons print ''; - print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'align="center" width="150"', $sortfield, $sortorder); - print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, 'align="left"', $sortfield, $sortorder); - print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_status', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right '); print "\n"; print ''; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a4ef83cde45..2404c11861e 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -132,7 +132,7 @@ print '
'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'
'."\n"; print ''; if (! empty($conf->use_javascript_ajax) && ((round($third['prospect'])?1:0)+(round($third['customer'])?1:0)+(round($third['supplier'])?1:0)+(round($third['other'])?1:0) >= 2)) { - print '"; - $statstring.= ''; + $statstring.= ''; $statstring.= ""; } if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { $statstring.= ""; - $statstring.= ''; + $statstring.= ''; $statstring.= ""; } if (! empty($conf->fournisseur->enabled) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS) && $user->rights->fournisseur->lire) { $statstring2 = ""; - $statstring2.= ''; + $statstring2.= ''; $statstring2.= ""; } print $statstring; print $statstring2; } -print ''; print '
'.$langs->trans("Statistics").'
'; + print '
'; $dataseries=array(); if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) $dataseries[]=array($langs->trans("Prospects"), round($third['prospect'])); if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) $dataseries[]=array($langs->trans("Customers"), round($third['customer'])); @@ -154,25 +154,25 @@ else if (! empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = "
'.$langs->trans("Prospects").''.round($third['prospect']).''.$langs->trans("Prospects").''.round($third['prospect']).'
'.$langs->trans("Customers").''.round($third['customer']).''.$langs->trans("Customers").''.round($third['customer']).'
'.$langs->trans("Suppliers").''.round($third['supplier']).''.$langs->trans("Suppliers").''.round($third['supplier']).'
'.$langs->trans("UniqueThirdParties").''; +print '
'.$langs->trans("UniqueThirdParties").''; print $total; print '
'; @@ -188,7 +188,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS print '
'; print ''; print ''; - print ''; - print ''; print '
'.$langs->trans("Categories").'
'; + print '
'; $sql = "SELECT c.label, count(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid"; @@ -249,7 +249,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS } } print '
'.$langs->trans("Total").''; + print '
'.$langs->trans("Total").''; print $total; print '
'; @@ -321,7 +321,7 @@ if ($result) print $thirdparty_static->getNomUrl(1); print "
'; + print ''; if ($thirdparty_static->client==1 || $thirdparty_static->client==3) { $thirdparty_static->name=$langs->trans("Customer"); @@ -341,10 +341,10 @@ if ($result) } print ''; + print ''; print dol_print_date($thirdparty_static->datem, 'day'); print "'; + print ''; print $thirdparty_static->getLibStatut(3); print "
'.img_delete().''.img_delete().'
'; print $langs->trans("Email"); print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
'.dol_print_date($db->jdate($obj->daten), 'dayhour').''.dol_print_date($db->jdate($obj->daten), 'dayhour').'
'.$langs->trans("Description").''.$langs->trans("QtyOrdered").''.$langs->trans("QtyReceived").''.$langs->trans("QtyToReceive"); + print ''.$langs->trans("QtyOrdered").''.$langs->trans("QtyReceived").''.$langs->trans("QtyToReceive"); if (empty($conf->productbatch->enabled)) { print '
('.$langs->trans("Fill").''; @@ -1085,7 +1085,7 @@ if ($action == 'create') } // Qty - print '
'.$line->qty; + print ''.$line->qty; print 'id.'\' />'; print ''; print ''; @@ -1093,7 +1093,7 @@ if ($action == 'create') $qtyProdCom=$line->qty; // Qty already received - print ''; + print ''; $quantityDelivered = $object->receptions[$line->id]; @@ -1124,7 +1124,7 @@ if ($action == 'create') // Quantity to send - print ''; + print ''; if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty=GETPOST('qtyl'.$indiceAsked, 'int'); @@ -1416,7 +1416,7 @@ elseif ($id || $ref) print $langs->trans('DateDeliveryPlanned'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; print ''; if ($action == 'editdate_livraison') @@ -1556,7 +1556,7 @@ elseif ($id || $ref) print $langs->trans('ReceptionMethod'); print ''; - if ($action != 'editshipping_method_id') print 'id.'">'.img_edit($langs->trans('SetReceptionMethod'), 1).''; + if ($action != 'editshipping_method_id') print 'id.'">'.img_edit($langs->trans('SetReceptionMethod'), 1).''; print ''; print ''; if ($action == 'editshipping_method_id') @@ -1594,7 +1594,7 @@ elseif ($id || $ref) print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->reception->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -1637,24 +1637,24 @@ elseif ($id || $ref) // # if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ' '; + print ' '; } // Product/Service print ''.$langs->trans("Products").''; // Comment print ''.$langs->trans("Description").''; // Qty - print ''.$langs->trans("QtyOrdered").''; + print ''.$langs->trans("QtyOrdered").''; if ($origin && $origin_id > 0) { - print ''.$langs->trans("QtyInOtherReceptions").''; + print ''.$langs->trans("QtyInOtherReceptions").''; } if ($action == 'editline') { $editColspan = 3; if (empty($conf->stock->enabled)) $editColspan--; if (empty($conf->productbatch->enabled)) $editColspan--; - print ''; + print ''; if ($object->statut <= 1) { print $langs->trans("QtyToReceive").' - '; @@ -1677,11 +1677,11 @@ elseif ($id || $ref) { if ($object->statut <= 1) { - print ''.$langs->trans("QtyToReceive").''; + print ''.$langs->trans("QtyToReceive").''; } else { - print ''.$langs->trans("QtyReceived").''; + print ''.$langs->trans("QtyReceived").''; } if (! empty($conf->stock->enabled)) { @@ -1693,9 +1693,9 @@ elseif ($id || $ref) print ''.$langs->trans("Batch").''; } } - print ''.$langs->trans("CalculatedWeight").''; - print ''.$langs->trans("CalculatedVolume").''; - //print ''.$langs->trans("Size").''; + print ''.$langs->trans("CalculatedWeight").''; + print ''.$langs->trans("CalculatedVolume").''; + //print ''.$langs->trans("Size").''; if ($object->statut == 0) { print ''; @@ -1775,7 +1775,7 @@ elseif ($id || $ref) // # if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - print ''.($i+1).''; + print ''.($i+1).''; } // Predefined product or service @@ -1834,12 +1834,12 @@ elseif ($id || $ref) // Qty ordered - print ''.$lines[$i]->qty_asked.''; + print ''.$lines[$i]->qty_asked.''; // Qty in other receptions (with reception and warehouse used) if ($origin && $origin_id > 0) { - print ''; + print ''; foreach ($alreadysent as $key => $val) { if ($lines[$i]->fk_commandefourndet == $key) @@ -1871,7 +1871,7 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { // edit mode - print ''; + print '
'; if (! empty($conf->stock->enabled)) { if ($lines[$i]->fk_product > 0) @@ -1912,7 +1912,7 @@ elseif ($id || $ref) else { // Qty to receive or received - print ''; + print ''; // Warehouse source if (! empty($conf->stock->enabled)) @@ -1959,13 +1959,13 @@ elseif ($id || $ref) } // Weight - print ''; // Volume - print ''; @@ -1973,14 +1973,14 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { - print ''; print ''; - print ''; print ''; @@ -219,7 +219,7 @@ if ( $resql ) print ''; - print ''; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 5cb3a100e71..3340a192081 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -647,7 +647,7 @@ if ($resql) // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; } @@ -665,14 +665,14 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } @@ -735,19 +735,19 @@ if ($resql) // Status if (! empty($arrayfields['e.fk_statut']['checked'])) { - print ''; } // Status billed if (! empty($arrayfields['e.billed']['checked'])) { - print ''; } // Action column - print ''; @@ -756,15 +756,15 @@ if ($resql) print ''; if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['e.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, 'align="left"', $sortfield, $sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -775,7 +775,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($extralabels[$key], $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder); + print_liste_field_titre($extralabels[$key], $_SERVER["PHP_SELF"], $sortonfield, "", $param, '', $sortfield, $sortorder, ($align?'"'.$align.' "':'')); } } } @@ -783,11 +783,11 @@ if ($resql) $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $i=0; @@ -862,7 +862,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; @@ -871,7 +871,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -881,7 +881,7 @@ if ($resql) // Date delivery planed if (! empty($arrayfields['e.date_delivery']['checked'])) { - print ''."\n"; } @@ -920,10 +920,10 @@ if ($resql) { if (! empty($arrayfields["ef.".$key]['checked'])) { - print ''; @@ -938,7 +938,7 @@ if ($resql) // Date creation if (! empty($arrayfields['e.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -946,7 +946,7 @@ if ($resql) // Date modification if (! empty($arrayfields['e.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -954,18 +954,18 @@ if ($resql) // Status if (! empty($arrayfields['e.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Billed if (! empty($arrayfields['e.billed']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; - print ''; + print ''; print '
'.$lines[$i]->qty.''.$lines[$i]->qty.''; + print ''; if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->weight*$lines[$i]->qty.' '.measuring_units_string($lines[$i]->product->weight_units, "weight"); else print ' '; print ''; + print ''; if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->product->volume*$lines[$i]->qty.' '.measuring_units_string($lines[$i]->product->volume_units, "volume"); else print ' '; print ''; + print ''; print '
'; print '
'; } elseif ($object->statut == 0) { // edit-delete buttons - print '
'; + print ''; print 'id . '">' . img_edit() . ''; print ''; diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index 74cc86f26a5..3b0bb7a05e0 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -160,7 +160,7 @@ if ($resql) print ''; print $companystatic->getNomUrl(1, 'customer', 32); print ''; + print ''; print $orderstatic->getLibStatut(3); print '
'; print $companystatic->getNomUrl(1, 'customer'); print ''; + print ''; print $orderstatic->getLibStatut(3); print '
'; + print ''; print ''; print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusReceptionDraftShort'),'1'=>$langs->trans('StatusReceptionValidatedShort'),'2'=>$langs->trans('StatusReceptionProcessedShort')), $viewstatut, 1); print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; print dol_print_date($db->jdate($obj->date_livraison), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 ) @@ -907,7 +907,7 @@ if ($resql) if (! empty($arrayfields['l.date_delivery']['checked'])) { // Date received - print ''; + print ''; print dol_print_date($db->jdate($obj->date_reception), "day"); print ''; + if ($align) print ' '.$align; + print '">'; $tmpkey='options_'.$key; print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour'); print ''.$reception->LibStatut($obj->fk_statut, 5).''.$reception->LibStatut($obj->fk_statut, 5).''.yn($obj->billed).''.yn($obj->billed).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index b4034588218..94e77c3c4b5 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -255,7 +255,7 @@ print '
'; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print '
'; print ''; print '

'; @@ -263,10 +263,10 @@ print '
'; print ''; print ''; -print ''; -print ''; -/*print ''; -print '';*/ +print ''; +print ''; +/*print ''; +print '';*/ print ''; $oldyear=0; @@ -279,22 +279,22 @@ foreach ($data as $val) print ''; - print ''; + print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; } print ''; - print ''; - print ''; - /*print ''; - print '';*/ + print ''; + /*print ''; + print '';*/ print ''; $oldyear=$year; } @@ -306,7 +306,7 @@ print '
'; // Show graphs -print '
'.$langs->trans("Year").''.$langs->trans("NbOfReceptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").''.$langs->trans("Year").''.$langs->trans("NbOfReceptions").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.''.$oldyear.'000000
'; + print ''; if ($year) print ''.$year.''; else print $langs->trans("ValidationDateNotDefinedEvenIfReceptionValidated"); print ''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'; +print '
'; if ($mesg) { print $mesg; } else { print $px1->show(); @@ -328,8 +328,8 @@ dol_fiche_end(); // TODO USe code similar to commande/stats/index.php instead of this one. /* print ''; -print ''; -print ''; +print ''; +print ''; $sql = "SELECT count(*) as nb, date_format(date_reception,'%Y') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."reception"; @@ -348,7 +348,7 @@ if ($resql) $nbproduct = $row[0]; $year = $row[1]; print ""; - print ''; + print ''; $i++; } } diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index bd12cbd2902..9601c661c70 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -41,14 +41,14 @@ foreach($linkedObjectBlock as $key => $objectlink) - - + - - + - - - - - + + + + + '; +print ''; print "\n"; print ''; -if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'], $_SERVER["PHP_SELF"], "ty.label", "", $param, "", $sortfield, $sortorder); +if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); +if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'], $_SERVER["PHP_SELF"], "ty.label", "", $param, "", $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -266,7 +266,7 @@ if ($ret) $obj = (Object) $resource->array_options; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - print '
'.$langs->trans("Year").''.$langs->trans("NbOfReceptions").'
'.$langs->trans("Year").''.$langs->trans("NbOfReceptions").'
'.$year.''.$nbproduct.'
'.$year.''.$nbproduct.'
trans("Reception"); ?> getNomUrl(1); ?> date_delivery, 'day'); ?>date_delivery, 'day'); ?>rights->reception->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?>getLibStatut(3); ?> + getLibStatut(3); ?> element != 'order_supplier') { @@ -66,11 +66,11 @@ if (count($linkedObjectBlock) > 1)
trans("Total"); ?>
'; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'; + print ''; print ''; print img_edit(); print ''; From 48de805bce29b6f1f2958d64b96cc76b78eb4d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 21:57:35 +0100 Subject: [PATCH 099/190] replace html code by html5 in admin --- htdocs/admin/agenda_extsites.php | 6 ++--- htdocs/admin/agenda_other.php | 34 +++++++++++------------ htdocs/admin/agenda_reminder.php | 8 +++--- htdocs/admin/bank.php | 32 +++++++++++----------- htdocs/admin/barcode.php | 22 +++++++-------- htdocs/admin/boxes.php | 16 +++++------ htdocs/admin/chequereceipts.php | 10 +++---- htdocs/admin/commande.php | 40 ++++++++++++++-------------- htdocs/admin/const.php | 10 +++---- htdocs/admin/contract.php | 28 +++++++++---------- htdocs/admin/defaultvalues.php | 6 ++--- htdocs/admin/dict.php | 2 +- htdocs/admin/ecm.php | 8 +++--- htdocs/admin/emailcollector_list.php | 8 +++--- htdocs/reception/stats/month.php | 4 +-- 15 files changed, 117 insertions(+), 117 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index c9ba17d2461..4a2d22e176d 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -151,14 +151,14 @@ print ""; print ""; print '"; -print '"; +print '"; print ""; // Show external agenda print ''; print ""; -print '"; print ''; print ""; -print '"; print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index f78cd42034c..ce9db532f21 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -225,10 +225,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''; - print ''; + print ''."\n"; + print ''."\n"; + print ''; + print ''; print ''."\n"; clearstatcache(); @@ -269,7 +269,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if (in_array($name, $def)) { - print '"; } // Default - print ''; - print ''; @@ -330,7 +330,7 @@ print ''; print '
'.$langs->trans("Parameter")."'.$langs->trans("Value")."'.$langs->trans("Value")."
".$langs->trans("ExtSitesEnableThisTool")."'; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1); @@ -181,7 +181,7 @@ print "
".$langs->trans("ExtSitesNbOfAgenda")."'; +print ''; print ''; print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { print 'scandir.'&label='.urlencode($module->name).'&type=action">'; @@ -284,13 +284,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -307,10 +307,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; print ''.img_object($langs->trans("Preview"), 'order').''; print '
'."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; @@ -338,7 +338,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; $htmltext=$langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup")); print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; - print ''."\n"; + print ''."\n"; } @@ -376,8 +376,8 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // AGENDA_DEFAULT_FILTER_TYPE print ''."\n"; print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; @@ -385,7 +385,7 @@ print ''."\n"; // TODO Remove to use the default generic feature print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 6624cc52dc5..3af179ba2e7 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -185,7 +185,7 @@ print ''; print '
'.$langs->trans("Parameters").'  '.$langs->trans("Value").'
'.$langs->trans("AGENDA_USE_EVENT_TYPE").'  '."\n"; //print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) @@ -355,7 +355,7 @@ print '
'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'  '."\n"; $tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); @@ -367,8 +367,8 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''; print '
'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' '."\n"; + print ' '."\n"; $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; +print ' '."\n"; $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'  '."\n"; $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; @@ -195,7 +195,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2) { print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; $bankorder[0][0] = $langs->trans("BankOrderGlobal"); @@ -213,12 +213,12 @@ while ($i < $nbofbank) { print "\n"; if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) { - print ''; } else { - print ''; } @@ -263,10 +263,10 @@ print "
'.$langs->trans("Parameters").'  '.$langs->trans("Value").'
'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'  '."\n"; if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { @@ -212,7 +212,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2) { print '
'.$langs->trans('AGENDA_REMINDER_BROWSER').'  '."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { @@ -224,7 +224,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2) print '
'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'  '."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 34becb49ada..9fc256540a2 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -183,8 +183,8 @@ print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Example") . '' . $langs->trans("Status") . ' ' . $langs->trans("Status") . ' 
'; + print ''; print img_picto($langs->trans("Activated"), 'on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'off'); print '
\n"; print "\n"; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -315,7 +315,7 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { - print ''; } else { - print '"; } // Default - print ''; // Preview - print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "' . $langs->trans("Default") . "' . $langs->trans("ShortInfo") . '' . $langs->trans("Preview") . '' . $langs->trans("Status") . "' . $langs->trans("Default") . "' . $langs->trans("ShortInfo") . '' . $langs->trans("Preview") . '
' . "\n"; + print '' . "\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); @@ -323,14 +323,14 @@ foreach ($dirmodels as $reldir) { print '' . "\n"; + print '' . "\n"; print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; print "'; + print ''; if ($conf->global->BANKADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -358,13 +358,13 @@ foreach ($dirmodels as $reldir) { // $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); //$htmltooltip .= '
' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print '' . img_object($langs->trans("Preview"), 'bill') . ''; @@ -404,7 +404,7 @@ print "\n"; print "\n"; print ''; print ''; -print '\n"; +print '\n"; print "\n"; print ''; // Active if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { - print '"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 92b1c73060d..e811eaff261 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -199,8 +199,8 @@ print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "' . $langs->trans("Status") . "
'; @@ -414,7 +414,7 @@ print $langs->trans('AutoReportLastAccountStatement'); print '' . "\n"; + print '' . "\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -422,7 +422,7 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { } else { - print '' . "\n"; + print '' . "\n"; print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; print "
'; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; $sql = "SELECT rowid, code as encoding, libelle, coder, example"; @@ -229,7 +229,7 @@ if ($resql) print ''; // Show example - print ''; - print '\n"; @@ -307,7 +307,7 @@ print ""; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("CodeBarGenerator").''.$langs->trans("Example").''.$langs->trans("CodeBarGenerator").'
'; + print ''; if ($obj->coder && $obj->coder != -1) { $result=0; @@ -277,7 +277,7 @@ if ($resql) } print ''; + print ''; print $formbarcode->setBarcodeEncoder($obj->coder, $barcodelist, $obj->rowid, 'form'.$i); print "
'; print ''; print ''; -print ''; +print ''; print ''; print ''; @@ -317,7 +317,7 @@ if (! isset($_SERVER['WINDIR'])) print ''; print ''; - print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; $dirbarcodenum=array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); @@ -406,17 +406,17 @@ if ($conf->produit->enabled) if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { - print ''; } else { - print ''; } - print ''; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 3cee6aa27f4..70672f9b6fb 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -337,7 +337,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; foreach($boxtoadd as $box) @@ -398,9 +398,9 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("GenbarcodeLocation").''; + print ''; print ''; if (! empty($conf->global->GENBARCODE_LOCATION) && ! @file_exists($conf->global->GENBARCODE_LOCATION)) { @@ -369,8 +369,8 @@ if ($conf->produit->enabled) print ''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; + print ''; $s=$modBarCode->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("SourceFile").''.$langs->trans("ActivateOn").''.$langs->trans("ActivateOn").'
'."\n"; print ''; print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''."\n"; $box_order=1; @@ -429,15 +429,15 @@ foreach($boxactivated as $key => $box) } else print ($box->note?$box->note:' '); print ''; - print ''; + print ''; $hasnext=($key < (count($boxactivated)-1)); $hasprevious=($key != 0); - print ''; - print ''; + print ''; - print ''; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index 4efa3bc487b..e8e035f8b49 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -116,8 +116,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -177,7 +177,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 3dc59b1b247..1f3e23e05d6 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -267,8 +267,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -393,10 +393,10 @@ print "
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("ActiveOn").''.$langs->trans("PositionByDefault").''.$langs->trans("Disable").''.$langs->trans("ActiveOn").''.$langs->trans("PositionByDefault").''.$langs->trans("Disable").'
' . (empty($pos_name[$box->position])?'':$langs->trans($pos_name[$box->position])) . '' . (empty($pos_name[$box->position])?'':$langs->trans($pos_name[$box->position])) . ''.($key+1).''; + print ''.($key+1).''; print ($hasnext?''.img_down().' ':''); print ($hasprevious?''.img_up().'':''); print ''; + print ''; print ''.img_delete().''; print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -206,7 +206,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors @@ -244,7 +244,7 @@ print ''; print '
'.$langs->trans("Parameters").'   
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->COMMANDE_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
\n"; print "\n"; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -449,7 +449,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Default - print ''; // Preview - print ''; } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 7b258579819..07e067d2814 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -78,17 +78,17 @@ $backtopage = GETPOST('backtopage', 'alpha'); $object=new BillOfMaterials($db); $extrafields = new ExtraFields($db); $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('bomcard','globalcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all",'alpha')); +$search_all=trim(GETPOST("search_all", 'alpha')); $search=array(); foreach($object->fields as $key => $val) { - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); } if (empty($action) && empty($id) && empty($ref)) $action='view'; @@ -119,7 +119,7 @@ if (empty($reshook)) $permissiontoadd = $user->rights->bom->write; $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); - $backurlforlist = dol_buildpath('/bom/bom_list.php',1); + $backurlforlist = dol_buildpath('/bom/bom_list.php', 1); if (empty($backtopage)) { if (empty($id)) $backtopage = $backurlforlist; else $backtopage = dol_buildpath('/bom/bom_card.php',1).($id > 0 ? $id : '__ID__'); @@ -360,7 +360,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action != 'presend' && $action != 'editline') { print '
'."\n"; $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 9c508408f53..6a1c17488c8 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -74,7 +74,7 @@ if (! $sortfield) $sortfield="name"; $object=new BillOfMaterials($db); $extrafields = new ExtraFields($db); $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('bomdocument','globalcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label('bom'); @@ -114,7 +114,7 @@ if ($object->id) // Build file list - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); $totalsize=0; foreach($filearray as $key => $file) { @@ -158,7 +158,7 @@ if ($object->id) } else { - accessforbidden('',0,0); + accessforbidden('', 0, 0); } // End of page diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index f96f1bf1beb..a3c7130cd38 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -62,26 +62,26 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; dol_include_once('/bom/class/bom.class.php'); // Load translation files required by the page -$langs->loadLangs(array("bom@bom","other")); +$langs->loadLangs(array("bom@bom", "other")); -$action = GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... -$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists) -$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ? -$confirm = GETPOST('confirm','alpha'); // Result of a confirmation +$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bomlist'; // To manage different context of search -$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print') +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id','int'); // Load variable for pagination -$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; -$sortfield = GETPOST('sortfield','alpha'); -$sortorder = GETPOST('sortorder','alpha'); -$page = GETPOST('page','int'); -if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page', 'int'); +if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -95,7 +95,7 @@ $diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->i $hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label('bom'); // Load $extrafields->attributes['bom'] -$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,'','search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Default sort order (if not yet defined by previous GETPOST) if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. @@ -111,11 +111,11 @@ if ($user->societe_id > 0) // Protection if external user //$result = restrictedArea($user, 'bom', $id, ''); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all",'alpha')); +$search_all=trim(GETPOST("search_all", 'alpha')); $search=array(); foreach($object->fields as $key => $val) { - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); } // List of fields to search into when doing a "search in all" @@ -172,8 +172,8 @@ if (empty($reshook)) $toselect=''; $search_array_options=array(); } - if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') - || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation } @@ -333,7 +333,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); -if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +if (GETPOST('nomassaction','int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print '
'; @@ -447,7 +447,7 @@ $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sort $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; print ''."\n"; @@ -483,7 +483,7 @@ while ($i < min($num, $limit)) foreach($object->fields as $key => $val) { $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; @@ -582,13 +582,13 @@ if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nb // Show list of available documents $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; - $urlsource.=str_replace('&','&',$param); + $urlsource.=str_replace('&', '&', $param); $filedir=$diroutputmassaction; $genallowed=$user->rights->bom->read; $delallowed=$user->rights->bom->create; - print $formfile->showdocuments('massfilesarea_bom','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_bom', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index 58d73a3582a..6166b6f23d1 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -87,7 +87,7 @@ $form = new Form($db); //$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; $help_url=''; -llxHeader('',$langs->trans('BillOfMaterials'),$help_url); +llxHeader('', $langs->trans('BillOfMaterials'), $help_url); if ($id > 0 || ! empty($ref)) { @@ -99,7 +99,7 @@ if ($id > 0 || ! empty($ref)) // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = '' . $langs->trans("BackToList") . ''; $morehtmlref='
'; /* diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 9420651df8b..3d0b10d05c2 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -316,7 +316,7 @@ class BillOfMaterials extends CommonObject if ($key=='t.rowid') { $sqlwhere[] = $key . '='. $value; } - elseif (strpos($key,'date') !== false) { + elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; } elseif ($key=='customsql') { @@ -412,13 +412,13 @@ class BillOfMaterials extends CommonObject $label.= '
'; $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - $url = dol_buildpath('/bom/bom_card.php',1).'?id='.$this->id; + $url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id; if ($option != 'nolink') { // Add param to save lastsearch_values or not $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; } @@ -455,7 +455,7 @@ class BillOfMaterials extends CommonObject global $action,$hookmanager; $hookmanager->initHooks(array('bomdao')); $parameters=array('id'=>$this->id, 'getnomurl'=>$result); - $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; @@ -899,7 +899,7 @@ class BillOfMaterialsLine extends CommonObject if ($key=='t.rowid') { $sqlwhere[] = $key . '='. $value; } - elseif (strpos($key,'date') !== false) { + elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; } elseif ($key=='customsql') { @@ -1001,7 +1001,7 @@ class BillOfMaterialsLine extends CommonObject { // Add param to save lastsearch_values or not $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; } @@ -1038,7 +1038,7 @@ class BillOfMaterialsLine extends CommonObject global $action,$hookmanager; $hookmanager->initHooks(array('bomlinedao')); $parameters=array('id'=>$this->id, 'getnomurl'=>$result); - $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index ff8820a93b3..ee93c6525f8 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -97,7 +97,7 @@ function bomPrepareHead($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); @@ -117,9 +117,8 @@ function bomPrepareHead($object) //); // to add new tab //$this->tabs = array( // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' - //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom'); - - return $head; -} + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom'); + return $head; +} \ No newline at end of file diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index e9cb8cc631a..d9b27b729e3 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -59,7 +59,7 @@ class modBom extends DolibarrModules //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); // Module label (no space allowed), used if translation string 'ModuleBomName' not found (Bom is name of module). - $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleBomDesc' not found (Bom is name of module). $this->description = "Bill of Materials (BOM) definitions for Manufacturing Resource Planning"; // Used only if file README.md and README-LL.md not found. diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index b3cb0ce3cd9..ecc76f29d73 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -219,44 +219,46 @@ Class DataPolicy */ function sendMailDataPolicyCompany($societe) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $societe->email; + $sendto = $societe->email; - $code= md5($societe->email); - if (!empty($societe->default_lang)) { - $l = $societe->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) + { + if ($sendtocc) + { $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); @@ -264,12 +266,12 @@ Class DataPolicy $actionmsg .= dol_concatdesc($actionmsg, $message); } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { $resultmasssend .= '
' . $mailfile->error . '
'; - } else { + } else { $result4 = $mailfile->sendfile(); if (!$error) { @@ -279,8 +281,8 @@ Class DataPolicy } else { dol_print_error($db); } - } - setEventMessage($resultmasssend); + } + setEventMessage($resultmasssend); } /** diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 3bf3ae7b42f..0b3a1c101e8 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -82,7 +82,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (! $sortorder) $sortorder="ASC"; -if (GETPOST('search_fk_status','alpha') == 'non_closed') $_GET['search_fk_statut'][]='openall'; // For backward compatibility +if (GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][]='openall'; // For backward compatibility // Initialize array of search criterias $search_all=trim(GETPOST("search_all", 'alpha')); From da826c4bc7a37b99a6cf41411cc2dc0a7281e517 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Feb 2019 01:22:26 +0100 Subject: [PATCH 161/190] Fix bad var name --- htdocs/compta/compta-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 33f8b2dcb96..be08e264a02 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -243,7 +243,7 @@ if ($result && $action == "dl") $log='date,type,ref,total,paid,filename,item_id'."\n"; $zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip'; - dol_delete_file(name); + dol_delete_file($zipname); $zip = new ZipArchive; $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); From d6651f39985bfed9dda7d04bc740a67a888a92bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Feb 2019 01:37:20 +0100 Subject: [PATCH 162/190] Update box_project.php --- htdocs/core/boxes/box_project.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index a969d2126e6..d41a5f16772 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -89,9 +89,12 @@ class box_project extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $projectstatic = new Project($this->db); + $socid=0; + //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. + // Get list of project id allowed to user (in a string list separated by coma) $projectsListId=''; - if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $user->socid); + if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; From 9c5a4e303c45fe79c836fd391f948b75ed17bdef Mon Sep 17 00:00:00 2001 From: bomuux Date: Mon, 18 Feb 2019 23:17:03 +0100 Subject: [PATCH 163/190] SQL error in box_project.php Corrected a bug : for an internal user with no rights to see all projects, the project box on home cause an error in log. Finally a lot of simplification because Project::getProjectsAuthorizedForUser do most of the filtering. Conflicts: htdocs/core/boxes/box_project.php --- htdocs/core/boxes/box_project.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index a48543a00f6..d1c0954379f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -89,21 +89,17 @@ class box_project extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $projectstatic = new Project($this->db); - $socid=$user->societe_id; + $socid=0; + //if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement. - // Get list of project id allowed to user (in a string list separated by coma) + // Get list of project id allowed to user (in a string list separated by coma) $projectsListId=''; - if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); + if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; - if($user->socid) $sql.= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=p.fk_soc"; - $sql.= " WHERE p.entity IN (".getEntity('project').')'; - if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users - if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; - $sql.= " AND p.fk_statut = 1"; // Seulement les projets ouverts - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; + $sql.= " WHERE p.fk_statut = 1"; // Only open projects + if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users $sql.= " ORDER BY p.datec DESC"; //$sql.= $db->plimit($max, 0); From a6e9da192c152995c511693f0d3704cfda66e2c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Feb 2019 02:18:00 +0100 Subject: [PATCH 164/190] Update accountancy.lang --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index ca1f98bf64c..3447d2a0a98 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -142,7 +142,7 @@ ACCOUNTING_LENGTH_AACCOUNT=Length of the third-party accounting accounts (If you ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account. Needed by some countries (like Switzerland). If set to off (default), you can set the following two parameters to ask the application to add virtual zeros. BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL=Enable draft export on journal -ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account +ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account (may be slow if you have a lot of third parties) ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal From 61b7564664cda228332c75529fc72896d5c69ca0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Feb 2019 02:29:14 +0100 Subject: [PATCH 165/190] Fix syntax error --- htdocs/contact/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 26f1bb8716a..dff432690be 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -704,7 +704,7 @@ else if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) { print '
'; - print ''; + print ''; } } From 64bd995978156bd7c791832dc35a0ccd34477876 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 27 Feb 2019 04:02:11 +0100 Subject: [PATCH 166/190] Fix camelCase syntax and remove disabling of phpcs --- htdocs/core/class/html.form.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 21d16f9f9ce..585d29e254e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3681,8 +3681,7 @@ class Form return $num; } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return a HTML select list of establishment * @@ -3694,7 +3693,7 @@ class Form * @param string $moreattrib To add more attribute on select * @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...) */ - function select_establishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '') + function selectEstablishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '') { // phpcs:enable global $langs, $conf; From b1782f0fc866a31df81e8a96b8c957b2c2f5fda6 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Wed, 27 Feb 2019 04:05:02 +0100 Subject: [PATCH 167/190] rename function select_establishments to selectEstablishments --- htdocs/hrm/establishment/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index af242515a24..37a3d7f538b 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -194,7 +194,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; @@ -295,7 +295,7 @@ if (($id || $ref) && $action == 'edit') // Parent print ''; print ''; // Address From 4634312306b663aebd6cc7a21008829772ec90dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Feb 2019 04:18:25 +0100 Subject: [PATCH 168/190] Fix phpcs --- htdocs/bom/bom_card.php | 8 +++--- htdocs/bom/bom_document.php | 14 +++++----- htdocs/bom/bom_list.php | 18 ++++++------- htdocs/bom/class/api_bom.class.php | 6 ++--- htdocs/bom/class/bom.class.php | 41 +++++++++++++++--------------- htdocs/bom/lib/bom.lib.php | 2 +- htdocs/contact/list.php | 6 ++--- htdocs/takepos/genimg/index.php | 25 +++++++++--------- 8 files changed, 60 insertions(+), 60 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 07e067d2814..2b5163bb4f2 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -71,7 +71,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bomcard'; // To manage different context of search +$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects @@ -110,7 +110,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu */ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -154,7 +154,7 @@ if (empty($reshook)) $form=new Form($db); $formfile=new FormFile($db); -llxHeader('','BillOfMaterials',''); +llxHeader('', 'BillOfMaterials', ''); // Example : Adding jquery code print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -457,13 +457,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->COMMANDE_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -491,12 +491,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -528,7 +528,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print "\n"; print "\n"; @@ -580,7 +580,7 @@ Whet is definition of "shippable" according to all different STOCK_CALCULATE_... print ''; print ''; print ''; -print ''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").''; } // Ask for warehouse during order @@ -628,7 +628,7 @@ if ($conf->stock->enabled) { print ''; + print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").''; } */ @@ -666,7 +666,7 @@ print load_fiche_titre($langs->trans("Notifications"), '', ''); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("ShippableOrderIconInList").' '; +print ''; if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { print ''; print img_picto($langs->trans("Activated"),'switch_on'); @@ -598,7 +598,7 @@ if ($conf->banque->enabled) { print '
'; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); @@ -620,7 +620,7 @@ else { print '
'; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '.$langs->trans('NotAvailable').'
 '.$langs->trans('NotAvailable').'
'; - print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '; + print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER'); @@ -650,7 +650,7 @@ else { print '
'; - print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '.$langs->trans('NotAvailable').'
 '.$langs->trans('NotAvailable').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 720b43a2275..062fcb1d998 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -190,7 +190,7 @@ print ''; print ''; print ''; if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; -print ''; +print ''; print "\n"; @@ -210,11 +210,11 @@ if (! empty($conf->multicompany->enabled) && !$user->entity) print ''; - print ''; - print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -249,7 +249,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -329,10 +329,10 @@ print '
'.$langs->trans("Parameter").' 
'.$langs->trans("Name").''.$langs->trans("Value").''.$langs->trans("Comment").''.$langs->trans("Entity").''.$langs->trans("Action").''.$langs->trans("Action").'
'; print ''; print ''; + print ''; } else { - print ''; + print ''; print ''; } print ''; @@ -273,11 +273,11 @@ if ($result) print ''; print ''; print ''; + print ''; } else { - print ''; + print ''; print ''; } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 7cad76585e2..bf02df80b5b 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -204,8 +204,8 @@ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->CONTRACT_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -280,7 +280,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
'; print ''; print ''; print ''; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -384,7 +384,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print '"; } // Defaut - print ''; // Preview - print ''; // Severity print ''; // Group print ''; // Notify thirdparty at creation From 70fc33e8bba937d65bf74a967e8bff9560098708 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Feb 2019 00:14:11 +0100 Subject: [PATCH 158/190] Update don.class.php --- htdocs/don/class/don.class.php | 70 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 27e124d6db2..f361299f83a 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -672,40 +672,42 @@ class Don extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->datec = $this->db->jdate($obj->datec); - $this->date_valid = $this->db->jdate($obj->date_valid); - $this->datem = $this->db->jdate($obj->datem); - $this->date = $this->db->jdate($obj->datedon); - $this->socid = $obj->socid; - $this->firstname = $obj->firstname; - $this->lastname = $obj->lastname; - $this->societe = $obj->societe; - $this->statut = $obj->fk_statut; - $this->address = $obj->address; - $this->town = $obj->town; - $this->zip = $obj->zip; - $this->town = $obj->town; - $this->country_id = $obj->fk_country; - $this->country_code = $obj->country_code; - $this->country = $obj->country; - $this->country_olddata= $obj->country_olddata; // deprecated - $this->email = $obj->email; - $this->phone = $obj->phone; - $this->phone_mobile = $obj->phone_mobile; - $this->project = $obj->project_ref; - $this->fk_projet = $obj->fk_project; // deprecated - $this->fk_project = $obj->fk_project; - $this->public = $obj->public; - $this->modepaymentid = $obj->fk_payment; - $this->modepaymentcode = $obj->payment_code; - $this->modepayment = $obj->payment_label; - $this->paid = $obj->paid; - $this->amount = $obj->amount; - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->modelpdf = $obj->model_pdf; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->date_creation = $this->db->jdate($obj->datec); + $this->datec = $this->db->jdate($obj->datec); + $this->date_validation = $this->db->jdate($obj->date_valid); + $this->date_modification = $this->db->jdate($obj->datem); + $this->datem = $this->db->jdate($obj->datem); + $this->date = $this->db->jdate($obj->datedon); + $this->socid = $obj->socid; + $this->firstname = $obj->firstname; + $this->lastname = $obj->lastname; + $this->societe = $obj->societe; + $this->statut = $obj->fk_statut; + $this->address = $obj->address; + $this->town = $obj->town; + $this->zip = $obj->zip; + $this->town = $obj->town; + $this->country_id = $obj->fk_country; + $this->country_code = $obj->country_code; + $this->country = $obj->country; + $this->country_olddata = $obj->country_olddata; // deprecated + $this->email = $obj->email; + $this->phone = $obj->phone; + $this->phone_mobile = $obj->phone_mobile; + $this->project = $obj->project_ref; + $this->fk_projet = $obj->fk_project; // deprecated + $this->fk_project = $obj->fk_project; + $this->public = $obj->public; + $this->mode_reglement_id = $obj->fk_payment; + $this->mode_reglement_code= $obj->payment_code; + $this->mode_reglement = $obj->payment_label; + $this->paid = $obj->paid; + $this->amount = $obj->amount; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->modelpdf = $obj->model_pdf; // Retreive all extrafield // fetch optionals attributes and labels From 89c2d6731bdbf8f0c3f193b5ea45eccc35328cf3 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 27 Feb 2019 00:48:13 +0100 Subject: [PATCH 159/190] ADD product document support in API --- htdocs/api/class/api_documents.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 8db471855d6..f4ae79d888e 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -355,6 +355,22 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); } + else if ($modulepart == 'produit' || $modulepart == 'product') + { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + + if (!DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + $object = new Product($this->db); + $result=$object->fetch($id, $ref); + if ( ! $result ) { + throw new RestException(404, 'Product not found'); + } + + $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); + } else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; From 58e2901d1421436703e40ee651bba5c4a79e3947 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 27 Feb 2019 00:54:07 +0100 Subject: [PATCH 160/190] Fix phpcs --- htdocs/bom/admin/setup.php | 4 +- htdocs/bom/bom_card.php | 12 ++-- htdocs/bom/bom_document.php | 6 +- htdocs/bom/bom_list.php | 46 ++++++------ htdocs/bom/bom_note.php | 4 +- htdocs/bom/class/bom.class.php | 14 ++-- htdocs/bom/lib/bom.lib.php | 11 ++- htdocs/core/modules/modBom.class.php | 2 +- htdocs/datapolicy/class/datapolicy.class.php | 74 ++++++++++---------- htdocs/ticket/list.php | 2 +- 10 files changed, 88 insertions(+), 87 deletions(-) diff --git a/htdocs/bom/admin/setup.php b/htdocs/bom/admin/setup.php index ed8ee70d652..dd16ad92b8e 100644 --- a/htdocs/bom/admin/setup.php +++ b/htdocs/bom/admin/setup.php @@ -100,7 +100,7 @@ if ($action == 'edit') foreach($arrayofparameters as $key => $val) { print ''; } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -392,13 +392,13 @@ foreach ($dirmodels as $reldir) } else { - print ''."\n"; + print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; + print ''; if ($conf->global->CONTRACT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); @@ -424,12 +424,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'contract').''; @@ -466,7 +466,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print ''; print ''; print ''; -print ''; +print ''; print "\n"; $substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index a946aeeacfd..c2559e0e2bf 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -322,11 +322,11 @@ if (! empty($conf->multicompany->enabled) && !$user->entity) } else { - print ''; } -print ''; // Actions - print ''; - print ''; - print ''; print ''; - print ''; + print ''; print ''; $i++; } @@ -252,7 +252,7 @@ print '
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''.$langs->trans("Value").'
'; + print ''; print ''; print ''; +print ''; $disabled=''; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) $disabled=' disabled="disabled"'; print ''; @@ -385,7 +385,7 @@ if ($result) print ''; + print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { print ''.img_edit().''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 788f600a549..6d46876586a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1180,7 +1180,7 @@ if ($id) } if ($id == 4) print ''; + print ''; if ($action != 'edit') { print ''; diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 205f7e7cb1a..1cb165552f1 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -77,8 +77,8 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''."\n"; +print ''; +print ''."\n"; print ''; $form = new Form($db); @@ -87,9 +87,9 @@ $form = new Form($db); print ''; print ''; -print ''; +print ''; -print ''."\n"; @@ -450,10 +450,10 @@ while ($i < min($num, $limit)) $cssforfield=''; if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - + if (! empty($arrayfields['t.'.$key]['checked'])) { print 'executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; while ($i < $num && $i < $max) @@ -522,18 +522,18 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S $taskstatic->fk_statut = $obj->status; $taskstatic->dateo = $db->jdate($obj->dateo); $taskstatic->datee = $db->jdate($obj->datee); - print ''; - print ''; + print ''; - print ''; - print ''; - print ''; - print ''; print "\n"; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index a7c9aaf329d..7fe2d0af8a6 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -485,7 +485,7 @@ print ''; print ''; print ''; // Action column -print ''; @@ -495,13 +495,13 @@ print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; if (! empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) print ''; print ''; -print ''; -print ''; -/*print ''; -if ($usertoprocess->id == $user->id) print ''; -else print '';*/ -print ''; -print ''; +print ''; +print ''; +/*print ''; +if ($usertoprocess->id == $user->id) print ''; +else print '';*/ +print ''; +print ''; print ''; // By default, we can edit only tasks we are assigned to diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index a293c8ee451..ca4663bd43e 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -309,17 +309,17 @@ print ''; print '
'.$langs->trans("Description").' '.$langs->trans("Value").' '.$langs->trans("Value").'
'.$langs->trans("ECMAutoTree").'  '; +print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 755d44d42ba..e8dbc07654c 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -412,7 +412,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print '
'; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; diff --git a/htdocs/reception/stats/month.php b/htdocs/reception/stats/month.php index e67768e6ceb..84eb9126464 100644 --- a/htdocs/reception/stats/month.php +++ b/htdocs/reception/stats/month.php @@ -65,8 +65,8 @@ if (! $mesg) } print ''; -print ''; -print ''; +print ''; print '
Nombre d reception par mois'; +print '
Nombre d reception par mois'; print $px->show(); print '
'; From ec956e1c72bbaee45df03c46d5347b90ed214e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 22:24:26 +0100 Subject: [PATCH 100/190] replace html code by html5 in project --- htdocs/projet/activity/index.php | 54 ++++++++--------- htdocs/projet/activity/perday.php | 16 ++--- htdocs/projet/admin/project.php | 72 +++++++++++------------ htdocs/projet/card.php | 4 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 66 ++++++++++----------- htdocs/projet/ganttview.php | 2 +- htdocs/projet/graph_opportunities.inc.php | 10 ++-- htdocs/projet/index.php | 8 +-- htdocs/projet/list.php | 50 ++++++++-------- htdocs/projet/stats/index.php | 34 +++++------ htdocs/projet/tasks.php | 32 +++++----- htdocs/projet/tasks/comment.php | 2 +- htdocs/projet/tasks/contact.php | 12 ++-- htdocs/projet/tasks/document.php | 2 +- htdocs/projet/tasks/list.php | 38 ++++++------ htdocs/projet/tasks/note.php | 2 +- htdocs/projet/tasks/task.php | 4 +- htdocs/projet/tasks/time.php | 38 ++++++------ 20 files changed, 225 insertions(+), 225 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 4c2d03b796e..6f5a63129de 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -127,7 +127,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; print ''; print ''; -print ''; +print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -157,7 +157,7 @@ if ( $resql ) $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -170,7 +170,7 @@ else } print ''; print ''; -print ''; +print ''; print "\n"; print "
'.$langs->trans('ActivityOnProjectToday').''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; @@ -182,7 +182,7 @@ print '
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -212,7 +212,7 @@ if ( $resql ) $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -225,7 +225,7 @@ else } print ''; print ''; -print ''; +print ''; print "\n"; print "
'.$langs->trans('ActivityOnProjectYesterday').''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; @@ -240,7 +240,7 @@ if ($db->type != 'pgsql') print ''; print ''; print ''; - print ''; + print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -270,7 +270,7 @@ if ($db->type != 'pgsql') $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; $total += $row->nb; } @@ -283,7 +283,7 @@ if ($db->type != 'pgsql') } print ''; print ''; - print ''; + print ''; print "\n"; print "
'.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'

"; @@ -296,7 +296,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) print ''; print ''; print ''; - print ''; + print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -323,7 +323,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) $projectstatic->title=$row->title; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; } $db->free($resql); @@ -334,7 +334,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) } print ''; print ''; - print ''; + print ''; print "\n"; print "
'.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($now, "%B %Y").''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; } @@ -345,7 +345,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) print '
'; print ''; print ''; - print ''; + print ''; print "\n"; $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; @@ -373,7 +373,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) $projectstatic->public=$row->public; print $projectstatic->getNomUrl(1, '', 1); print ''; - print ''; + print ''; print "\n"; } $db->free($resql); @@ -384,7 +384,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) } print ''; print ''; - print ''; + print ''; print "\n"; print "
'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).''.$langs->trans("Time").''.$langs->trans("Time").'
'.convertSecondToTime($row->nb, 'allhourmin').''.convertSecondToTime($row->nb, 'allhourmin').'
'.$langs->trans('Total').''.convertSecondToTime($total, 'allhourmin').''.convertSecondToTime($total, 'allhourmin').'
"; } @@ -467,12 +467,12 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S print '
'.$langs->trans('OpenedProjects').''.$langs->trans('OpportunityStatus').''.$langs->trans('Task').''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; - print ''.$langs->trans("ProgressDeclared").''; + print ''.$langs->trans('DateStart').''.$langs->trans('DateEnd').''.$langs->trans('PlannedWorkload').''.$langs->trans('TimeSpent').''.$langs->trans("ProgressCalculated").''; + print ''.$langs->trans("ProgressDeclared").''; print '
'.dol_print_date($db->jdate($obj->dateo), 'day').''.dol_print_date($db->jdate($obj->datee), 'day'); + print ''.dol_print_date($db->jdate($obj->dateo), 'day').''.dol_print_date($db->jdate($obj->datee), 'day'); print dol_print_date($obj->date_end, 'dayhour'); if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); print ''; + print ''; print convertSecondToTime($obj->planned_workload, 'allhourmin'); print ''; + print ''; print convertSecondToTime($obj->timespent, 'allhourmin'); print ''; + print ''; if (! empty($obj->taskid)) { if (empty($obj->planned_workload) > 0) { @@ -544,7 +544,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S } print $percentcompletion; print ''; + print ''; print ($obj->taskid>0)?$obj->progress.'%':''; print '
'; +print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
'.$langs->trans("Project").''.$langs->trans("ThirdParty").''.$langs->trans("Task").''.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.$usertoprocess->firstname.')':'').'
'.$langs->trans("PlannedWorkload").''.$langs->trans("ProgressDeclared").''.$langs->trans("TimeSpent").''.$langs->trans("TimeSpentByYou").''.$langs->trans("TimeSpentByUser").''.$langs->trans("TimeSpent").'
('.$langs->trans("Everybody").')
'.$langs->trans("TimeSpent").($usertoprocess->firstname?'
('.$usertoprocess->firstname.')':'').'
'.$langs->trans("HourStart").'
'; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; -print '"; print ''; @@ -327,12 +327,12 @@ print ''; print ''; print ''; -print '"; print ''; @@ -354,8 +354,8 @@ print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir) else print $tmp; print ''."\n"; - print ''; @@ -455,8 +455,8 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; clearstatcache(); @@ -499,7 +499,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) else print $tmp; print ''."\n"; - print ''; @@ -583,10 +583,10 @@ print "
".$langs->trans("Parameters")."'.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("ManageOpportunitiesStatus").''; +print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"), ); print $form->selectyesno('PROJECT_USE_OPPORTUNITIES', $conf->global->PROJECT_USE_OPPORTUNITIES, 1); -print ''; +print ''; print ''; print "
'.$langs->trans("ManageTasks").''; +print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes"), ); print $form->selectyesno('PROJECT_USE_TASKS', empty($conf->global->PROJECT_HIDE_TASKS)?1:0, 1); -print ''; +print ''; print ''; print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->PROJECT_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -429,7 +429,7 @@ foreach ($dirmodels as $reldir) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").''.$langs->trans("Activated").''.$langs->trans("ShortInfo").'
'; + print ''; if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -530,7 +530,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } } - print ''; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print '
\n"; print "\n"; print ' \n"; print " \n"; -print '\n"; -print '\n"; -print ''; -print ''; +print '\n"; +print '\n"; +print ''; +print ''; print "\n"; clearstatcache(); @@ -637,7 +637,7 @@ foreach ($dirmodels as $reldir) // Active if (in_array($name, $def)) { - print ""; } // Default - print "'; // Preview - print '\n"; print ' \n"; print " \n"; - print '\n"; - print '\n"; - print ''; - print ''; + print '\n"; + print '\n"; + print ''; + print ''; print "\n"; clearstatcache(); @@ -794,7 +794,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) // Active if (in_array($name, $def)) { - print ""; } // Defaut - print "'; // Preview - print ''; // Date - print ''; + print ''; if (in_array($tablename, array('projet_task'))) print $langs->trans("TimeSpent"); if (! in_array($tablename, array('projet_task'))) print $langs->trans("Date"); print ''; @@ -799,17 +799,17 @@ foreach ($listofreferent as $key => $value) else print $langs->trans("ThirdParty"); print ''; // Amount HT - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; + //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; + if (empty($value['disableamount'])) print ''; else print ''; // Amount TTC - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; + if (empty($value['disableamount'])) print ''; else print ''; // Status - if (in_array($tablename, array('projet_task'))) print ''; - else print ''; + if (in_array($tablename, array('projet_task'))) print ''; + else print ''; print ''; $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field)?$project_field:'fk_projet'); @@ -888,7 +888,7 @@ foreach ($listofreferent as $key => $value) print "\n"; // Ref - print ''; // Status - print ''; - $breakline.=''; - $breakline.=''; + $breakline.=''; + $breakline.=''; $breakline.=''; $breakline.=''; } @@ -1146,23 +1146,23 @@ foreach ($listofreferent as $key => $value) print ''; if (in_array($tablename, array('projet_task'))) { - print ''; print ''; } - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - print ''; + //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; + print ''; - //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; - //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - print ''; + //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; + print '"; } diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 95b766ea405..618170607bd 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -70,13 +70,13 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ''; print ''; - print ''; + print ''; print "\n"; } } if ($conf->use_javascript_ajax) { - print ''; } //if ($totalinprocess != $total) - //print ''; - print ''; + //print ''; + print ''; print ''; + print ''; print "
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -645,13 +645,13 @@ foreach ($dirmodels as $reldir) } else { - print "\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ""; if ($conf->global->PROJECT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -672,12 +672,12 @@ foreach ($dirmodels as $reldir) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -740,10 +740,10 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) print "
'.$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").''.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; @@ -802,13 +802,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) } else { - print "\n"; + print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ""; if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); @@ -829,12 +829,12 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1); - print '
'; + print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; + print ''; if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'bill').''; @@ -870,27 +870,27 @@ print ''; print ''; print ''; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; print ''; print ''; if (! $conf->use_javascript_ajax) { - print '"; } else { - print '"; } @@ -899,7 +899,7 @@ print ''; print ''; print ''; -print '"; } @@ -1021,7 +1021,7 @@ elseif ($object->id > 0) if ($action == 'edit' && $userWrite > 0) { - print '
'; + print '
'; print '     '; print ''; print '
'; diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index 580107c66f9..5ee207033cf 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -159,7 +159,7 @@ print ''; // Categories if ($conf->categorie->enabled) { - print '
"; } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index a5372a7426e..95d5e3dd229 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -250,7 +250,7 @@ if ($id > 0 || ! empty($ref)) // Categories if ($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index d9d1ac4a603..9b393f8a1bf 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -227,7 +227,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_B // Categories if($conf->categorie->enabled) { - print '"; } @@ -563,10 +563,10 @@ print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy'); print '
".$langs->trans("Parameters")."'.$langs->trans("Value").''.$langs->trans("Value").' 
'.$langs->trans("UseSearchToSelectProject").''; + print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; + print ''; $arrval=array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', ); print $form->selectarray("activate_PROJECT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->PROJECT_USE_SEARCH_TO_SELECT); - print ''; + print ''; print ''; print "
'.$langs->trans("AllowToSelectProjectFromOtherCompany").''; +print ''; print ' '; print $form->textwithpicto('', $langs->trans('AllowToLinkFromOtherCompany')); print ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 2e42ce18095..282af6d3208 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1003,7 +1003,7 @@ elseif ($object->id > 0) // Categories if($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
' . $langs->trans("Categories") . ''; + print '
' . $langs->trans("Categories") . ''; print $form->showCategories($object->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
'; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print ''; foreach ($listofreferent as $key => $value) @@ -676,14 +676,14 @@ foreach ($listofreferent as $key => $value) // Module print ''; // Nb - print ''; + print ''; // Amount HT - print ''; // Amount TTC - print ''; @@ -693,9 +693,9 @@ foreach ($listofreferent as $key => $value) } // and the final balance print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; print "
'.$langs->trans("Element").''.$langs->trans("Number").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("Element").''.$langs->trans("Number").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").'
'.$name.''.$i.''.$i.''; + print ''; if (! $qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; else print price($total_ht); print ''; + print ''; if (! $qualifiedforfinalprofit) print ''.$form->textwithpicto($langs->trans("NA"), $langs->trans("AmountOfInteventionNotIncludedByDefault")).''; else print price($total_ttc); print '
'.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).''.$langs->trans("Profit").''.price(price2num($balance_ht, 'MT')).''.price(price2num($balance_ttc, 'MT')).'
"; @@ -787,7 +787,7 @@ foreach ($listofreferent as $key => $value) // Ref print ''.$langs->trans("Ref").'
'.$langs->trans("AmountHT").''.$langs->trans("Amount").''.$langs->trans("AmountHT").''.$langs->trans("AmountHT").''.$langs->trans("Amount").''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("AmountTTC").''.$langs->trans("AmountTTC").''.$langs->trans("AmountTTC").''.$langs->trans("ProgressDeclared").''.$langs->trans("Status").''.$langs->trans("ProgressDeclared").''.$langs->trans("Status").'
'; + print ''; if ($tablename == 'expensereport_det') { print $expensereport->getNomUrl(1); @@ -950,7 +950,7 @@ foreach ($listofreferent as $key => $value) if (empty($date)) $date=$element->datev; } } - print ''; + print ''; if ($tablename == 'actioncomm') { print dol_print_date($element->datep, 'dayhour'); @@ -1027,7 +1027,7 @@ foreach ($listofreferent as $key => $value) { $total_ht_by_line=$element->total_ht; } - print ''; + print ''; if ($othermessage) print $othermessage; if (isset($total_ht_by_line)) { @@ -1064,7 +1064,7 @@ foreach ($listofreferent as $key => $value) { $total_ttc_by_line=$element->total_ttc; } - print ''; + print ''; if ($othermessage) print $othermessage; if (isset($total_ttc_by_line)) { @@ -1078,7 +1078,7 @@ foreach ($listofreferent as $key => $value) else print ''; + print ''; if ($tablename == 'expensereport_det') { print $expensereport->getLibStatut(5); @@ -1129,8 +1129,8 @@ foreach ($listofreferent as $key => $value) $breakline.=$langs->trans('SubTotal').' : '; if (is_object($element->thirdparty)) $breakline.=$element->thirdparty->getNomUrl(0, '', 48); $breakline.=''.price($total_ht_by_third).''.price($total_ttc_by_third).''.price($total_ht_by_third).''.price($total_ttc_by_third).'
'.$langs->trans("Number").': '.$i.''; + print ''; print convertSecondToTime($total_time, 'allhourmin'); print ''; print ''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''; if (empty($value['disableamount'])) { if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); } print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; + //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; if (empty($value['disableamount'])) { if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 083a3be46c0..d9a9cc37ed8 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -175,7 +175,7 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, 'project', 1); print "
'.$labelstatus.''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).''.price((isset($valsamount[$status])?(float) $valsamount[$status]:0), 0, '', 1, -1, -1, $conf->currency).'
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -92,12 +92,12 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print '
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("OpportunityTotalAmount").' ('.$langs->trans("WonLostExcluded").')'.price($totalamount, 0, '', 1, -1, -1, $conf->currency).'
'; //print $langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')'; print $form->textwithpicto($langs->trans("OpportunityPonderatedAmount").' ('.$langs->trans("WonLostExcluded").')', $langs->trans("OpportunityPonderatedAmountDesc"), 1); - print ''.price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency).'
'.price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency).'
"; print ""; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 14cbaf1da1d..a4389339e46 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -221,7 +221,7 @@ if ($resql) print ' '; print '
'; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -237,7 +237,7 @@ if ($resql) } print ''.dol_print_date($db->jdate($obj->datem), 'day').''.$projectstatic->LibStatut($obj->fk_statut, 5).''.$projectstatic->LibStatut($obj->fk_statut, 5).'
'; print ''; print_liste_field_titre("OpenedProjectsByThirdparties", $_SERVER["PHP_SELF"], "s.nom", "", "", '', $sortfield, $sortorder); -print_liste_field_titre("NbOfProjects", "", "", "", "", 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("NbOfProjects", "", "", "", "", '', $sortfield, $sortorder, 'right '); print "\n"; $sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)"; @@ -289,7 +289,7 @@ if ( $resql ) print $langs->trans("OthersNotLinkedToThirdParty"); } print ''; - print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index dc4183bc6e0..06d41e8031f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -618,13 +618,13 @@ if (! empty($arrayfields['p.opp_percent']['checked'])) } if (! empty($arrayfields['p.budget_amount']['checked'])) { - print ''; } if (! empty($arrayfields['p.bill_time']['checked'])) { - print ''; } @@ -649,7 +649,7 @@ if (! empty($arrayfields['p.tms']['checked'])) } if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; } // Action column -print ''; @@ -670,24 +670,24 @@ if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['commercial']['checked'])) print_liste_field_titre($arrayfields['commercial']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['p.dateo']['checked'])) print_liste_field_titre($arrayfields['p.dateo']['label'], $_SERVER["PHP_SELF"], "p.dateo", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['p.datee']['checked'])) print_liste_field_titre($arrayfields['p.datee']['label'], $_SERVER["PHP_SELF"], "p.datee", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.public']['checked'])) print_liste_field_titre($arrayfields['p.public']['label'], $_SERVER["PHP_SELF"], "p.public", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, 'align="right"', $sortfield, $sortorder); -if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, 'align="right"', $sortfield, $sortorder); -if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, 'align="right"', $sortfield, $sortorder); -if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, 'align="right"', $sortfield, $sortorder); +if (! empty($arrayfields['p.fk_opp_status']['checked'])) print_liste_field_titre($arrayfields['p.fk_opp_status']['label'], $_SERVER["PHP_SELF"], 'p.fk_opp_status', "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['p.opp_amount']['checked'])) print_liste_field_titre($arrayfields['p.opp_amount']['label'], $_SERVER["PHP_SELF"], 'p.opp_amount', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.opp_percent']['checked'])) print_liste_field_titre($arrayfields['p.opp_percent']['label'], $_SERVER["PHP_SELF"], 'p.opp_percent', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre($arrayfields['p.budget_amount']['label'], $_SERVER["PHP_SELF"], 'p.budget_amount', "", $param, '', $sortfield, $sortorder, 'right '); +if (! empty($arrayfields['p.bill_time']['checked'])) print_liste_field_titre($arrayfields['p.bill_time']['label'], $_SERVER["PHP_SELF"], 'p.bill_time', "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $i=0; @@ -824,7 +824,7 @@ while ($i < min($num, $limit)) // Opp Amount if (! empty($arrayfields['p.opp_amount']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -846,7 +846,7 @@ while ($i < min($num, $limit)) // Budget if (! empty($arrayfields['p.budget_amount']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -884,7 +884,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['p.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -892,11 +892,11 @@ while ($i < min($num, $limit)) // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; else print ''; } - elseif ($totalarray['totaloppfield'] == $i) print ''; - elseif ($totalarray['totalbudgetfield'] == $i) print ''; + elseif ($totalarray['totaloppfield'] == $i) print ''; + elseif ($totalarray['totalbudgetfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 57e3648e208..e7e06e93352 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -297,7 +297,7 @@ if (! in_array($nowyear, $arrayyears)) $arrayyears[$nowyear]=$nowyear; arsort($arrayyears); print $form->selectarray('year', $arrayyears, $year, 0); print ''; -print ''; +print ''; print '
'; + print ''; if ($obj->socid) print ''.$obj->nb.''; else print ''.$obj->nb.''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $arrayofstatus = array(); foreach($object->statuts_short as $key => $val) $arrayofstatus[$key]=$langs->trans($val); $arrayofstatus['99']=$langs->trans("NotClosed").' ('.$langs->trans('Draft').' + '.$langs->trans('Opened').')'; @@ -658,7 +658,7 @@ if (! empty($arrayfields['p.fk_statut']['checked'])) print ''; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; //if ($obj->opp_status_code) if (strcmp($obj->opp_amount, '')) { @@ -838,7 +838,7 @@ while ($i < min($num, $limit)) // Opp percent if (! empty($arrayfields['p.opp_percent']['checked'])) { - print ''; + print ''; if ($obj->opp_percent) print price($obj->opp_percent, 1, $langs, 1, 0).'%'; print ''; + print ''; if ($obj->budget_amount != '') { print price($obj->budget_amount, 1, $langs, 1, -1, -1); @@ -859,7 +859,7 @@ while ($i < min($num, $limit)) // Bill time if (! empty($arrayfields['p.bill_time']['checked'])) { - print ''; + print ''; if ($obj->bill_time) { print yn($obj->bill_time); @@ -876,7 +876,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['p.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$object->getLibStatut(5).''.$object->getLibStatut(5).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -925,8 +925,8 @@ if (isset($totalarray['totaloppfield']) || isset($totalarray['totalbudgetfield'] if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).''.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).''.price($totalarray['totalopp'], 1, $langs, 1, -1, -1).''.price($totalarray['totalbudget'], 1, $langs, 1, -1, -1).'
'; print ''; print '

'; @@ -305,13 +305,13 @@ print '

'; print '
'; print ''; print ''; -print ''; -print ''; +print ''; +print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } print ''; @@ -324,25 +324,25 @@ foreach ($data_all_year as $val) $oldyear--; print ''; - print ''; + print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - print ''; + print ''; print ''; } print ''; - print ''; - print ''; + print ''; + print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } print ''; $oldyear=$year; @@ -353,7 +353,7 @@ print ''; print '
'; -$stringtoshow.= '
'.$langs->trans("Year").''.$langs->trans("NbOfProjects").''.$langs->trans("Year").''.$langs->trans("NbOfProjects").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityAmountAverageShort").''.$langs->trans("OpportunityAmountWeigthedShort").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityAmountAverageShort").''.$langs->trans("OpportunityAmountWeigthedShort").'
0?'&userid='.$userid:'').'">'.$oldyear.'0?'&userid='.$userid:'').'">'.$oldyear.'00000000
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].'0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.($val['total']?price(price2num($val['total'], 'MT'), 1):'0').''.($val['avg']?price(price2num($val['avg'], 'MT'), 1):'0').''.($val['weighted']?price(price2num($val['weighted'], 'MT'), 1):'0').''.($val['total']?price(price2num($val['total'], 'MT'), 1):'0').''.($val['avg']?price(price2num($val['avg'], 'MT'), 1):'0').''.($val['weighted']?price(price2num($val['weighted'], 'MT'), 1):'0').'
'; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ac64f65381c..46bc16dfa8c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1590,7 +1590,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; @@ -1677,7 +1677,7 @@ if ($action == 'create') print ''; print ''; print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 45c10a3aedd..6afee20b371 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1636,7 +1636,7 @@ if ($action == 'create' && $user->rights->commande->creer) }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; @@ -1727,7 +1727,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6b633f99309..e3e67f23585 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2696,7 +2696,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; @@ -3092,7 +3092,7 @@ if ($action == 'create') $langs->load('projects'); print ''; } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index ee69d8d89f3..f84a805caef 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -771,11 +771,6 @@ else print '
'; -/*if ($user->societe_id == 0 && count($accounts) == 1 && $action == 'new' && $user->rights->banque->cheque) -{ - print ''.$langs->trans('NewCheckReceipt').''; -}*/ - if ($user->societe_id == 0 && ! empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) { print ''.$langs->trans('Validate').''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 799c06564df..d3026d0264e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1212,7 +1212,7 @@ if ($action == 'create') { print '
'; } print ''."\n"; @@ -1254,7 +1254,7 @@ if ($action == 'create') print '"; } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 40d0616ad37..62f56d04844 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -372,7 +372,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } print '' . "\n"; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 4886d5c5086..c386327bea6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -960,7 +960,7 @@ if ($action == 'create') print ''; print ''; print ''; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index eb4ca875448..987968e241f 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -948,7 +948,7 @@ if ($action == 'create') $numprojet=$formproject->select_projects($soc->id, $projectid, 'projectid'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").' '; } print ''; } @@ -961,7 +961,7 @@ if ($action == 'create') $numcontrat=$formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1); if ($numcontrat==0) { - print '   '.$langs->trans("AddContract").''; + print '   '.$langs->trans("AddContract").' '; } print ''; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 353fe5273f1..644ebd79347 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1496,7 +1496,7 @@ if ($action=='create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; } print ''; @@ -1558,7 +1558,7 @@ if ($action=='create') $langs->load('projects'); print ''; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 24834b508ac..70407661d52 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1755,7 +1755,7 @@ if ($action == 'create') }); '; } - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; } print ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 282af6d3208..8089b66680d 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -556,7 +556,7 @@ if ($action == 'create' && $user->rights->projet->creer) print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1); } else print $text; - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print ''; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 18b67fb1e4c..c2400abea1d 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -805,7 +805,7 @@ if ($action == 'create') print ''; print ''; print ''; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index ebc07e0b529..c8a161d7b90 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1084,7 +1084,7 @@ if ($action == 'create') } else { print ''; } print '' . "\n"; @@ -1165,7 +1165,7 @@ if ($action == 'create') print ''; print ''; From 672c7f8b1912202322c1fffa803766938293b10c Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 26 Feb 2019 22:31:07 +0100 Subject: [PATCH 155/190] Fix phpcs --- htdocs/hrm/class/establishment.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index ec579132f44..467201940ce 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -451,6 +451,7 @@ class Establishment extends CommonObject /** * Return clicable name (with picto eventually) * + * @param int $id Id of record * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @return string String with URL */ From 0a28d062133f21ed47352383c27a088aef98e202 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 26 Feb 2019 22:36:53 +0100 Subject: [PATCH 156/190] Add parent company --- htdocs/hrm/establishment/card.php | 3018 ++++------------------------- 1 file changed, 362 insertions(+), 2656 deletions(-) diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 69f3f9b880d..af242515a24 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -1,18 +1,5 @@ - * Copyright (C) 2003 Brian Fraval - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2011-2013 Alexandre Spangaro - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2015 Alexandre Spangaro * * 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 @@ -29,2704 +16,423 @@ */ /** - * \file htdocs/societe/card.php - * \ingroup societe - * \brief Third party card page + * \file htdocs/hrm/establishment/card.php + * \brief Page to show an establishment */ - -require '../main.inc.php'; +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -$langs->loadLangs(array("companies","commercial","bills","banks","users")); -if (! empty($conf->categorie->enabled)) $langs->load("categories"); -if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); -if (! empty($conf->notification->enabled)) $langs->load("mails"); - -$mesg=''; $error=0; $errors=array(); - -$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); -$cancel = GETPOST('cancel', 'alpha'); -$backtopage = GETPOST('backtopage', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); - -$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); -if ($user->societe_id) $socid=$user->societe_id; -if (empty($socid) && $action == 'view') $action='create'; - -$object = new Societe($db); -$extrafields = new ExtraFields($db); - -// fetch optionals attributes and labels -$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('thirdpartycard','globalcard')); - -if ($socid > 0) $object->fetch($socid); - -if (! ($object->id > 0) && $action == 'view') -{ - $langs->load("errors"); - print($langs->trans('ErrorRecordNotFound')); - exit; -} - -// Get object canvas (By default, this is not defined, so standard usage of dolibarr) -$object->getCanvas($socid); -$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); -$objcanvas=null; -if (! empty($canvas)) -{ - require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; - $objcanvas = new Canvas($db, $action); - $objcanvas->getCanvas('thirdparty', 'card', $canvas); -} +// Load translation files required by the page +$langs->loadLangs(array('admin', 'hrm')); // Security check -$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); +if (! $user->admin) accessforbidden(); + +$error=0; + +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$id = GETPOST('id', 'int'); + +// List of status +static $tmpstatus2label=array( + '0'=>'CloseEtablishment', + '1'=>'OpenEtablishment' +); +$status2label=array(''); +foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val); + +$object = new Establishment($db); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once /* * Actions */ -$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - -if (empty($reshook)) +if ($action == 'confirm_delete' && $confirm == "yes") { - if ($cancel) + $result=$object->delete($id); + if ($result >= 0) { - $action=''; - if (! empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } + header("Location: ../admin/admin_establishment.php"); + exit; } - - if ($action == 'confirm_merge' && $confirm == 'yes' && $user->rights->societe->creer) - { - $error = 0; - $soc_origin_id = GETPOST('soc_origin', 'int'); - $soc_origin = new Societe($db); - - if ($soc_origin_id <= 0) - { - $langs->load('errors'); - $langs->load('companies'); - setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); - } - else - { - if (!$error && $soc_origin->fetch($soc_origin_id) < 1) - { - setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); - $error++; - } - - if (!$error) - { - // TODO Move the merge function into class of object. - - $db->begin(); - - // Recopy some data - $object->client = $object->client | $soc_origin->client; - $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; - $listofproperties=array( - 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'url', 'barcode', - 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', - 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', - 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', - 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', - 'model_pdf', 'fk_projet' - ); - foreach ($listofproperties as $property) - { - if (empty($object->$property)) $object->$property = $soc_origin->$property; - } - - // Concat some data - $listofproperties=array( - 'note_public', 'note_private' - ); - foreach ($listofproperties as $property) - { - $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); - } - - // Merge extrafields - if (is_array($soc_origin->array_options)) - { - foreach ($soc_origin->array_options as $key => $val) - { - if (empty($object->array_options[$key])) $object->array_options[$key] = $val; - } - } - - // Merge categories - $static_cat = new Categorie($db); - - $custcats_ori = $static_cat->containing($soc_origin->id, 'customer', 'id'); - $custcats = $static_cat->containing($object->id, 'customer', 'id'); - $custcats = array_merge($custcats, $custcats_ori); - $object->setCategories($custcats, 'customer'); - - $suppcats_ori = $static_cat->containing($soc_origin->id, 'supplier', 'id'); - $suppcats = $static_cat->containing($object->id, 'supplier', 'id'); - $suppcats = array_merge($suppcats, $suppcats_ori); - $object->setCategories($suppcats, 'supplier'); - - // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. - if ($soc_origin->code_client == $object->code_client - || $soc_origin->code_fournisseur == $object->code_fournisseur - || $soc_origin->barcode == $object->barcode) - { - dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); - $soc_origin->code_client = ''; - $soc_origin->code_fournisseur = ''; - $soc_origin->barcode = ''; - $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); - } - - // Update - $object->update($object->id, $user, 0, 1, 1, 'merge'); - if ($result < 0) - { - $error++; - } - - // Move links - if (! $error) - { - $objects = array( - 'Adherent' => '/adherents/class/adherent.class.php', - 'Societe' => '/societe/class/societe.class.php', - //'Categorie' => '/categories/class/categorie.class.php', - 'ActionComm' => '/comm/action/class/actioncomm.class.php', - 'Propal' => '/comm/propal/class/propal.class.php', - 'Commande' => '/commande/class/commande.class.php', - 'Facture' => '/compta/facture/class/facture.class.php', - 'FactureRec' => '/compta/facture/class/facture-rec.class.php', - 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', - 'Contact' => '/contact/class/contact.class.php', - 'Contrat' => '/contrat/class/contrat.class.php', - 'Expedition' => '/expedition/class/expedition.class.php', - 'Fichinter' => '/fichinter/class/fichinter.class.php', - 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', - 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', - 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', - 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Livraison' => '/livraison/class/livraison.class.php', - 'Product' => '/product/class/product.class.php', - 'Project' => '/projet/class/project.class.php', - 'User' => '/user/class/user.class.php', - ); - - //First, all core objects must update their tables - foreach ($objects as $object_name => $object_file) - { - require_once DOL_DOCUMENT_ROOT.$object_file; - - if (!$error && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - } - } - } - - // External modules should update their ones too - if (! $error) - { - $reshook = $hookmanager->executeHooks('replaceThirdparty', array( - 'soc_origin' => $soc_origin->id, - 'soc_dest' => $object->id - ), $soc_dest, $action); - - if ($reshook < 0) - { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $error++; - } - } - - - if (! $error) - { - $object->context=array('merge'=>1, 'mergefromid'=>$soc_origin->id); - - // Call trigger - $result=$object->call_trigger('COMPANY_MODIFY', $user); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - // End call triggers - } - - if (!$error) - { - //We finally remove the old thirdparty - if ($soc_origin->delete($soc_origin->id, $user) < 1) - { - $error++; - } - } - - if (!$error) - { - setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); - $db->commit(); - } - else - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); - $db->rollback(); - } - } - } - } - - if (GETPOST('getcustomercode')) + else { - // We defined value code_client - $_POST["customer_code"]="Acompleter"; + setEventMessages($object->error, $object->errors, 'errors'); } - - if (GETPOST('getsuppliercode')) - { - // We defined value code_fournisseur - $_POST["supplier_code"]="Acompleter"; - } - - if($action=='set_localtax1') - { - //obtidre selected del combobox - $value=GETPOST('lt1'); - $object->fetch($socid); - $res=$object->setValueFrom('localtax1_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); - } - if($action=='set_localtax2') - { - //obtidre selected del combobox - $value=GETPOST('lt2'); - $object->fetch($socid); - $res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); - } - - if ($action == 'update_extras') { - $object->fetch($socid); - - $object->oldcopy = dol_clone($object); - - // Fill array 'array_options' with data from update form - $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); - if ($ret < 0) $error++; - - if (! $error) - { - $result = $object->insertExtraFields('COMPANY_MODIFY'); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - } - - if ($error) $action = 'edit_extras'; - } - - // Add new or update third party - if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) - && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - - if (! GETPOST('name')) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors'); - $error++; - } - if (GETPOST('client') < 0) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors'); - $error++; - } - if (GETPOST('fournisseur') < 0) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors'); - $error++; - } - - if (! $error) - { - if ($action == 'update') - { - $ret=$object->fetch($socid); - $object->oldcopy = clone $object; - } - else $object->canvas=$canvas; - - if (GETPOST("private") == 1) // Ask to create a contact - { - $object->particulier = GETPOST("private"); - - $object->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('name', 'alpha')); - $object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int - // Add non official properties - $object->name_bis = GETPOST('name', 'alpha'); - $object->firstname = GETPOST('firstname', 'alpha'); - } - else - { - $object->name = GETPOST('name', 'alpha'); - } - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); - $object->name_alias = GETPOST('name_alias'); - $object->address = GETPOST('address'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->country_id = GETPOST('country_id', 'int'); - $object->state_id = GETPOST('state_id', 'int'); - $object->skype = GETPOST('skype', 'alpha'); - $object->twitter = GETPOST('twitter', 'alpha'); - $object->facebook = GETPOST('facebook', 'alpha'); - $object->phone = GETPOST('phone', 'alpha'); - $object->fax = GETPOST('fax', 'alpha'); - $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); - $object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); - $object->idprof1 = trim(GETPOST('idprof1', 'alpha')); - $object->idprof2 = trim(GETPOST('idprof2', 'alpha')); - $object->idprof3 = trim(GETPOST('idprof3', 'alpha')); - $object->idprof4 = trim(GETPOST('idprof4', 'alpha')); - $object->idprof5 = trim(GETPOST('idprof5', 'alpha')); - $object->idprof6 = trim(GETPOST('idprof6', 'alpha')); - $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); - $object->code_client = GETPOSTISSET('customer_code')?GETPOST('customer_code', 'alpha'):GETPOST('code_client', 'alpha'); - $object->code_fournisseur = GETPOSTISSET('supplier_code')?GETPOST('supplier_code', 'alpha'):GETPOST('code_fournisseur', 'alpha'); - $object->capital = GETPOST('capital', 'alpha'); - $object->barcode = GETPOST('barcode', 'alpha'); - - $object->tva_intra = GETPOST('tva_intra', 'alpha'); - $object->tva_assuj = GETPOST('assujtva_value', 'alpha'); - $object->status = GETPOST('status', 'alpha'); - - // Local Taxes - $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha'); - $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'alpha'); - - $object->localtax1_value = GETPOST('lt1', 'alpha'); - $object->localtax2_value = GETPOST('lt2', 'alpha'); - - $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); - $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->typent_id = GETPOST('typent_id', 'int'); - - $object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type - - $object->client = GETPOST('client', 'int'); - $object->fournisseur = GETPOST('fournisseur', 'int'); - - $object->commercial_id = GETPOST('commercial_id', 'int'); - $object->default_lang = GETPOST('default_lang'); - - // Webservices url/key - $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); - $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); - - // Incoterms - if (!empty($conf->incoterm->enabled)) - { - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); - } - - // Multicurrency - if (!empty($conf->multicurrency->enabled)) - { - $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - } - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) - { - $error++; - } - - if (GETPOST('deletephoto')) $object->logo = ''; - elseif (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); - - // Check parameters - if (! GETPOST('cancel', 'alpha')) - { - if (! empty($object->email) && ! isValidEMail($object->email)) - { - $langs->load("errors"); - $error++; - setEventMessages('', $langs->trans("ErrorBadEMail", $object->email), 'errors'); - } - if (! empty($object->url) && ! isValidUrl($object->url)) - { - $langs->load("errors"); - setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors'); - } - if (! empty($object->webservices_url)) { - //Check if has transport, without any the soap client will give error - if (strpos($object->webservices_url, "http") === false) - { - $object->webservices_url = "http://".$object->webservices_url; - } - if (! isValidUrl($object->webservices_url)) { - $langs->load("errors"); - $error++; $errors[] = $langs->trans("ErrorBadUrl", $object->webservices_url); - } - } - - // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id; - if ($object->country_id) - { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; - } - } - } - - if (! $error) - { - if ($action == 'add') - { - $error = 0; - - $db->begin(); - - if (empty($object->client)) $object->code_client=''; - if (empty($object->fournisseur)) $object->code_fournisseur=''; - - $result = $object->create($user); - - if ($result >= 0) - { - if ($object->particulier) - { - dol_syslog("We ask to create a contact/address too", LOG_DEBUG); - $result=$object->create_individual($user); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - } - - // Links with users - $salesreps = GETPOST('commercial', 'array'); - $result = $object->setSalesRep($salesreps); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } - - // Customer categories association - $custcats = GETPOST('custcats', 'array'); - $result = $object->setCategories($custcats, 'customer'); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } - - // Supplier categories association - $suppcats = GETPOST('suppcats', 'array'); - $result = $object->setCategories($suppcats, 'supplier'); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } - - // Logo/Photo save - $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; - $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); - if ($file_OK) - { - if (image_format_supported($_FILES['photo']['name'])) - { - dol_mkdir($dir); - - if (@is_dir($dir)) - { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); - - if (! $result > 0) - { - $errors[] = "ErrorFailedToSaveFile"; - } - else - { - // Create thumbs - $object->addThumbs($newfile); - } - } - } - } - else - { - switch($_FILES['photo']['error']) - { - case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini - case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form - $errors[] = "ErrorFileSizeTooLarge"; - break; - case 3: //uploaded file was only partially uploaded - $errors[] = "ErrorFilePartiallyUploaded"; - break; - } - } - // Gestion du logo de la société - } - else - { - if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case - { - $duplicate_code_error = true; - $object->code_fournisseur = null; - $object->code_client = null; - } - - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - - if ($result >= 0 && ! $error) - { - $db->commit(); - - if (! empty($backtopage)) - { - if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id; - header("Location: ".$backtopage); - exit; - } - else - { - $url=$_SERVER["PHP_SELF"]."?socid=".$object->id; - if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/card.php?socid=".$object->id; - elseif ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; - - header("Location: ".$url); - exit; - } - } - else - { - $db->rollback(); - $action='create'; - } - } - - if ($action == 'update') - { - $error = 0; - - if (GETPOST('cancel', 'alpha')) - { - if (! empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } - else - { - header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); - exit; - } - } - - // To not set code if third party is not concerned. But if it had values, we keep them. - if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client=''; - if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur=''; - //var_dump($object);exit; - - $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); - if ($result <= 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - - // Links with users - $salesreps = GETPOST('commercial', 'array'); - $result = $object->setSalesRep($salesreps); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } - - // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) - if (! $error && !empty($user->rights->categorie->lire)) - { - // Customer categories association - $categories = GETPOST( 'custcats', 'array' ); - $result = $object->setCategories($categories, 'customer'); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } - - // Supplier categories association - $categories = GETPOST('suppcats', 'array'); - $result = $object->setCategories($categories, 'supplier'); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - // Logo/Photo save - $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; - $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); - if (GETPOST('deletephoto') && $object->logo) - { - $fileimg=$dir.'/'.$object->logo; - $dirthumbs=$dir.'/thumbs'; - dol_delete_file($fileimg); - dol_delete_dir_recursive($dirthumbs); - } - if ($file_OK) - { - if (image_format_supported($_FILES['photo']['name']) > 0) - { - dol_mkdir($dir); - - if (@is_dir($dir)) - { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); - - if (! $result > 0) - { - $errors[] = "ErrorFailedToSaveFile"; - } - else - { - // Create thumbs - $object->addThumbs($newfile); - - // Index file in database - if (! empty($conf->global->THIRDPARTY_LOGO_ALLOW_EXTERNAL_DOWNLOAD)) - { - require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; - // the dir dirname($newfile) is directory of logo, so we should have only one file at once into index, so we delete indexes for the dir - deleteFilesIntoDatabaseIndex(dirname($newfile), '', '', 'uploaded', 1); - // now we index the uploaded logo file - addFileIntoDatabaseIndex(dirname($newfile), basename($newfile), '', 'uploaded', 1); - } - } - } - } - else - { - $errors[] = "ErrorBadImageFormat"; - } - } - else - { - switch($_FILES['photo']['error']) - { - case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini - case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form - $errors[] = "ErrorFileSizeTooLarge"; - break; - case 3: //uploaded file was only partially uploaded - $errors[] = "ErrorFilePartiallyUploaded"; - break; - } - } - // Gestion du logo de la société - - - // Update linked member - if (! $error && $object->fk_soc > 0) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; - $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; - if (! $object->db->query($sql)) - { - $error++; - $object->error .= $object->db->lasterror(); - setEventMessages($object->error, $object->errors, 'errors'); - } - } - - if (! $error && ! count($errors)) - { - if (! empty($backtopage)) - { - header("Location: ".$backtopage); - exit; - } - else - { - header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); - exit; - } - } - else - { - $object->id = $socid; - $action= "edit"; - } - } - } - else - { - $action = ($action=='add'?'create':'edit'); - } - } - - // Delete third party - if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) - { - $object->fetch($socid); - $result = $object->delete($socid, $user); - - if ($result > 0) - { - header("Location: ".DOL_URL_ROOT."/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode($object->name)); - exit; - } - else - { - $langs->load("errors"); - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - $action=''; - } - } - - // Set parent company - if ($action == 'set_thirdparty' && $user->rights->societe->creer) - { - $object->fetch($socid); - $result = $object->set_parent(GETPOST('editparentcompany', 'int')); - } - - // Set incoterm - if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) - { - $object->fetch($socid); - $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); - } - - $id=$socid; - $object->fetch($socid); - - // Actions to send emails - $trigger_name='COMPANY_SENTBYMAIL'; - $paramname='socid'; - $mode='emailfromthirdparty'; - $trackid='thi'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - - // Actions to build doc - $id = $socid; - $upload_dir = $conf->societe->dir_output; - $permissioncreate=$user->rights->societe->creer; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } +elseif ($action == 'add') +{ + if (! $cancel) + { + $error=0; + + $object->name = GETPOST('name', 'alpha'); + if (empty($object->name)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); + $error++; + } + + if (empty($error)) + { + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = $_POST["country_id"]; + $object->status = GETPOST('status', 'int'); + $object->fk_user_author = $user->id; + $object->datec = dol_now(); + $object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity; + + $id = $object->create($user); + + if ($id > 0) + { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else + { + $action='create'; + } + } + else + { + header("Location: ../admin/admin_establishment.php"); + exit; + } +} + +// Update record +elseif ($action == 'update') +{ + $error = 0; + + if (! $cancel) { + + $name = GETPOST('name', 'alpha'); + if (empty($name)) { + setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('Name')), null, 'errors'); + $error ++; + } + + if (empty($error)) + { + $object->name = GETPOST('name', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->fk_user_mod = $user->id; + $object->status = GETPOST('status', 'int'); + $object->entity = GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity; + + $result = $object->update($user); + + if ($result > 0) + { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $_POST['id']); + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } else { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $_POST['id']); + exit; + } +} /* - * View + * View */ +llxHeader(); + $form = new Form($db); -$formfile = new FormFile($db); -$formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); -if ($socid > 0 && empty($object->id)) +/* + * Action create + */ +if ($action == 'create') { - $result=$object->fetch($socid); - if ($result <= 0) dol_print_error('', $object->error); + print load_fiche_titre($langs->trans("NewEstablishment")); + + print '
'; + print ''; + print ''; + + dol_fiche_head(); + + print '
'; +$stringtoshow.= ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; // Action column - print ''; @@ -712,14 +712,14 @@ elseif ($id > 0 || ! empty($ref)) // print ''; print_liste_field_titre("RefTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); print_liste_field_titre("LabelTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, ''); - print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, ''); - print_liste_field_titre("PlannedWorkload", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, ''); - if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'align="center" width="80"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("PlannedWorkload", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + if (! empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; if (count($tasksarray) > 0) diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index a817f1df4f0..679f6a29dc2 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -191,7 +191,7 @@ if ($id > 0 || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index ab1806ea461..af8dc9d39cf 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -263,7 +263,7 @@ if ($id > 0 || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '"; } @@ -380,7 +380,7 @@ if ($id > 0 || ! empty($ref)) print ''; - print ''; + print ''; print ''; print ''; @@ -415,7 +415,7 @@ if ($id > 0 || ! empty($ref)) print ''; - print ''; print ''; @@ -430,7 +430,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -493,7 +493,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Statut - print ''; // Icon update et delete - print '"; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index be44923ea8b..a63b858e488 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -565,7 +565,7 @@ if (! empty($arrayfields['t.tms']['checked'])) print ''; } // Action column -print ''; @@ -574,25 +574,25 @@ print "\n"; print ''; if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); -if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, 'align="center"', $sortfield, $sortorder); -if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, 'align="center"'); -if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, 'align="center"', $sortfield, $sortorder); +if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); +if (! empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); +if (! empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -697,7 +697,7 @@ while ($i < min($num, $limit)) // Project status if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -770,7 +770,7 @@ while ($i < min($num, $limit)) // Date creation if (! empty($arrayfields['t.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -778,7 +778,7 @@ while ($i < min($num, $limit)) // Date modification if (! empty($arrayfields['t.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -787,10 +787,10 @@ while ($i < min($num, $limit)) /*if (! empty($arrayfields['p.fk_statut']['checked'])) { $projectstatic->statut = $obj->fk_statut; - print ''; + print ''; }*/ // Action column - print ''; else print ''; } - elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; - elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; - elseif ($totalarray['totalprogress_calculated'] == $i) print ''; + elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''; + elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; + elseif ($totalarray['totalprogress_calculated'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index a0c3b517769..02925f1092f 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -186,7 +186,7 @@ if ($object->id > 0) // Categories if($conf->categorie->enabled) { - print '"; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8472c4d54ce..b3c3e151af8 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -302,7 +302,7 @@ if ($id > 0 || ! empty($ref)) // Categories if($conf->categorie->enabled) { - print '"; } @@ -428,7 +428,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); - print '
'; + print '
'; print '   '; print ''; print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 1258027d615..37934aa0957 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -539,7 +539,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Categories if ($conf->categorie->enabled) { - print '
"; } @@ -758,7 +758,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); print ''; - print ''; } - print '\n"; $tasktmp = new Task($db); @@ -1296,7 +1296,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { - print ''; @@ -1327,7 +1327,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Invoiced - Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; @@ -1538,7 +1538,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; @@ -1661,7 +1661,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { - print ''; @@ -1686,7 +1686,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value billed if (! empty($arrayfields['valuebilled']['checked'])) { - print ''; @@ -1725,9 +1725,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) if ($num < $limit && empty($offset)) print ''; else print ''; } - elseif ($totalarray['totaldurationfield'] == $i) print ''; - elseif ($totalarray['totalvaluefield'] == $i) print ''; - //elseif ($totalarray['totalvaluebilledfield'] == $i) print ''; + elseif ($totalarray['totaldurationfield'] == $i) print ''; + elseif ($totalarray['totalvaluefield'] == $i) print ''; + //elseif ($totalarray['totalvaluebilledfield'] == $i) print ''; else print ''; } print ''; From c7df326a915a9fb563b3dd84bfdb0c6b3c52fcc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 22:31:57 +0100 Subject: [PATCH 101/190] replace html code by html5 --- .../boxes/box_graph_orders_supplier_permonth.php | 14 +++++++------- htdocs/core/class/dolgraph.class.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 9f7a457e238..c3cdbcef412 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -28,18 +28,18 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_graph_orders_supplier_permonth extends ModeleBoxes { - var $boxcode="orderssupplierpermonth"; - var $boximg="object_order"; - var $boxlabel="BoxSuppliersOrdersPerMonth"; - var $depends = array("fournisseur"); + public $boxcode="orderssupplierpermonth"; + public $boximg="object_order"; + public $boxlabel="BoxSuppliersOrdersPerMonth"; + public $depends = array("fournisseur"); - /** + /** * @var DoliDB Database handler. */ public $db; - var $info_box_head = array(); - var $info_box_contents = array(); + public $info_box_head = array(); + public $info_box_contents = array(); /** diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 2a92d14c7b9..7fd9258ddd7 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -936,7 +936,7 @@ class DolGraph $tag=dol_escape_htmltag(dol_string_unaccent(dol_string_nospecial(basename($file), '_', array('-','.')))); $this->stringtoshow =''."\n"; - if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; + if (! empty($this->title)) $this->stringtoshow.='
'.$this->title.'
'; if (! empty($this->shownographyet)) { $this->stringtoshow.='
'; From 51b29f2ed504d5987eeb9757f6ae5dee5dbcf13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 23 Feb 2019 22:43:53 +0100 Subject: [PATCH 102/190] replace html code by html5 in tpl --- htdocs/core/tpl/advtarget.tpl.php | 2 +- htdocs/core/tpl/bloc_comment.tpl.php | 2 +- htdocs/core/tpl/contacts.tpl.php | 4 ++-- .../tpl/extrafields_list_print_fields.tpl.php | 2 +- .../tpl/extrafields_list_search_param.tpl.php | 12 +++++------ htdocs/core/tpl/extrafields_view.tpl.php | 2 +- htdocs/core/tpl/filemanager.tpl.php | 2 +- htdocs/core/tpl/objectline_edit.tpl.php | 2 +- htdocs/core/tpl/originproductline.tpl.php | 10 +++++----- htdocs/core/tpl/passwordforgotten.tpl.php | 2 +- htdocs/core/tpl/resource_add.tpl.php | 2 +- htdocs/core/tpl/resource_view.tpl.php | 20 +++++++++---------- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index dadfff3e62e..2c351996632 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -541,7 +541,7 @@ print ''; - echo $dialog; - if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { - echo ''; - } elseif ($parameters['currentcontext'] == 'membercard') { - echo ''; - } elseif ($parameters['currentcontext'] == 'contactcard') { - echo ''; - } - if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { - echo ''; - } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') { - echo ''; - } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'contactcard') { - echo ''; - } + return false; + }); + } ); + '; + echo $dialog; + if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { + echo ''; + } elseif ($parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif ($parameters['currentcontext'] == 'contactcard') { + echo ''; + } + if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'contactcard') { + echo ''; + } } } diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 4b89b79e273..b3cb0ce3cd9 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -30,11 +30,11 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; */ Class DataPolicy { - /** - * getAllContactNotInformed - * - * @return number - */ + /** + * getAllContactNotInformed + * + * @return number + */ function getAllContactNotInformed() { global $langs, $conf, $db, $user; @@ -144,71 +144,71 @@ Class DataPolicy */ function sendMailDataPolicyContact($contact) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $contact->email; - $code= md5($contact->email); - if (!empty($contact->default_lang)) { - $l = $contact->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $sendto = $contact->email; + $code= md5($contact->email); + if (!empty($contact->default_lang)) { + $l = $contact->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( - '__LINKACCEPT__' => ''.$linka.'', - '__LINKREFUSED__' => ''.$linkr.'', - '__FIRSTNAME__' => $contact->firstname, - '__NAME__' => $contact->lastname, - '__CIVILITY__' => $contact->civility, - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + '__FIRSTNAME__' => $contact->firstname, + '__NAME__' => $contact->lastname, + '__CIVILITY__' => $contact->civility, + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); - if (!$error) { + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); + if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $contact->update($contact->id); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $contact->update($contact->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } /** @@ -219,44 +219,44 @@ Class DataPolicy */ function sendMailDataPolicyCompany($societe) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $societe->email; + $sendto = $societe->email; - $code= md5($societe->email); - if (!empty($societe->default_lang)) { - $l = $societe->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); @@ -264,23 +264,23 @@ Class DataPolicy $actionmsg .= dol_concatdesc($actionmsg, $message); } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); - if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $societe->update($societe->id); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $societe->update($societe->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } /** @@ -291,66 +291,66 @@ Class DataPolicy */ function sendMailDataPolicyAdherent($adherent) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $adherent->email; + $sendto = $adherent->email; - $code= md5($adherent->email); - if (!empty($adherent->default_lang)) { - $l = $adherent->default_lang; - } else { - $l = $langs->defaultlang; - } - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($adherent->email); + if (!empty($adherent->default_lang)) { + $l = $adherent->default_lang; + } else { + $l = $langs->defaultlang; + } + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg .= dol_concatdesc($actionmsg, $message); - } + } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); - if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $adherent->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $adherent->update($user); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $adherent->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $adherent->update($user); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } } diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 01478580a3a..656831eed2f 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France * * This program is free software: you can redistribute it and/or modify @@ -17,7 +17,7 @@ */ /** - * \file datapolicy/class/datapolicycron.class.php + * \file htdocs/datapolicy/class/datapolicycron.class.php * \ingroup datapolicy * \brief Example hook overload. */ @@ -27,11 +27,11 @@ */ class DataPolicyCron { - /** - * Function exec - * - * @return boolean - */ + /** + * Function exec + * + * @return boolean + */ public function exec() { global $conf, $db, $langs, $user; diff --git a/htdocs/datapolicy/lib/datapolicy.lib.php b/htdocs/datapolicy/lib/datapolicy.lib.php index 41c92299989..b72417d7ff9 100644 --- a/htdocs/datapolicy/lib/datapolicy.lib.php +++ b/htdocs/datapolicy/lib/datapolicy.lib.php @@ -1,5 +1,6 @@ + * 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 @@ -16,7 +17,7 @@ */ /** - * \file datapolicy/lib/datapolicy.lib.php + * \file htdocs/datapolicy/lib/datapolicy.lib.php * \ingroup datapolicy * \brief Library files with common functions for datapolicy */ @@ -28,27 +29,26 @@ */ function datapolicyAdminPrepareHead() { - global $langs, $conf; + global $langs, $conf; - $langs->load("datapolicy@datapolicy"); + $langs->load("datapolicy@datapolicy"); - $h = 0; - $head = array(); + $h = 0; + $head = array(); - $head[$h][0] = dol_buildpath("/datapolicy/admin/setup.php", 1); - $head[$h][1] = $langs->trans("Deletion"); - $head[$h][2] = 'settings'; - $h++; + $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setup.php"; + $head[$h][1] = $langs->trans("Deletion"); + $head[$h][2] = 'settings'; + $h++; - if (! empty($conf->global->DATAPOLICIES_ENABLE_EMAILS)) - { - $head[$h][0] = dol_buildpath("/datapolicy/admin/setupmail.php", 1); - $head[$h][1] = $langs->trans("DATAPOLICIESMail"); - $head[$h][2] = 'settings'; - $h++; - } + if (! empty($conf->global->DATAPOLICIES_ENABLE_EMAILS)) { + $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setupmail.php"; + $head[$h][1] = $langs->trans("DATAPOLICIESMail"); + $head[$h][2] = 'settings'; + $h++; + } - complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicy'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicy'); - return $head; + return $head; } diff --git a/htdocs/datapolicy/mailing.php b/htdocs/datapolicy/mailing.php index e3f38b269be..69da78e00ac 100644 --- a/htdocs/datapolicy/mailing.php +++ b/htdocs/datapolicy/mailing.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Nicolas ZABOURI + * 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 @@ -16,22 +17,22 @@ */ /** - * \file datapolicy/mailing.php + * \file htdocs/datapolicy/mailing.php * \ingroup datapolicy * \brief datapolicy mailing page. */ require '../../main.inc.php'; -dol_include_once('/contact/class/contact.class.php'); -dol_include_once('/datapolicy/class/datapolicy.class.php'); +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php'; $idcontact = GETPOST('idc'); -if(!empty($idcontact)){ +if (!empty($idcontact)) { $contact = new Contact($db); $contact->fetch($idcontact); DataPolicy::sendMailDataPolicyContact($contact); -}else{ +} else { $contacts = new DataPolicy($db); $contacts->getAllContactNotInformed(); diff --git a/htdocs/datapolicy/public/index.php b/htdocs/datapolicy/public/index.php index f819fb079f5..6c78f380b93 100644 --- a/htdocs/datapolicy/public/index.php +++ b/htdocs/datapolicy/public/index.php @@ -17,7 +17,7 @@ */ /** - * \file datapolicy/admin/setup.php + * \file htdocs/datapolicy/admin/setup.php * \ingroup datapolicy * \brief datapolicy setup page. */ @@ -30,11 +30,11 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); require '../../main.inc.php'; -dol_include_once('/contact/class/contact.class.php'); -dol_include_once('/societe/class/societe.class.php'); -dol_include_once('/adherents/class/adherent.class.php'); -dol_include_once('/user/class/user.class.php'); -dol_include_once('/datapolicy/class/datapolicy.class.php'); +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php'; $idc = GETPOST('c', 'int'); $ids = GETPOST('s', 'int'); diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index b326c6f4959..6fae048c3db 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -48,7 +48,7 @@ class Donations extends DolibarrApi { global $db, $conf; $this->db = $db; - $this->don = new Don($this->db); + $this->don = new Don($this->db); } /** diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 4daa8b6498f..d37271f6480 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -933,7 +933,7 @@ if ($resql) if (! empty($arrayfields['e.ref']['checked'])) { // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); - + } if (! empty($arrayfields['m.fk_user_author']['checked'])) { print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder); } diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 5d8f0fe11ce..43abb1f9e75 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -763,7 +763,7 @@ if (! empty($id) || ! empty($ref))
'; + print ''; @@ -802,7 +802,7 @@ if (! empty($id) || ! empty($ref)) '; + print ''."\n"; - } else { //bouton gris + } else { + //bouton gris print ''."\n"; } } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 9dd34f18569..ba8339f98ed 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -205,7 +205,7 @@ class Warehouses extends DolibarrApi } if($this->warehouse->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4c964f591d0..ba80c61e4ca 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2010,16 +2010,16 @@ class Societe extends CommonObject $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'; - if(empty($option) && $this->fournisseur > 0) $option = 'supplier'; + if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ + if (empty($option) && $this->client > 0) $option = 'customer'; + if (empty($option) && $this->fournisseur > 0) $option = 'supplier'; } if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { $code = ''; - if (($this->client) && (! empty ($this->code_client)) + if (($this->client) && (! empty($this->code_client)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 ) @@ -2028,7 +2028,7 @@ class Societe extends CommonObject $code = $this->code_client . ' - '; } - if (($this->fournisseur) && (! empty ($this->code_fournisseur)) + if (($this->fournisseur) && (! empty($this->code_fournisseur)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 ) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 50d64521621..7a3c089acf3 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -80,7 +80,7 @@ if ($facid > 0) if (! empty($conf->stripe->enabled)) { - access_forbidden(); + access_forbidden(); } if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) @@ -230,9 +230,9 @@ if (empty($reshook)) $action = 'create'; if (!$source) { setEventMessages($langs->transnoentities('NoSource'), null, 'errors'); - } - $error++; - } + } + $error++; + } // Le reste propre a cette action s'affiche en bas de page. } @@ -995,7 +995,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Print total print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (!empty($conf->multicurrency->enabled)) { print ''; print ''; print ''; @@ -1007,7 +1007,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (!empty($conf->multicurrency->enabled)) { print ''; } print "\n"; @@ -1018,7 +1018,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $db->free($resql); } else - { + { dol_print_error($db); } @@ -1051,9 +1051,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($totalpayment)) { $text = $langs->trans('ConfirmCustomerPayment', $totalpayment, $langs->trans("Currency".$conf->currency)); } - if (!empty($multicurrency_totalpayment)) { - $text.='
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency")); - } + if (!empty($multicurrency_totalpayment)) { + $text.='
'.$langs->trans('ConfirmCustomerPayment', $multicurrency_totalpayment, $langs->trans("paymentInInvoiceCurrency")); + } if (GETPOST('closepaidinvoices')) { $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); diff --git a/htdocs/takepos/ajax.php b/htdocs/takepos/ajax.php index 5871d27a618..4b16cc9ec81 100644 --- a/htdocs/takepos/ajax.php +++ b/htdocs/takepos/ajax.php @@ -42,21 +42,21 @@ $term = GETPOST('term', 'alpha'); * View */ -if ($action=="getProducts"){ - $object = new Categorie($db); - $result=$object->fetch($category); - $prods = $object->getObjectsInCateg("product"); - echo json_encode($prods); +if ($action=="getProducts") { + $object = new Categorie($db); + $result=$object->fetch($category); + $prods = $object->getObjectsInCateg("product"); + echo json_encode($prods); } -if ($action=="search"){ - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; - $sql.= ' WHERE entity IN ('.getEntity('product').')'; - $sql .= natural_search(array('label','barcode'), $term); - $resql = $db->query($sql); - $rows = array(); - while($row = $db->fetch_array ($resql)){ - $rows[] = $row; - } - echo json_encode($rows); +if ($action=="search") { + $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'product'; + $sql .= ' WHERE entity IN ('.getEntity('product').')'; + $sql .= natural_search(array('label','barcode'), $term); + $resql = $db->query($sql); + $rows = array(); + while ($row = $db->fetch_array($resql)) { + $rows[] = $row; + } + echo json_encode($rows); } diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 7ca0a40ca74..ceb8c73f211 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -45,7 +45,7 @@ if ($action=="getTables"){ $sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; $resql = $db->query($sql); $rows = array(); - while($row = $db->fetch_array ($resql)){ + while($row = $db->fetch_array($resql)){ $rows[] = $row; } echo json_encode($rows); @@ -62,15 +62,15 @@ if ($action=="update") if ($action=="updatename") { - $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars - if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars + $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars + if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); } if ($action=="add") { $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); - $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names } // Title @@ -175,4 +175,4 @@ $( document ).ready(function() { - \ No newline at end of file + diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 2f2df5b8085..33524b80a8c 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -39,7 +39,7 @@ $place = GETPOST('place', 'int'); $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); -$row = $db->fetch_array ($resql); +$row = $db->fetch_array($resql); $placeid=$row[0]; if (! $placeid) $placeid=0; // Invoice not exist else{ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 456ddcefdb5..d43c3195b92 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -34,7 +34,7 @@ $place=GETPOST('place', 'int'); if ($place>0){ $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'"; $resql = $db->query($sql); - $row = $db->fetch_array ($resql); + $row = $db->fetch_array($resql); $facid=$row[0]; } $object=new Facture($db); From 2f300ae63ffa4e7adb3547da9f205db7a676a4b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Feb 2019 20:26:54 +0100 Subject: [PATCH 119/190] Standardize code with customer invoices --- .../fourn/class/fournisseur.facture.class.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a006b5391b1..5cc47d5201a 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1646,29 +1646,33 @@ class FactureFournisseur extends CommonInvoice $this->line->fk_facture_fourn=$this->id; //$this->line->label=$label; // deprecated $this->line->desc=$desc; - $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative $this->line->ref_supplier=$ref_supplier; + $this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative + $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise + $this->line->vat_src_code=$vat_src_code; $this->line->tva_tx=$txtva; $this->line->localtax1_tx=($total_localtax1?$localtaxes_type[1]:0); $this->line->localtax2_tx=($total_localtax2?$localtaxes_type[3]:0); $this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax2_type = $localtaxes_type[2]; - $this->line->fk_product=$fk_product; - $this->line->product_type=$type; - $this->line->remise_percent=$remise_percent; - $this->line->subprice= ($this->type==self::TYPE_CREDIT_NOTE?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise - $this->line->date_start=$date_start; - $this->line->date_end=$date_end; - $this->line->ventil=$ventil; - $this->line->rang=$rang; - $this->line->info_bits=$info_bits; + $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); + + $this->line->fk_product=$fk_product; + $this->line->product_type=$type; + $this->line->remise_percent=$remise_percent; + $this->line->date_start=$date_start; + $this->line->date_end=$date_end; + $this->line->ventil=$ventil; + $this->line->rang=$rang; + $this->line->info_bits=$info_bits; + $this->line->special_code=$this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; From 3f078203b94e86aec886f4864f55bd8e4449e5c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Feb 2019 20:29:01 +0100 Subject: [PATCH 120/190] Fix phpcs --- htdocs/compta/facture/class/facture.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fd050297fe5..dda877d0a1f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1324,7 +1324,7 @@ class Facture extends CommonInvoice $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', f.fk_incoterms, f.location_incoterms'; - $sql.= ', f.module_source, f.pos_source'; + $sql.= ', f.module_source, f.pos_source'; $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; @@ -1400,9 +1400,9 @@ class Facture extends CommonInvoice $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; $this->libelle_incoterms = $obj->libelle_incoterms; - + $this->module_source = $obj->module_source; - $this->pos_source = $obj->pos_source; + $this->pos_source = $obj->pos_source; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; From 58caf2774483d8ba1c0a8702939ac14055bc74b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Feb 2019 20:30:06 +0100 Subject: [PATCH 121/190] Fix phpcs --- htdocs/stripe/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 50d64521621..48adfa2b2b3 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -80,7 +80,7 @@ if ($facid > 0) if (! empty($conf->stripe->enabled)) { - access_forbidden(); + access_forbidden(); } if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) From 47f5ff3303393a0a025a791ddf7d695de764463b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Feb 2019 16:11:52 +0100 Subject: [PATCH 122/190] Fix declare functions2.lib.php for donations API --- htdocs/core/lib/functions2.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index aae70adfb62..faa149305a2 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2260,6 +2260,9 @@ function getModuleDirForApiClass($module) elseif ($module == 'adherent' || $module == 'members' || $module == 'memberstypes' || $module == 'subscriptions') { $moduledirforclass = 'adherents'; } + elseif ($module == 'don' || $module == 'donations') { + $moduledirforclass = 'don'; + } elseif ($module == 'banque' || $module == 'bankaccounts') { $moduledirforclass = 'compta/bank'; } From c781eeb17d46cfb74b723c81fda1d99e50edf618 Mon Sep 17 00:00:00 2001 From: Cristian Torres Date: Wed, 20 Feb 2019 11:45:07 -0600 Subject: [PATCH 123/190] [FIX] ORDER BY before custom filters for where When filtering data "and cac.libelle" would be appended after ORDER BY --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 2324bfad616..86157eb98f6 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -418,6 +418,6 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); - $this->export_sql_end[$r] .=' ORDER BY ac.datep'; + $this->export_sql_order[$r] .=' ORDER BY ac.datep'; } } From 57ee8b7991be9fec477cf497ec9d8b5ccfceecd7 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 24 Feb 2019 21:15:11 +0100 Subject: [PATCH 124/190] Fix no JPG images in TakePOS and other image improvements. --- htdocs/takepos/css/pos.css | 12 +++++ htdocs/takepos/genimg/add.jpg | Bin 5419 -> 0 bytes htdocs/takepos/genimg/empty.jpg | Bin 2239 -> 0 bytes htdocs/takepos/genimg/empty.png | Bin 0 -> 156 bytes htdocs/takepos/genimg/index.php | 87 +++++++++----------------------- htdocs/takepos/takepos.php | 34 ++++++++----- 6 files changed, 57 insertions(+), 76 deletions(-) delete mode 100644 htdocs/takepos/genimg/add.jpg delete mode 100644 htdocs/takepos/genimg/empty.jpg create mode 100644 htdocs/takepos/genimg/empty.png diff --git a/htdocs/takepos/css/pos.css b/htdocs/takepos/css/pos.css index 87c74c8952d..cac9a23a8d9 100644 --- a/htdocs/takepos/css/pos.css +++ b/htdocs/takepos/css/pos.css @@ -110,6 +110,18 @@ div.description{ text-align:center; } +div.catwatermark{ + position:absolute; + top:3%; + left:3%; + width:20%; + background-color:black; + color:white; + text-align:center; + font-size: 20px; + display: none; +} + @media only screen and (max-aspect-ratio: 6/4) { div.description{ min-height:20%; diff --git a/htdocs/takepos/genimg/add.jpg b/htdocs/takepos/genimg/add.jpg deleted file mode 100644 index 976fd10697d47e06cc9d74f7efed36ab17d95ed7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5419 zcmeHL4OA0X7QRCW2>}g3z`xd@Kt-T>s!)GR01XNrgn$bE)KnDtJ1(^qLB$N>A7U*< zMYri9KPrf#DL*bA*117Cuv;;C3&)y~- zL^jWL(}#!$=JbnJ2Udw}f7VU?0Na`eP@0MEz;rOfFw^~GV=x(}W?^p5V6rS&ER(P; ztt{DW4x7c|4B&9Atm($G9LODDJ_g=$=LwOYrCD+u1`ioJ%;mk&u4CLhy*`{cY4VimGlc## zX9Wa?&7C(tJYvDZWy_;hM90L&eZD$zO;YmOb(=PC*}5%#d&aKad$RZL`|H=zf&&K+ z6&4*XK2la*apLcl-~Hp{`Ksy*7cYH(x#q^ry82rUw;P*U+wR?O|KUN$!%lV26U|d? zuTI}*!i53jIjk4Reuaxi<1(Yyz?@~mg_$MM!r+-RM}A;o>nma{T{URb_>F8kzpVVy zbCymMLRI#WpUF86&YrCl%>|>|Rss`|}-< zK7~>UT6PmXJH|B@QJ2HFAkfI;efT~ip&k4r;c6BFW+Z|=h13m&c3z4ILDBjnl)_!N ziC(x;ye15fO)$8faYb> zsR&%lNGYz&P8K5wa;U&GOgoX!3&Cx0)%%5k!Sw;P)k+ly&vI_2*lE{_gk` z%afEs1Qr>Rt3*YSQmoq6_TfM8C4A{1Rb(3N4%C3`KMForEdS+7d>FsATm%1X*2qd+9-LxA5{Q|M9E`)Xe4YnNKnWTKG z3Y$$zDJ+@adTq<9!yk9-2Nk((t47~_*ZHKh`C8M|+Zd@Aij88ke}6nWwXD$HGIdFugAK~%GNwc{9@V{b`wg$ zx^!A@U8gIfhxH0CWcJ4hq@*BK;E2D<3v`D2HPy%(-e|+_dO2As;l$$Q;;wx4`WK#8 zA1`k`?Y+J?U~FM!`59^R=d?HBhWe3 zBhW{Szxp3A-k|x|z)Oj*$76$U6Rq6pm1`8i6}OBVT8<5`mTq?7oqACMAHVi!$l4*U z(UCATa;@Ne4&GlF=W+91F5#c;c)aB?(KK5dPgZ!3OPO4IYLLpidxna;Gck9-!zYT4 zzJvS17Bwn@5(d>=K3w3r#VPcH$k(~mrv(?*_ZPmY-V~kr>WR37J{vq5fsxlqKgthK zPV>oPqQjTWMWC8_6hY55!Z9X~+t97sxky_`7uqZ>PVa^hG6Ywq2->_7n!cen^BYae zYrc*^;PI%(A_GXt8*klMO6E(vI_XN_lH#2d|Av(sLr}t{W=BH(UOsbk!n-9C2k#rd zI55k-{N%+E{+yw=Q!OI)2lIbh!Tz>5e|y+@d)WCy4v)o(@&@C(4Tb>8RUA%nRS*1B z!DkJp2c7lif2(TF{fNpu5|HS1I;UcddRmDz!)aEim&ZIi+c|avS?xRRus*UsR+-rk zSxJ24K75&?KgwGDDp@t$AMghmPt-3n_!*y(N9LJHx}C@GJk-)Bl2gwMV0QD=h`)>* ZyZpQCQQ^@qmB0JF|GfWsej+2(_-~uMLm2=7 diff --git a/htdocs/takepos/genimg/empty.jpg b/htdocs/takepos/genimg/empty.jpg deleted file mode 100644 index 8883f7c9957bf151875278b6ded394d9594c8b25..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2239 zcmex=}T+5Ri6|E+FFJVCMj-APxLK zz#z!MsL5!;%&5e`B*@4t$oT&VgFMistiX@}1qKu_GBLBTvH_jM#SK)jRRHLGW@aX! zV_8{%-es%>$}_MCvI;30I#U-U>$dGXcJ4ZK_{h;?$4{I*b?NeztJkjIxOwa0 zqsLF4K70P+<*SdMK7aZ8?fZ|Pzd-(CWMGDP3+^*Ce+dHp#RQB47Iu)o7@5j}m|2j8 zRnd@5$T5&Tu~1masF6d&Y2w0-2RW6EgFc8R6KQ!#m{`Vr(cu+NC|SQA-3gL@3& ruUiZ}z=X*p$SlZU&+zxpqAm@FQ9K$3qiJ9?4UDFNVV?$=|K9`vEy2T8 diff --git a/htdocs/takepos/genimg/empty.png b/htdocs/takepos/genimg/empty.png new file mode 100644 index 0000000000000000000000000000000000000000..63163e9f86953a5a1b1ef0a16f5e8189e63b8f1e GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H1|$#LC7uRSjKx9jP7LeL$-D$|!aQ9ZLn>~) qJ!r@Xfetch($id); + $upload_dir = $conf->categorie->multidir_output[$object->entity]; $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/"; $dir = $upload_dir.'/'.$pdir; + foreach ($object->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - - // The file - $filename = $dir.$filename; - if (!file_exists($filename)) $filename="empty.jpg"; - - // Dimensions - list($width, $height) = getimagesize($filename); - $new_width = $w; - $new_height = $h; - - // Resample - $image_p = imagecreatetruecolor($new_width, $new_height); - $image = imagecreatefromjpeg($filename); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - - // Add icon - $icon = imagecreatefromjpeg('add.jpg'); - list($width, $height) = getimagesize('add.jpg'); - $new_width = $w*0.3; - $new_height = $h*0.3; - $icon_p = imagecreatetruecolor($new_width, $new_height); - imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); - - // Output - imagejpeg($image_p, null, 100); + { + if ($obj['photo_vignette']) + { + $filename=$obj['photo_vignette']; + } + else + { + $filename=$obj['photo']; + } + $viewfilename=$obj['photo']; + $file=DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); + header('Location: '.$file); + exit; + } + header('Location: ../../public/theme/common/nophoto.png'); } elseif ($query=="pro") { @@ -89,39 +76,13 @@ elseif ($query=="pro") $objProd = new Product($db); $objProd->fetch($id); - - $dir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; - $pdir .= get_exdir(0, 0, 0, 0, $objProd, 'product').$objProd->ref.'/'; - - foreach ($objProd->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - $filename = $dir.$filename; - - if (!file_exists($filename)){ - $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; - foreach ($objProd->liste_photos($dir) as $key => $obj) - { - $filename=$obj['photo']; - } - $filename = $dir.$filename; - } - - if (!file_exists($filename)) $filename="empty.jpg"; - - // Dimensions - list($width, $height) = getimagesize($filename); - $new_width = $w; - $new_height = $h; - - // Resample - $image_p = imagecreatetruecolor($new_width, $new_height); - $image = imagecreatefromjpeg($filename); - imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); - - // Output - imagejpeg($image_p, null, 100); + $image=$objProd->show_photos('product', $conf->product->multidir_output[$entity], 'small', 1); + + preg_match( '@src="([^"]+)"@' , $image, $match ); + $file = array_pop($match); + if ($file=="") header('Location: ../../public/theme/common/nophoto.png'); + else header('Location: '.$file); + } else { diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php index 4edab6c9bee..4b36bbbdd81 100644 --- a/htdocs/takepos/takepos.php +++ b/htdocs/takepos/takepos.php @@ -93,8 +93,9 @@ function PrintCategories(first){ for (i = 0; i < 14; i++) { if (typeof (categories[parseInt(i)+parseInt(first)]) == "undefined") break; $("#catdesc"+i).text(categories[parseInt(i)+parseInt(first)]['label']); - $("#catimg"+i).attr("src","genimg/?query=cat&w=55&h=50&id="+categories[parseInt(i)+parseInt(first)]['rowid']); + $("#catimg"+i).attr("src","genimg/?query=cat&id="+categories[parseInt(i)+parseInt(first)]['rowid']); $("#catdiv"+i).data("rowid",categories[parseInt(i)+parseInt(first)]['rowid']); + $("#catwatermark"+i).show(); } } @@ -117,12 +118,14 @@ function MoreCategories(moreorless){ for (i = 0; i < 14; i++) { if (typeof (categories[i+(14*pagecategories)]) == "undefined"){ $("#catdesc"+i).text(""); - $("#catimg"+i).attr("src",""); + $("#catimg"+i).attr("src","genimg/empty.png"); + $("#catwatermark"+i).hide(); continue; } $("#catdesc"+i).text(categories[i+(14*pagecategories)]['label']); - $("#catimg"+i).attr("src","genimg/?query=cat&w=55&h=50&id="+categories[i+(14*pagecategories)]['rowid']); + $("#catimg"+i).attr("src","genimg/?query=cat&id="+categories[i+(14*pagecategories)]['rowid']); $("#catdiv"+i).data("rowid",categories[i+(14*pagecategories)]['rowid']); + $("#catwatermark"+i).show(); } } @@ -131,16 +134,17 @@ function LoadProducts(position, issubcat=false){ $('#catimg'+position).animate({opacity: '1'}, 100); if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid'); else currentcat=$('#catdiv'+position).data('rowid'); - if (currentcat=="") return; + if (currentcat==undefined) return; pageproducts=0; ishow=0; //product to show counter jQuery.each(subcategories, function(i, val) { if (currentcat==val.fk_parent){ $("#prodesc"+ishow).text(val.label); - $("#proimg"+ishow).attr("src","genimg/?query=cat&w=55&h=50&id="+val.rowid); + $("#proimg"+ishow).attr("src","genimg/?query=cat&id="+val.rowid); $("#prodiv"+ishow).data("rowid",val.rowid); $("#prodiv"+ishow).data("iscat",1); + $("#prowatermark"+ishow).show(); ishow++; } }); @@ -150,18 +154,19 @@ function LoadProducts(position, issubcat=false){ while (idata < 30 && ishow < 30) { if (typeof (data[idata]) == "undefined") { $("#prodesc"+ishow).text(""); - $("#proimg"+ishow).attr("src",""); + $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); - $("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']); + $("#proimg"+ishow).attr("src","genimg/?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); ishow++; //Next product to show after print data product } + $("#prowatermark"+ishow).hide(); idata++; //Next data everytime } }); @@ -189,18 +194,19 @@ function MoreProducts(moreorless){ while (idata < (30*pageproducts)+30) { if (typeof (data[idata]) == "undefined") { $("#prodesc"+ishow).text(""); - $("#proimg"+ishow).attr("src",""); + $("#proimg"+ishow).attr("src","genimg/empty.png"); $("#prodiv"+ishow).data("rowid",""); ishow++; //Next product to show after print data product } else if ((data[idata]['status']) == "1") { //Only show products with status=1 (for sell) $("#prodesc"+ishow).text(data[parseInt(idata)]['label']); - $("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']); + $("#proimg"+ishow).attr("src","genimg/?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); $("#prodiv"+ishow).data("iscat",0); ishow++; //Next product to show after print data product } + $("#prowatermark"+ishow).hide(); idata++; //Next data everytime } }); @@ -261,12 +267,12 @@ function Search2(){ for (i = 0; i < 30; i++) { if (typeof (data[i]) == "undefined"){ $("#prodesc"+i).text(""); - $("#proimg"+i).attr("src",""); + $("#proimg"+i).attr("src","genimg/empty.png"); $("#prodiv"+i).data("rowid",""); continue; } $("#prodesc"+i).text(data[parseInt(i)]['label']); - $("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i]['rowid']); + $("#proimg"+i).attr("src","genimg/?query=pro&id="+data[i]['rowid']); $("#prodiv"+i).data("rowid",data[i]['rowid']); $("#prodiv"+i).data("iscat",0); } @@ -491,10 +497,11 @@ foreach($menus as $menu) { { ?>
id='catdiv'> - width="98%" id='catimg'/> + width="100%" height="85%" id='catimg'/>
+
+
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > - width="95%" id='proimg'/> + width="100%" height="85%" id='proimg'/>
+
+
Date: Sun, 24 Feb 2019 23:40:32 +0100 Subject: [PATCH 125/190] phpcs fix --- htdocs/datapolicy/class/datapolicy.class.php | 92 ++++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index b3cb0ce3cd9..b9ff3e8b6bd 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -219,68 +219,68 @@ Class DataPolicy */ function sendMailDataPolicyCompany($societe) { - global $langs, $conf, $db, $user; + global $langs, $conf, $db, $user; - $error = 0; + $error = 0; - $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; - $sendto = $societe->email; + $sendto = $societe->email; - $code= md5($societe->email); - if (!empty($societe->default_lang)) { - $l = $societe->default_lang; - } else { - $l = $langs->defaultlang; - } - $s = "DATAPOLICIESSUBJECT_" . $l; - $ma = "DATAPOLICIESCONTENT_" . $l; - $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; - $subject = $conf->global->$s; - $message = $conf->global->$ma; - $linka = $conf->global->$la; - $linkr = $conf->global->$lr; - $sendtocc = $sendtobcc = ''; - $filepath = $mimetype = $filename = array(); - $deliveryreceipt = 0; + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + $sendtocc = $sendtobcc = ''; + $filepath = $mimetype = $filename = array(); + $deliveryreceipt = 0; - $substitutionarray = array( + $substitutionarray = array( '__LINKACCEPT__' => ''.$linka.'', '__LINKREFUSED__' => ''.$linkr.'', - ); - $subject = make_substitutions($subject, $substitutionarray); - $message = make_substitutions($message, $substitutionarray); + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); - $actiontypecode = 'AC_EMAIL'; - $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; - if ($message) { - if ($sendtocc) { - $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); } $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg .= dol_concatdesc($actionmsg, $message); } - // Send mail - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); - if ($mailfile->error) { - $resultmasssend .= '
' . $mailfile->error . '
'; - } else { - $result4 = $mailfile->sendfile(); + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
' . $mailfile->error . '
'; + } else { + $result4 = $mailfile->sendfile(); - if (!$error) { - $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; - $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); - $societe->update($societe->id); - } else { - dol_print_error($db); - } - } - setEventMessage($resultmasssend); + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
"; + $societe->array_options['options_datapolicy_send'] = date('Y-m-d', time()); + $societe->update($societe->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); } /** From acb9cfe07ac2d13f1a1d7918bd5233adab4f0b38 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 25 Feb 2019 09:07:58 +0100 Subject: [PATCH 126/190] NEW: Add LinkedIn field --- htdocs/adherents/card.php | 23 +++++++++-- htdocs/adherents/class/adherent.class.php | 17 ++++++-- htdocs/admin/socialnetworks.php | 3 +- htdocs/contact/card.php | 24 +++++++++--- htdocs/contact/class/contact.class.php | 9 ++++- htdocs/contact/list.php | 29 +++++++++++--- htdocs/core/class/commonobject.class.php | 2 + htdocs/core/lib/functions.lib.php | 2 +- .../install/mysql/migration/9.0.0-10.0.0.sql | 7 +++- htdocs/install/mysql/tables/llx_adherent.sql | 1 + htdocs/install/mysql/tables/llx_societe.sql | 1 + htdocs/install/mysql/tables/llx_socpeople.sql | 1 + htdocs/install/mysql/tables/llx_user.sql | 1 + htdocs/societe/card.php | 33 ++++++++++++---- htdocs/societe/class/societe.class.php | 13 ++++++- htdocs/user/card.php | 39 ++++++++++++++++++- htdocs/user/class/user.class.php | 14 ++++++- 17 files changed, 185 insertions(+), 34 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b9a2d15c5cd..9903255e52f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -305,6 +305,7 @@ if (empty($reshook)) $object->skype = trim(GETPOST("skype", 'alpha')); $object->twitter = trim(GETPOST("twitter", 'alpha')); $object->facebook = trim(GETPOST("facebook", 'alpha')); + $object->linkedin = trim(GETPOST("linkedin", 'alpha')); $object->birth = $birthdate; $object->typeid = GETPOST("typeid", 'int'); @@ -450,6 +451,7 @@ if (empty($reshook)) $skype=GETPOST("member_skype", 'alpha'); $twitter=GETPOST("member_twitter", 'alpha'); $facebook=GETPOST("member_facebook", 'alpha'); + $linkedin=GETPOST("member_linkedin", 'alpha'); $email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $login=GETPOST("member_login", 'alpha'); $pass=GETPOST("password", 'alpha'); @@ -479,6 +481,7 @@ if (empty($reshook)) $object->skype = $skype; $object->twitter = $twitter; $object->facebook = $facebook; + $object->linkedin = $linkedin; $object->email = $email; $object->login = $login; @@ -1029,6 +1032,12 @@ else print '
'; } + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + } + // Birthday print "'; - } + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + } + + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + } // Birthday print "'; print ''; } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Visibility @@ -979,11 +987,17 @@ else print ''; } // Facebook - if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - { - print ''; - print ''; - } + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Visibility diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 67b3900ec06..58204ae0c94 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -359,6 +359,7 @@ class Contact extends CommonObject $sql .= ", skype='".$this->db->escape($this->skype)."'"; $sql .= ", twitter='".$this->db->escape($this->twitter)."'"; $sql .= ", facebook='".$this->db->escape($this->facebook)."'"; + $sql .= ", linkedin='".$this->db->escape($this->linkedin)."'"; $sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); @@ -455,6 +456,11 @@ class Contact extends CommonObject $tmpobj->facebook = $this->facebook; $usermustbemodified++; } + if ($tmpobj->linkedin != $this->linkedin) + { + $tmpobj->linkedin = $this->linkedin; + $usermustbemodified++; + } if ($usermustbemodified) { $result=$tmpobj->update($user, 0, 1, 1, 1); @@ -705,7 +711,7 @@ class Contact extends CommonObject $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; - $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook,"; + $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook, c.linkedin,"; $sql.= " c.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $sql.= " c.import_key,"; @@ -779,6 +785,7 @@ class Contact extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 244dffcc0e1..6677e882860 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -70,6 +70,7 @@ $search_email=GETPOST("search_email", 'alpha'); $search_skype=GETPOST("search_skype", 'alpha'); $search_twitter=GETPOST("search_twitter", 'alpha'); $search_facebook=GETPOST("search_facebook", 'alpha'); +$search_linkedin=GETPOST("search_linkedin", 'alpha'); $search_priv=GETPOST("search_priv", 'alpha'); $search_categ=GETPOST("search_categ", 'int'); $search_categ_thirdparty=GETPOST("search_categ_thirdparty", 'int'); @@ -162,6 +163,7 @@ $arrayfields=array( 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.facebook'=>array('label'=>"Facebook", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), + 'p.linkedin'=>array('label'=>"LinkedIn", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200), 'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), @@ -224,6 +226,7 @@ if (empty($reshook)) $search_skype=""; $search_twitter=""; $search_facebook=""; + $search_linkedin=""; $search_priv=""; $search_status=-1; $search_categ=''; @@ -320,6 +323,7 @@ if (strlen($search_fax)) $sql.= natural_search('p.fax', $search_fax); if (strlen($search_skype)) $sql.= natural_search('p.skype', $search_skype); if (strlen($search_twitter)) $sql.= natural_search('p.twitter', $search_twitter); if (strlen($search_facebook)) $sql.= natural_search('p.facebook', $search_facebook); +if (strlen($search_linkedin)) $sql.= natural_search('p.linkedin', $search_linkedin); if (strlen($search_email)) $sql.= natural_search('p.email', $search_email); if (strlen($search_zip)) $sql.= natural_search("p.zip", $search_zip); if (strlen($search_town)) $sql.= natural_search("p.town", $search_town); @@ -624,6 +628,12 @@ if (! empty($arrayfields['p.facebook']['checked'])) print ''; print ''; } +if (! empty($arrayfields['p.linkedin']['checked'])) +{ + print ''; +} if (! empty($arrayfields['p.thirdparty']['checked'])) { print ''; } - if (! $i) $totalarray['nbfield']++; - } - // Company + if (! empty($arrayfields['p.facebook']['checked'])) + { + if (! empty($conf->socialnetworks->enabled)) { print ''; } + if (! $i) $totalarray['nbfield']++; + } + // LinkedIn + if (! empty($arrayfields['p.linkedin']['checked'])) + { + if (! empty($conf->socialnetworks->enabled)) { print ''; } + if (! $i) $totalarray['nbfield']++; + } + // Company if (! empty($arrayfields['p.thirdparty']['checked'])) { print ''; } // Facebook - if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - { - print ''; - print ''; - } + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Phone / Fax @@ -1591,6 +1601,7 @@ else $object->skype = GETPOST('skype', 'alpha'); $object->twitter = GETPOST('twitter', 'alpha'); $object->facebook = GETPOST('facebook', 'alpha'); + $object->linkedin = GETPOST('linkedin', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); @@ -1916,6 +1927,12 @@ else print ''; print ''; } + // LinkedIn + if (! empty($conf->global->SOCIALNETWORKS_LINKEDIN)) + { + print ''; + print ''; + } } // Phone / Fax diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4c964f591d0..3fb29a17db4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -203,6 +203,11 @@ class Societe extends CommonObject * @var string */ public $facebook; + /** + * LinkedIn username + * @var string + */ + public $linkedin; /** * Webpage * @var string @@ -848,6 +853,7 @@ class Societe extends CommonObject $this->skype = trim($this->skype); $this->twitter = trim($this->twitter); $this->facebook = trim($this->facebook); + $this->linkedin = trim($this->linkedin); $this->url = $this->url?clean_url($this->url, 0):''; $this->note_private = trim($this->note_private); $this->note_public = trim($this->note_public); @@ -991,6 +997,7 @@ class Societe extends CommonObject $sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null"); $sql .= ",twitter = ".(! empty($this->twitter)?"'".$this->db->escape($this->twitter)."'":"null"); $sql .= ",facebook = ".(! empty($this->facebook)?"'".$this->db->escape($this->facebook)."'":"null"); + $sql .= ",linkedin = ".(! empty($this->linkedin)?"'".$this->db->escape($this->linkedin)."'":"null"); $sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null"); $sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null"); @@ -1132,6 +1139,7 @@ class Societe extends CommonObject $lmember->skype=$this->skype; $lmember->twitter=$this->twitter; $lmember->facebook=$this->facebook; + $lmember->linkedin=$this->linkedin; $lmember->phone=$this->phone; $result=$lmember->update($user, 0, 1, 1, 1); // Use nosync to 1 to avoid cyclic updates @@ -1235,7 +1243,7 @@ class Societe extends CommonObject $sql .= ', s.status'; $sql .= ', s.price_level'; $sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif'; - $sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur'; + $sql .= ', s.phone, s.fax, s.email, s.skype, s.twitter, s.facebook, s.linkedin, s.url, s.zip, s.town, s.note_private, s.note_public, s.model_pdf, s.client, s.fournisseur'; $sql .= ', s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6'; $sql .= ', s.capital, s.tva_intra'; $sql .= ', s.fk_typent as typent_id'; @@ -1332,6 +1340,7 @@ class Societe extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->url = $obj->url; $this->phone = $obj->phone; $this->fax = $obj->fax; @@ -3337,6 +3346,7 @@ class Societe extends CommonObject $this->skype=$member->skype; $this->twitter=$member->twitter; $this->facebook=$member->facebook; + $this->linkedin=$member->linkedin; $this->client = 1; // A member is a customer by default $this->code_client = ($customercode?$customercode:-1); @@ -3480,6 +3490,7 @@ class Societe extends CommonObject $this->skype='tom.hanson'; $this->twitter='tomhanson'; $this->facebook='tomhanson'; + $this->linkedin='tomhanson'; $this->url='http://www.specimen.com'; $this->phone='0909090901'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 859b2220b28..884faf33c3d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -214,6 +214,7 @@ if (empty($reshook)) { $object->skype = GETPOST("skype", 'alphanohtml'); $object->twitter = GETPOST("twitter", 'alphanohtml'); $object->facebook = GETPOST("facebook", 'alphanohtml'); + $object->linkedin = GETPOST("linkedin", 'alphanohtml'); $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha')); $object->job = GETPOST("job", 'alpha'); @@ -364,6 +365,7 @@ if (empty($reshook)) { $object->skype = GETPOST("skype", 'alpha'); $object->twitter = GETPOST("twitter", 'alpha'); $object->facebook = GETPOST("facebook", 'alpha'); + $object->linkedin = GETPOST("linkedin", 'alpha'); $object->email = preg_replace('/\s+/', '', GETPOST("email", 'alpha')); $object->job = GETPOST("job", 'alpha'); $object->signature = GETPOST("signature", 'none'); @@ -606,6 +608,7 @@ if (empty($reshook)) { $ldap_skype = $attribute[$conf->global->LDAP_FIELD_SKYPE]; $ldap_twitter = $attribute[$conf->global->LDAP_FIELD_TWITTER]; $ldap_facebook = $attribute[$conf->global->LDAP_FIELD_FACEBOOK]; + $ldap_linkedin = $attribute[$conf->global->LDAP_FIELD_LINKEDIN]; $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL]; $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID]; } @@ -1067,6 +1070,23 @@ if ($action == 'create' || $action == 'adduserldap') print ''; } + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + print ''; + } + // EMail print 'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; } - // Skype + // Facebook if (! empty($conf->socialnetworks->enabled)) { print ''; @@ -2304,6 +2324,23 @@ else print ''; } + // LinkedIn + if (! empty($conf->socialnetworks->enabled)) + { + print ''; + print ''; + } + // EMail print "".'global->USER_MAIL_REQUIRED)?' class="fieldrequired"':'').'>'.$langs->trans("EMail").''; print ''; } +if (! empty($arrayfields['p.no_email']['checked'])) +{ + print ''; +} if (! empty($arrayfields['p.skype']['checked'])) { print ''; if (! $i) $totalarray['nbfield']++; } - + // No EMail + if (! empty($arrayfields['p.no_email']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Skype if (! empty($arrayfields['p.skype']['checked'])) { From 1e6ed94c5ea09efede8448a288a009f7da1e9c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 25 Feb 2019 21:39:45 +0100 Subject: [PATCH 137/190] Update extrafields.class.php The property $errno was declared of type integer, but $this->db->lasterrno() is of type string --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0ef7f8d295b..c23f40a0283 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -148,7 +148,7 @@ class ExtraFields public $errors = array(); /** - * @var integer DB Error number + * @var string DB Error number */ public $errno; From 1c5955480645be6fb412e5f10e57265cf2ff53fb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 25 Feb 2019 22:22:31 +0100 Subject: [PATCH 138/190] NEW: Add graphic option for ACCOUNTANCY_COMBO_FOR_AUX --- htdocs/accountancy/admin/index.php | 27 ++++++++++++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index b3b8a67241b..965b63ba9b9 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -144,6 +144,18 @@ if ($action == 'setenabledraftexport') { } } +if ($action == 'setenablesubsidiarylist') { + $setenablesubsidiarylist = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } +} + /* * View */ @@ -251,6 +263,19 @@ if (! empty($user->admin)) } print ''; + print ''; + print ''; + if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print ''; + } else { + print ''; + } + print ''; + print ''; print ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 472e2166f6b..ca1f98bf64c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -142,6 +142,7 @@ ACCOUNTING_LENGTH_AACCOUNT=Length of the third-party accounting accounts (If you ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account. Needed by some countries (like Switzerland). If set to off (default), you can set the following two parameters to ask the application to add virtual zeros. BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL=Enable draft export on journal +ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_PURCHASE_JOURNAL=Purchase journal From 35762c0d4e01b0a940c104be378cf4b387532f9d Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 26 Feb 2019 10:22:20 +0100 Subject: [PATCH 139/190] add data elem on task list --- htdocs/core/tpl/extrafields_list_print_fields.tpl.php | 7 ++++--- htdocs/core/tpl/extrafields_list_search_title.tpl.php | 2 +- htdocs/projet/tasks/list.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 6b6d22cf822..739126cd2a8 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -20,9 +20,10 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ { $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); print ''; - $tmpkey='options_'.$key; + if ($align) print ' align="'.$align.'"'; + print ' data-key="'.$key.'"'; + print '>'; + $tmpkey='options_'.$key; if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) { $datenotinstring = $obj->$tmpkey; diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 8020739d5cb..36bdf662b54 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -22,7 +22,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ $sortonfield = "ef.".$key; if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print ''; - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; + else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder)."\n"; } } } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index e1a77f0b824..17d4bf60df7 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -625,7 +625,7 @@ while ($i < min($num,$limit)) $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { - print ''; + print ''; // Ref if (! empty($arrayfields['t.ref']['checked'])) From 528bfca690cc6fbf9986a97b1ee411c25cc93bef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Feb 2019 11:44:16 +0100 Subject: [PATCH 140/190] Fix preselection when key is '0' --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2fb4e4ca228..0f8969cdace 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6178,7 +6178,7 @@ class Form foreach ($array as $key => $value) { $out.= ''; - // Category - print ''; // Notify thirdparty at creation @@ -532,7 +532,7 @@ class FormTicket * @param string $morecss More CSS * @return void */ - public function selectAnalyticCodesTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') + public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') { global $langs, $user; diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index e08def907a1..e6deef76144 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -231,23 +231,9 @@ class modTicket extends DolibarrModules 'titre' => 'List', 'mainmenu' => 'ticket', 'leftmenu' => 'ticketlist', - 'url' => '/ticket/list.php', - 'langs' => 'ticket', - 'position' => 103, - 'enabled' => '$conf->ticket->enabled', - 'perms' => '$user->rights->ticket->read', - 'target' => '', - 'user' => 2); - $r++; - - $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticketlist', - 'type' => 'left', - 'titre' => 'MenuListNonClosed', - 'mainmenu' => 'ticket', - 'leftmenu' => 'ticketlist', 'url' => '/ticket/list.php?search_fk_status=non_closed', 'langs' => 'ticket', - 'position' => 104, + 'position' => 103, 'enabled' => '$conf->ticket->enabled', 'perms' => '$user->rights->ticket->read', 'target' => '', @@ -259,7 +245,7 @@ class modTicket extends DolibarrModules 'titre' => 'MenuTicketMyAssign', 'mainmenu' => 'ticket', 'leftmenu' => 'ticketmy', - 'url' => '/ticket/list.php?mode=my_assign', + 'url' => '/ticket/list.php?mode=mine&search_fk_status=non_closed', 'langs' => 'ticket', 'position' => 105, 'enabled' => '$conf->ticket->enabled', @@ -268,19 +254,6 @@ class modTicket extends DolibarrModules 'user' => 0); $r++; - $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticketmy', - 'type' => 'left', - 'titre' => 'MenuTicketMyAssignNonClosed', - 'mainmenu' => 'ticket', - 'url' => '/ticket/list.php?mode=my_assign&search_fk_status=non_closed', - 'langs' => 'ticket', - 'position' => 106, - 'enabled' => '$conf->ticket->enabled', - 'perms' => '$user->rights->ticket->read', - 'target' => '', - 'user' => 0); - $r++; - $this->menu[$r] = array('fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=ticket', 'type' => 'left', 'titre' => 'Statistics', diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 87766554735..477f611bf39 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -904,13 +904,13 @@ DictionaryRevenueStamp=Amount of tax stamps DictionaryPaymentConditions=Payment Terms DictionaryPaymentModes=Payment Modes DictionaryTypeContact=Contact/Address types -DictionaryTypeOfContainer=Type of website pages/containers +DictionaryTypeOfContainer=Website - Type of website pages/containers DictionaryEcotaxe=Ecotax (WEEE) DictionaryPaperFormat=Paper formats DictionaryFormatCards=Card formats DictionaryFees=Expense report - Types of expense report lines DictionarySendingMethods=Shipping methods -DictionaryStaff=No. of Employees +DictionaryStaff=Number of Employees DictionaryAvailability=Delivery delay DictionaryOrderMethods=Ordering methods DictionarySource=Origin of proposals/orders diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index f93de815d17..972712edeea 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -492,6 +492,8 @@ Drafts=Drafts StatusInterInvoiced=Invoiced Validated=Validated Opened=Open +OpenAll=Open (All) +ClosedAll=Closed (All) New=New Discount=Discount Unknown=Unknown diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 72a3cfe93f2..6366e93e375 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -27,9 +27,9 @@ Permission56003=Delete tickets Permission56004=Manage tickets Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) -TicketDictType=Tickets type -TicketDictCategory=Tickets analytic code -TicketDictSeverity=Tickets severity +TicketDictType=Ticket - Types +TicketDictCategory=Ticket - Groupes +TicketDictSeverity=Ticket - Severities TicketTypeShortBUGSOFT=Dysfonctionnement logiciel TicketTypeShortBUGHARD=Dysfonctionnement matériel TicketTypeShortCOM=Commercial question @@ -123,13 +123,14 @@ TicketsAutoAssignTicket=Automatically assign the user who created the ticket TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket. TicketNumberingModules=Tickets numbering module TicketNotifyTiersAtCreation=Notify third party at creation +TicketGroup=Group # # Index & list page # TicketsIndex=Ticket - home TicketList=List of tickets -TicketAssignedToMeInfos=This page display ticket list which are assigned to current user +TicketAssignedToMeInfos=This page display ticket list created by or assigned to current user NoTicketsFound=No ticket found TicketViewAllTickets=View all tickets TicketViewNonClosedOnly=View only open tickets diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index a2b29b577fb..fa4e5366ac0 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -27,9 +27,9 @@ Permission56003=Supprimer tickets Permission56004=Gérer les tickets Permission56005=Voir les tickets de tous les tiers (sauf pour les utilisateurs externes, toujours limité au tiers dont ils dépendent) -TicketDictType=Type de ticket -TicketDictCategory=Catégories de tickets -TicketDictSeverity=Sévérité des tickets +TicketDictType=Ticket - Types +TicketDictCategory=Ticket - Groupes +TicketDictSeverity=Ticket - Sévérités TicketTypeShortBUGSOFT=Dysfonctionnement logiciel TicketTypeShortBUGHARD=Dysfonctionnement matériel TicketTypeShortCOM=Question commerciale diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 1661807d634..f34c88ad5ce 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -471,7 +471,7 @@ if ($action == "view_ticketlist") if (!empty($arrayfields['category.code']['checked'])) { print ''; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ba80c61e4ca..36c81216f9c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2176,7 +2176,7 @@ class Societe extends CommonObject } $result.=$linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1); + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valignmiddle"'), 0, 0, $notooltip?0:1); if ($withpicto != 2) $result.=($maxlen?dol_trunc($name, $maxlen):$name); $result.=$linkend; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3e18f07057f..81107d8c0d6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -949,6 +949,7 @@ select.selectarrowonleft option { .width100 { width: 100px; } .width200 { width: 200px; } .minwidth100 { min-width: 100px; } + .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } @@ -966,6 +967,7 @@ select.selectarrowonleft option { .width50 { width: 50px; } .width75 { width: 75px; } .width100 { width: 100px; } +.width150 { width: 150px; } .width200 { width: 200px; } .maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c7485d7fd99..85ab07bb09a 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -919,6 +919,7 @@ select.selectarrowonleft option { .width100 { width: 100px; } .width200 { width: 200px; } .minwidth100 { min-width: 100px; } + .minwidth150 { min-width: 150px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } @@ -933,10 +934,10 @@ select.selectarrowonleft option { } .widthauto { width: auto; } .width25 { width: 25px; } -.width75 { width: 75px; } .width50 { width: 50px; } .width75 { width: 75px; } .width100 { width: 100px; } +.width150 { width: 150px; } .width200 { width: 200px; } .maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index e9c73e321be..c71a2211e7f 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -322,12 +322,12 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd { $morehtmlref.='
'.$langs->trans('ThirdParty') . ' '; if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' : '; + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 0) . ' : '; } if ($action == 'editcustomer') { $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); } else { - $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); } } @@ -551,7 +551,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print ''; print ''; } else { @@ -571,8 +571,8 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd }*/ print ''; - // Category - print '"; - print '"; print "\n"; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 401645f6dfd..3bf3ae7b42f 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -82,6 +82,8 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. if (! $sortorder) $sortorder="ASC"; +if (GETPOST('search_fk_status','alpha') == 'non_closed') $_GET['search_fk_statut'][]='openall'; // For backward compatibility + // Initialize array of search criterias $search_all=trim(GETPOST("search_all", 'alpha')); $search=array(); @@ -211,11 +213,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; else $sql.=" WHERE 1 = 1"; + foreach($search as $key => $val) { if ($key == 'fk_statut') { - if ($search_fk_status == 'non_closed') $sql.= " AND ".$key." IN (0, 1, 3, 4, 5, 6)"; + $tmpstatus=''; + if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'0', '1', '3', '4', '5', '6'"; + if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) $tmpstatus.=($tmpstatus?',':'')."'8', '9'"; + if ($tmpstatus) $sql.=" AND fk_statut IN (".$tmpstatus.")"; elseif (is_array($search[$key]) && count($search[$key])) $sql.=natural_search($key, join(',', $search[$key]), 2); continue; } @@ -225,8 +231,10 @@ foreach($search as $key => $val) if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc, 2); if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project, 2); -if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { - $sql.= " AND t.fk_user_assign=".$user->id; +if (! $user->societe_id && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { + $sql.= " AND (t.fk_user_assign = ".$user->id; + if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql.=" OR t.fk_user_create = ".$user->id; + $sql.=")"; } // Add where from extra fields @@ -461,7 +469,7 @@ if ($user->rights->ticket->write) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_ticket', 0, $newcardbutton, '', $limit); -if ($mode == 'my_assign') { +if ($mode == 'mine') { print '
' . $langs->trans('TicketAssignedToMeInfos') . '

'; } // Add code for pre mass action (confirmation or email presend form) @@ -477,17 +485,6 @@ if ($sall) print '
'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'
'; } -print '
'; -if ($search_fk_status == 'non_closed') { - print ''; - $param .= '&search_fk_status=non_closed'; -} else { - print ''; - $param .= '&search_fk_status=-1'; -} -print '
'; - - $moreforfilter = ''; /*$moreforfilter.='
'; $moreforfilter.= $langs->trans('MyFilter') . ': '; @@ -525,19 +522,31 @@ foreach($object->fields as $key => $val) if (! empty($arrayfields['t.'.$key]['checked'])) { if ($key == 'type_code') { print '
'; } elseif ($key == 'category_code') { print ''; } elseif ($key == 'severity_code') { print ''; + } elseif ($key == 'fk_user_assign') { + print ''; } elseif ($key == 'fk_statut') { - print ''; } else { @@ -610,6 +619,7 @@ while ($i < min($num, $limit)) { if (isset($obj->$key)) $object->$key = $obj->$key; } + $langs->load("ticket"); // Show here line of result print ''; @@ -629,7 +639,8 @@ while ($i < min($num, $limit)) print $val['css']; if ($cssforfield || $val['css']) print '"'; print '>'; - print $object->showOutputField($val, $key, $obj->$key, ''); + if ($key == 'fk_statut') print $object->getLibStatut(5); + else print $object->showOutputField($val, $key, $obj->$key, ''); print ''; if (! $i) $totalarray['nbfield']++; if (! empty($val['isameasure'])) From a013b2a81434db28ae78b751a5cf32a21cf435a2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 26 Feb 2019 18:19:44 +0100 Subject: [PATCH 145/190] FIX; donation api checkressource --- htdocs/don/class/api_donations.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 6e38b67d2f1..de854ce806d 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -72,7 +72,7 @@ class Donations extends DolibarrApi throw new RestException(404, 'Donation not found'); } - if( ! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) { + if( ! DolibarrApi::_checkAccessToResource('don', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } From 085aa8a247015180f9dbbc2f3391b69abf910902 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 26 Feb 2019 18:31:00 +0100 Subject: [PATCH 146/190] FIX dolibarize fk_soc / socid --- htdocs/don/class/don.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index f6c2ff1847c..4125e9e97db 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -644,7 +644,7 @@ class Don extends CommonObject global $conf; $sql = "SELECT d.rowid, d.datec, d.date_valid, d.tms as datem, d.datedon,"; - $sql.= " d.fk_soc,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; + $sql.= " d.fk_soc as socid,d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, "; $sql.= " d.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, d.email, d.phone, "; $sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,"; $sql.= " p.ref as project_ref,"; @@ -678,7 +678,7 @@ class Don extends CommonObject $this->date_valid = $this->db->jdate($obj->date_valid); $this->datem = $this->db->jdate($obj->datem); $this->date = $this->db->jdate($obj->datedon); - $this->fk_soc = $obj->fk_soc; + $this->socid = $obj->socid; $this->firstname = $obj->firstname; $this->lastname = $obj->lastname; $this->societe = $obj->societe; From 99fb702833340ccfb5070a5d5acdc9f535746889 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 26 Feb 2019 18:42:05 +0100 Subject: [PATCH 147/190] Add Select Establishment --- htdocs/core/class/html.form.class.php | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 47cc9893c96..21d16f9f9ce 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3681,6 +3681,76 @@ class Form return $num; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Return a HTML select list of establishment + * + * @param string $selected Id establishment pre-selected + * @param string $htmlname Name of select zone + * @param int $statut Status of searched establishment (0=open, 1=closed, 2=both) + * @param string $filtre To filter list + * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @param string $moreattrib To add more attribute on select + * @return int <0 if error, Num of establishment found if OK (0, 1, 2, ...) + */ + function select_establishments($selected = '', $htmlname = 'entity', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '') + { + // phpcs:enable + global $langs, $conf; + + $langs->load("admin"); + $num = 0; + + $sql = "SELECT rowid, name, fk_country, status, entity"; + $sql.= " FROM ".MAIN_DB_PREFIX."establishment"; + $sql.= " WHERE 1=1"; + if ($statut != 2) $sql.= " AND status = '".$statut."'"; + if ($filtre) $sql.=" AND ".$filtre; + $sql.= " ORDER BY name"; + + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; + if ($num) + { + print '"; + } + else + { + if ($statut == 0) print ''.$langs->trans("NoActiveEstablishmentDefined").''; + else print ''.$langs->trans("NoEstablishmentFound").''; + } + } + else { + dol_print_error($this->db); + } + } /** * Display form to select bank account From 70e451a88647bacb822a489ff3f6cb39c0b89db6 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 26 Feb 2019 18:44:07 +0100 Subject: [PATCH 148/190] Update don.class.php --- htdocs/don/class/don.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 4125e9e97db..27e124d6db2 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -395,7 +395,7 @@ class Don extends CommonObject $sql.= ", ".$conf->entity; $sql.= ", ".price2num($this->amount); $sql.= ", ".($this->modepaymentid?$this->modepaymentid:"null"); - $sql.= ", '".$this->db->escape($this->fk_soc)."'"; + $sql.= ", '".$this->db->escape($this->socid)."'"; $sql.= ", '".$this->db->escape($this->firstname)."'"; $sql.= ", '".$this->db->escape($this->lastname)."'"; $sql.= ", '".$this->db->escape($this->societe)."'"; From aa6e18f66fbbc9ab9ef121140d0a1ba74ee44ede Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 26 Feb 2019 18:45:02 +0100 Subject: [PATCH 149/190] FIX dolibarize fk_soc socid --- htdocs/don/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 40d0616ad37..f0702adcadd 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -154,7 +154,7 @@ if ($action == 'add') if (! $error) { - $object->fk_soc = GETPOST("fk_soc", 'int'); + $object->socid = GETPOST("socid", 'int'); $object->firstname = GETPOST("firstname", 'alpha'); $object->lastname = GETPOST("lastname", 'alpha'); $object->societe = GETPOST("societe", 'alpha'); @@ -164,7 +164,7 @@ if ($action == 'add') $object->town = GETPOST("town", 'alpha'); $object->country_id = GETPOST('country_id', 'int'); $object->email = GETPOST('email', 'alpha'); - $object->date = $donation_date; + $object->date = $donation_date; $object->note_private = GETPOST("note_private", 'none'); $object->note_public = GETPOST("note_public", 'none'); $object->public = GETPOST("public", 'alpha'); @@ -531,10 +531,10 @@ if (! empty($id) && $action == 'edit') print ""; print "\n"; -if ( $object->fk_soc && ! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES) ) { +if ( $object->socid && ! empty($conf->societe->enabled) && ! empty($conf->global->DONATION_USE_THIRDPARTIES) ) { $company=new Societe($db); - $result=$company->fetch($object->fk_soc); + $result=$company->fetch($object->socid); print ''; } else { @@ -693,10 +693,10 @@ if (! empty($id) && $action != 'edit') print yn($object->public); print ''; -if ($object->fk_soc) { +if ($object->socid) { $company=new Societe($db); - $result=$company->fetch($object->fk_soc); + $result=$company->fetch($object->socid); print ''; } else { From b79bcb25eac2e68c76e3ab1a2a1cffad4e8a449e Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 26 Feb 2019 18:45:07 +0100 Subject: [PATCH 150/190] Add parent company --- htdocs/hrm/establishment/card.php | 2970 +++++++++++++++++++++++++---- 1 file changed, 2642 insertions(+), 328 deletions(-) diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 28763f8b0f3..69f3f9b880d 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -1,5 +1,18 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2003 Brian Fraval + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005 Eric Seigne + * Copyright (C) 2005-2017 Regis Houssin + * Copyright (C) 2008 Patrick Raguin + * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2011-2013 Alexandre Spangaro + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 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 @@ -16,403 +29,2704 @@ */ /** - * \file htdocs/hrm/establishment/card.php - * \brief Page to show an establishment + * \file htdocs/societe/card.php + * \ingroup societe + * \brief Third party card page */ -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/hrm.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/hrm/class/establishment.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -// Load translation files required by the page -$langs->loadLangs(array('admin', 'hrm')); +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + +$langs->loadLangs(array("companies","commercial","bills","banks","users")); +if (! empty($conf->categorie->enabled)) $langs->load("categories"); +if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); +if (! empty($conf->notification->enabled)) $langs->load("mails"); + +$mesg=''; $error=0; $errors=array(); + +$action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); + +$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); +if ($user->societe_id) $socid=$user->societe_id; +if (empty($socid) && $action == 'view') $action='create'; + +$object = new Societe($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('thirdpartycard','globalcard')); + +if ($socid > 0) $object->fetch($socid); + +if (! ($object->id > 0) && $action == 'view') +{ + $langs->load("errors"); + print($langs->trans('ErrorRecordNotFound')); + exit; +} + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$object->getCanvas($socid); +$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); +$objcanvas=null; +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db, $action); + $objcanvas->getCanvas('thirdparty', 'card', $canvas); +} // Security check -if (! $user->admin) accessforbidden(); - -$error=0; - -$action = GETPOST('action', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); -$id = GETPOST('id', 'int'); - -// List of status -static $tmpstatus2label=array( - '0'=>'CloseEtablishment', - '1'=>'OpenEtablishment' -); -$status2label=array(''); -foreach ($tmpstatus2label as $key => $val) $status2label[$key]=$langs->trans($val); - -$object = new Establishment($db); - -// Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', $objcanvas); /* * Actions */ -if ($action == 'confirm_delete' && $confirm == "yes") -{ - $result=$object->delete($id); - if ($result >= 0) - { - header("Location: ../admin/admin_establishment.php"); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } -} +$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -elseif ($action == 'add') +if (empty($reshook)) { - if (! $cancel) + if ($cancel) { - $error=0; - - $object->name = GETPOST('name', 'alpha'); - if (empty($object->name)) + $action=''; + if (! empty($backtopage)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); + header("Location: ".$backtopage); + exit; + } + } + + if ($action == 'confirm_merge' && $confirm == 'yes' && $user->rights->societe->creer) + { + $error = 0; + $soc_origin_id = GETPOST('soc_origin', 'int'); + $soc_origin = new Societe($db); + + if ($soc_origin_id <= 0) + { + $langs->load('errors'); + $langs->load('companies'); + setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); + } + else + { + if (!$error && $soc_origin->fetch($soc_origin_id) < 1) + { + setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); + $error++; + } + + if (!$error) + { + // TODO Move the merge function into class of object. + + $db->begin(); + + // Recopy some data + $object->client = $object->client | $soc_origin->client; + $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; + $listofproperties=array( + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'url', 'barcode', + 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', + 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', + 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', + 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', + 'model_pdf', 'fk_projet' + ); + foreach ($listofproperties as $property) + { + if (empty($object->$property)) $object->$property = $soc_origin->$property; + } + + // Concat some data + $listofproperties=array( + 'note_public', 'note_private' + ); + foreach ($listofproperties as $property) + { + $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); + } + + // Merge extrafields + if (is_array($soc_origin->array_options)) + { + foreach ($soc_origin->array_options as $key => $val) + { + if (empty($object->array_options[$key])) $object->array_options[$key] = $val; + } + } + + // Merge categories + $static_cat = new Categorie($db); + + $custcats_ori = $static_cat->containing($soc_origin->id, 'customer', 'id'); + $custcats = $static_cat->containing($object->id, 'customer', 'id'); + $custcats = array_merge($custcats, $custcats_ori); + $object->setCategories($custcats, 'customer'); + + $suppcats_ori = $static_cat->containing($soc_origin->id, 'supplier', 'id'); + $suppcats = $static_cat->containing($object->id, 'supplier', 'id'); + $suppcats = array_merge($suppcats, $suppcats_ori); + $object->setCategories($suppcats, 'supplier'); + + // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. + if ($soc_origin->code_client == $object->code_client + || $soc_origin->code_fournisseur == $object->code_fournisseur + || $soc_origin->barcode == $object->barcode) + { + dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); + $soc_origin->code_client = ''; + $soc_origin->code_fournisseur = ''; + $soc_origin->barcode = ''; + $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); + } + + // Update + $object->update($object->id, $user, 0, 1, 1, 'merge'); + if ($result < 0) + { + $error++; + } + + // Move links + if (! $error) + { + $objects = array( + 'Adherent' => '/adherents/class/adherent.class.php', + 'Societe' => '/societe/class/societe.class.php', + //'Categorie' => '/categories/class/categorie.class.php', + 'ActionComm' => '/comm/action/class/actioncomm.class.php', + 'Propal' => '/comm/propal/class/propal.class.php', + 'Commande' => '/commande/class/commande.class.php', + 'Facture' => '/compta/facture/class/facture.class.php', + 'FactureRec' => '/compta/facture/class/facture-rec.class.php', + 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', + 'Contact' => '/contact/class/contact.class.php', + 'Contrat' => '/contrat/class/contrat.class.php', + 'Expedition' => '/expedition/class/expedition.class.php', + 'Fichinter' => '/fichinter/class/fichinter.class.php', + 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', + 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', + 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'Livraison' => '/livraison/class/livraison.class.php', + 'Product' => '/product/class/product.class.php', + 'Project' => '/projet/class/project.class.php', + 'User' => '/user/class/user.class.php', + ); + + //First, all core objects must update their tables + foreach ($objects as $object_name => $object_file) + { + require_once DOL_DOCUMENT_ROOT.$object_file; + + if (!$error && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } + } + } + + // External modules should update their ones too + if (! $error) + { + $reshook = $hookmanager->executeHooks('replaceThirdparty', array( + 'soc_origin' => $soc_origin->id, + 'soc_dest' => $object->id + ), $soc_dest, $action); + + if ($reshook < 0) + { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $error++; + } + } + + + if (! $error) + { + $object->context=array('merge'=>1, 'mergefromid'=>$soc_origin->id); + + // Call trigger + $result=$object->call_trigger('COMPANY_MODIFY', $user); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + // End call triggers + } + + if (!$error) + { + //We finally remove the old thirdparty + if ($soc_origin->delete($soc_origin->id, $user) < 1) + { + $error++; + } + } + + if (!$error) + { + setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); + $db->commit(); + } + else + { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); + $db->rollback(); + } + } + } + } + + if (GETPOST('getcustomercode')) + { + // We defined value code_client + $_POST["customer_code"]="Acompleter"; + } + + if (GETPOST('getsuppliercode')) + { + // We defined value code_fournisseur + $_POST["supplier_code"]="Acompleter"; + } + + if($action=='set_localtax1') + { + //obtidre selected del combobox + $value=GETPOST('lt1'); + $object->fetch($socid); + $res=$object->setValueFrom('localtax1_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); + } + if($action=='set_localtax2') + { + //obtidre selected del combobox + $value=GETPOST('lt2'); + $object->fetch($socid); + $res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); + } + + if ($action == 'update_extras') { + $object->fetch($socid); + + $object->oldcopy = dol_clone($object); + + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute', 'none')); + if ($ret < 0) $error++; + + if (! $error) + { + $result = $object->insertExtraFields('COMPANY_MODIFY'); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) $action = 'edit_extras'; + } + + // Add new or update third party + if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) + && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + + if (! GETPOST('name')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors'); + $error++; + } + if (GETPOST('client') < 0) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProspectCustomer")), null, 'errors'); + $error++; + } + if (GETPOST('fournisseur') < 0) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Supplier")), null, 'errors'); $error++; } - if (empty($error)) + if (! $error) { - $object->address = GETPOST('address', 'alpha'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->country_id = $_POST["country_id"]; - $object->status = GETPOST('status', 'int'); - $object->fk_user_author = $user->id; - $object->datec = dol_now(); + if ($action == 'update') + { + $ret=$object->fetch($socid); + $object->oldcopy = clone $object; + } + else $object->canvas=$canvas; + if (GETPOST("private") == 1) // Ask to create a contact + { + $object->particulier = GETPOST("private"); + $object->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('name', 'alpha')); + $object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int + // Add non official properties + $object->name_bis = GETPOST('name', 'alpha'); + $object->firstname = GETPOST('firstname', 'alpha'); + } + else + { + $object->name = GETPOST('name', 'alpha'); + } + $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); + $object->name_alias = GETPOST('name_alias'); + $object->address = GETPOST('address'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->state_id = GETPOST('state_id', 'int'); + $object->skype = GETPOST('skype', 'alpha'); + $object->twitter = GETPOST('twitter', 'alpha'); + $object->facebook = GETPOST('facebook', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); + $object->fax = GETPOST('fax', 'alpha'); + $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); + $object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); + $object->idprof1 = trim(GETPOST('idprof1', 'alpha')); + $object->idprof2 = trim(GETPOST('idprof2', 'alpha')); + $object->idprof3 = trim(GETPOST('idprof3', 'alpha')); + $object->idprof4 = trim(GETPOST('idprof4', 'alpha')); + $object->idprof5 = trim(GETPOST('idprof5', 'alpha')); + $object->idprof6 = trim(GETPOST('idprof6', 'alpha')); + $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); + $object->code_client = GETPOSTISSET('customer_code')?GETPOST('customer_code', 'alpha'):GETPOST('code_client', 'alpha'); + $object->code_fournisseur = GETPOSTISSET('supplier_code')?GETPOST('supplier_code', 'alpha'):GETPOST('code_fournisseur', 'alpha'); + $object->capital = GETPOST('capital', 'alpha'); + $object->barcode = GETPOST('barcode', 'alpha'); - $id = $object->create($user); + $object->tva_intra = GETPOST('tva_intra', 'alpha'); + $object->tva_assuj = GETPOST('assujtva_value', 'alpha'); + $object->status = GETPOST('status', 'alpha'); - if ($id > 0) - { - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); - exit; - } - else + // Local Taxes + $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha'); + $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'alpha'); + + $object->localtax1_value = GETPOST('lt1', 'alpha'); + $object->localtax2_value = GETPOST('lt2', 'alpha'); + + $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); + $object->effectif_id = GETPOST('effectif_id', 'int'); + $object->typent_id = GETPOST('typent_id', 'int'); + + $object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type + + $object->client = GETPOST('client', 'int'); + $object->fournisseur = GETPOST('fournisseur', 'int'); + + $object->commercial_id = GETPOST('commercial_id', 'int'); + $object->default_lang = GETPOST('default_lang'); + + // Webservices url/key + $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); + $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); + + // Incoterms + if (!empty($conf->incoterm->enabled)) { - setEventMessages($object->error, $object->errors, 'errors'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); } + + // Multicurrency + if (!empty($conf->multicurrency->enabled)) + { + $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); + } + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) + { + $error++; + } + + if (GETPOST('deletephoto')) $object->logo = ''; + elseif (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); + + // Check parameters + if (! GETPOST('cancel', 'alpha')) + { + if (! empty($object->email) && ! isValidEMail($object->email)) + { + $langs->load("errors"); + $error++; + setEventMessages('', $langs->trans("ErrorBadEMail", $object->email), 'errors'); + } + if (! empty($object->url) && ! isValidUrl($object->url)) + { + $langs->load("errors"); + setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors'); + } + if (! empty($object->webservices_url)) { + //Check if has transport, without any the soap client will give error + if (strpos($object->webservices_url, "http") === false) + { + $object->webservices_url = "http://".$object->webservices_url; + } + if (! isValidUrl($object->webservices_url)) { + $langs->load("errors"); + $error++; $errors[] = $langs->trans("ErrorBadUrl", $object->webservices_url); + } + } + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id; + if ($object->country_id) + { + $tmparray=getCountry($object->country_id, 'all'); + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; + } + } + } + + if (! $error) + { + if ($action == 'add') + { + $error = 0; + + $db->begin(); + + if (empty($object->client)) $object->code_client=''; + if (empty($object->fournisseur)) $object->code_fournisseur=''; + + $result = $object->create($user); + + if ($result >= 0) + { + if ($object->particulier) + { + dol_syslog("We ask to create a contact/address too", LOG_DEBUG); + $result=$object->create_individual($user); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + // Links with users + $salesreps = GETPOST('commercial', 'array'); + $result = $object->setSalesRep($salesreps); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + + // Customer categories association + $custcats = GETPOST('custcats', 'array'); + $result = $object->setCategories($custcats, 'customer'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + + // Supplier categories association + $suppcats = GETPOST('suppcats', 'array'); + $result = $object->setCategories($suppcats, 'supplier'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + + // Logo/Photo save + $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos/"; + $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if ($file_OK) + { + if (image_format_supported($_FILES['photo']['name'])) + { + dol_mkdir($dir); + + if (@is_dir($dir)) + { + $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); + + if (! $result > 0) + { + $errors[] = "ErrorFailedToSaveFile"; + } + else + { + // Create thumbs + $object->addThumbs($newfile); + } + } + } + } + else + { + switch($_FILES['photo']['error']) + { + case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini + case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form + $errors[] = "ErrorFileSizeTooLarge"; + break; + case 3: //uploaded file was only partially uploaded + $errors[] = "ErrorFilePartiallyUploaded"; + break; + } + } + // Gestion du logo de la société + } + else + { + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case + { + $duplicate_code_error = true; + $object->code_fournisseur = null; + $object->code_client = null; + } + + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + + if ($result >= 0 && ! $error) + { + $db->commit(); + + if (! empty($backtopage)) + { + if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id; + header("Location: ".$backtopage); + exit; + } + else + { + $url=$_SERVER["PHP_SELF"]."?socid=".$object->id; + if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/card.php?socid=".$object->id; + elseif ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; + + header("Location: ".$url); + exit; + } + } + else + { + $db->rollback(); + $action='create'; + } + } + + if ($action == 'update') + { + $error = 0; + + if (GETPOST('cancel', 'alpha')) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); + exit; + } + } + + // To not set code if third party is not concerned. But if it had values, we keep them. + if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client=''; + if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur=''; + //var_dump($object);exit; + + $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); + if ($result <= 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + + // Links with users + $salesreps = GETPOST('commercial', 'array'); + $result = $object->setSalesRep($salesreps); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + + // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) + if (! $error && !empty($user->rights->categorie->lire)) + { + // Customer categories association + $categories = GETPOST( 'custcats', 'array' ); + $result = $object->setCategories($categories, 'customer'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + + // Supplier categories association + $categories = GETPOST('suppcats', 'array'); + $result = $object->setCategories($categories, 'supplier'); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + // Logo/Photo save + $dir = $conf->societe->multidir_output[$object->entity]."/".$object->id."/logos"; + $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if (GETPOST('deletephoto') && $object->logo) + { + $fileimg=$dir.'/'.$object->logo; + $dirthumbs=$dir.'/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + } + if ($file_OK) + { + if (image_format_supported($_FILES['photo']['name']) > 0) + { + dol_mkdir($dir); + + if (@is_dir($dir)) + { + $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); + + if (! $result > 0) + { + $errors[] = "ErrorFailedToSaveFile"; + } + else + { + // Create thumbs + $object->addThumbs($newfile); + + // Index file in database + if (! empty($conf->global->THIRDPARTY_LOGO_ALLOW_EXTERNAL_DOWNLOAD)) + { + require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; + // the dir dirname($newfile) is directory of logo, so we should have only one file at once into index, so we delete indexes for the dir + deleteFilesIntoDatabaseIndex(dirname($newfile), '', '', 'uploaded', 1); + // now we index the uploaded logo file + addFileIntoDatabaseIndex(dirname($newfile), basename($newfile), '', 'uploaded', 1); + } + } + } + } + else + { + $errors[] = "ErrorBadImageFormat"; + } + } + else + { + switch($_FILES['photo']['error']) + { + case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini + case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form + $errors[] = "ErrorFileSizeTooLarge"; + break; + case 3: //uploaded file was only partially uploaded + $errors[] = "ErrorFilePartiallyUploaded"; + break; + } + } + // Gestion du logo de la société + + + // Update linked member + if (! $error && $object->fk_soc > 0) + { + + $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; + $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; + if (! $object->db->query($sql)) + { + $error++; + $object->error .= $object->db->lasterror(); + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if (! $error && ! count($errors)) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); + exit; + } + } + else + { + $object->id = $socid; + $action= "edit"; + } + } } else { - $action='create'; + $action = ($action=='add'?'create':'edit'); } } - else + + // Delete third party + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { - header("Location: ../admin/admin_establishment.php"); - exit; + $object->fetch($socid); + $result = $object->delete($socid, $user); + + if ($result > 0) + { + header("Location: ".DOL_URL_ROOT."/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode($object->name)); + exit; + } + else + { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + $action=''; + } } + + // Set parent company + if ($action == 'set_thirdparty' && $user->rights->societe->creer) + { + $object->fetch($socid); + $result = $object->set_parent(GETPOST('editparentcompany', 'int')); + } + + // Set incoterm + if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) + { + $object->fetch($socid); + $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); + } + + $id=$socid; + $object->fetch($socid); + + // Actions to send emails + $trigger_name='COMPANY_SENTBYMAIL'; + $paramname='socid'; + $mode='emailfromthirdparty'; + $trackid='thi'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; + + // Actions to build doc + $id = $socid; + $upload_dir = $conf->societe->dir_output; + $permissioncreate=$user->rights->societe->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } -// Update record -elseif ($action == 'update') -{ - $error = 0; - - if (! $cancel) { - - $name = GETPOST('name', 'alpha'); - if (empty($name)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->trans('Name')), null, 'errors'); - $error ++; - } - - if (empty($error)) - { - $object->name = GETPOST('name', 'alpha'); - $object->address = GETPOST('address', 'alpha'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->country_id = GETPOST('country_id', 'int'); - $object->fk_user_mod = $user->id; - $object->status = GETPOST('status', 'int'); - - $result = $object->update($user); - - if ($result > 0) - { - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $_POST['id']); - exit; - } - else - { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - } else { - header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $_POST['id']); - exit; - } -} /* - * View + * View */ -llxHeader(); - $form = new Form($db); +$formfile = new FormFile($db); +$formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); -/* - * Action create - */ -if ($action == 'create') +if ($socid > 0 && empty($object->id)) { - print load_fiche_titre($langs->trans("NewEstablishment")); - - print '
'; - print ''; - print ''; - - dol_fiche_head(); - - print '
'; if ($mesg) { print $mesg; } else { $stringtoshow.= $px1->show(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index e7b99993ef1..068a26b5fe2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -554,7 +554,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third dol_fiche_end(); - print '
'; + print '
'; print ''; print '     '; print ''; @@ -671,38 +671,38 @@ elseif ($id > 0 || ! empty($ref)) print ''; print '
'; + print ''; print ''; print ''; $formother->select_year($search_dtstartyear?$search_dtstartyear:-1, 'search_dtstartyear', 1, 20, 5); print ''; + print ''; print ''; print ''; $formother->select_year($search_dtendyear?$search_dtendyear:-1, 'search_dtendyear', 1, 20, 5); print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''.$langs->trans("Project").'
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'; $formcompany->selectTypeContact($object, '', 'type', 'internal', 'rowid'); print '
'; $formcompany->selectTypeContact($object, '', 'type', 'external', 'rowid'); print '
'.$langs->trans("ThirdParty").''.$langs->trans("TaskContact").''.$langs->trans("ContactType").''.$langs->trans("Status").''.$langs->trans("Status").' 
'.$tab[$i]['libelle'].''; + print ''; // Activation desativation du contact if ($object->statut >= 0) print ''; print $contactstatic->LibStatut($tab[$i]['status'], 3); @@ -501,7 +501,7 @@ if ($id > 0 || ! empty($ref)) print ''; + print ''; if ($user->rights->projet->creer) { print ' '; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index d9832dbf1a9..49bf3d02ad8 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -206,7 +206,7 @@ if ($object->id > 0) // Categories if($conf->categorie->enabled) { - print '
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'; +print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; + print ''; print $projectstatic->getLibStatut(1); print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$projectstatic->getLibStatut(5).''.$projectstatic->getLibStatut(5).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -821,9 +821,9 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').'
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($projectstatic->id, 'project', 1); print "
'; + print ''; print ''; print '   '; print ''; @@ -1079,7 +1079,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print ''; + print ''; print ''; print '   '; print ''; @@ -1162,9 +1162,9 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } if (! empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'], $_SERVER['PHP_SELF'], 't.task_duration', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'], $_SERVER['PHP_SELF'], 't.task_duration', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center '); /* // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1173,7 +1173,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center" width="80"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -1315,7 +1315,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value spent if (! empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; // invoice_id and invoice_line_id + print ''; // invoice_id and invoice_line_id if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) { if ($projectstatic->bill_time) @@ -1513,7 +1513,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Time spent if (! empty($arrayfields['t.task_duration']['checked'])) { - print ''; + print ''; if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -1529,7 +1529,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value spent if (! empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; + print ''; $valuebilled = price2num($task_time->total_ht); if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); print ''; + print ''; if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; @@ -1677,7 +1677,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Value spent if (! empty($arrayfields['value']['checked'])) { - print ''; + print ''; $value = 0; print price($value, 1, $langs, 1, -1, -1, $conf->currency); print ''; + print ''; $valuebilled = price2num($task_time->total_ht); if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''.price($totalarray['totalvalue']).''.price($totalarray['totalvaluebilled']).''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''.price($totalarray['totalvalue']).''.price($totalarray['totalvaluebilled']).'
trans('OnBuy') ?> '; $searchpicto=$form->showCheckAddButtons('checkforselect', 1); print $searchpicto; print ' '; if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; From efd27ec1d8e3efe476e10cd096edfcd2334bc928 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Feb 2019 16:11:52 +0100 Subject: [PATCH 116/190] Fix declare functions2.lib.php for donations API --- htdocs/core/lib/functions2.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 7ffc09625a3..5d8ea58ee04 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2260,6 +2260,9 @@ function getModuleDirForApiClass($module) elseif ($module == 'adherent' || $module == 'members' || $module == 'memberstypes' || $module == 'subscriptions') { $moduledirforclass = 'adherents'; } + elseif ($module == 'don' || $module == 'donations') { + $moduledirforclass = 'don'; + } elseif ($module == 'banque' || $module == 'bankaccounts') { $moduledirforclass = 'compta/bank'; } From c2d05141bf13d65744de2aac616130f948e0a3c2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 24 Feb 2019 16:36:06 +0100 Subject: [PATCH 117/190] FIX donations API --- htdocs/don/class/api_donations.class.php | 110 ++++++++++------------- 1 file changed, 47 insertions(+), 63 deletions(-) diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index b326c6f4959..f2ad47f1b2e 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Laurent Destailleur +/* Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2019 Laurent Destailleur * * 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 @@ -72,13 +72,13 @@ class Donations extends DolibarrApi throw new RestException(404, 'Donation not found'); } - if( ! DolibarrApi::_checkAccessToResource('commande', $this->don->id)) { + if( ! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } // Add external contacts ids - //$this->commande->contacts_ids = $this->don->liste_contact(-1,'external',1); - //$this->commande->fetchObjectLinked(); + //$this->don->contacts_ids = $this->don->liste_contact(-1,'external',1); + //$this->don->fetchObjectLinked(); return $this->_cleanObjectDatas($this->don); } @@ -87,14 +87,14 @@ class Donations extends DolibarrApi /** * List donations * - * Get a list of orders + * Get a list of donations * - * @param string $sortfield Sort field - * @param string $sortorder Sort order + * @param string $sortfield Sort field + * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of order objects * * @throws RestException @@ -108,25 +108,14 @@ class Donations extends DolibarrApi // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; - // If the internal user must only see his customers, force searching by him - $search_sale = 0; - if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; - $sql = "SELECT t.rowid"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) ) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."don as t"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale - $sql.= ' WHERE t.entity IN ('.getEntity('don').')'; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; - if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; - if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale - // Insert sale filter - if ($search_sale > 0) - { - $sql .= " AND sc.fk_user = ".$search_sale; - } + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) ) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($thirdparty_ids) $sql.= " AND t.fk_soc = ".$thirdparty_ids." "; + // Add sql filters if ($sqlfilters) { @@ -151,7 +140,7 @@ class Donations extends DolibarrApi dol_syslog("API Rest request"); $result = $db->query($sql); - + if ($result) { $num = $db->num_rows($result); @@ -160,21 +149,22 @@ class Donations extends DolibarrApi while ($i < $min) { $obj = $db->fetch_object($result); - $commande_static = new Commande($db); - if($commande_static->fetch($obj->rowid)) { + $don_static = new Don($db); + if($don_static->fetch($obj->rowid)) { // Add external contacts ids - $commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1); - $obj_ret[] = $this->_cleanObjectDatas($commande_static); + //$don_static->contacts_ids = $don_static->liste_contact(-1, 'external', 1); + $obj_ret[] = $this->_cleanObjectDatas($don_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror()); + throw new RestException(503, 'Error when retrieve donation list : '.$db->lasterror()); } if( ! count($obj_ret)) { - throw new RestException(404, 'No order found'); + throw new RestException(404, 'No donation found'); } + return $obj_ret; } @@ -186,28 +176,28 @@ class Donations extends DolibarrApi */ function post($request_data = null) { - if(! DolibarrApiAccess::$user->rights->commande->creer) { + if(! DolibarrApiAccess::$user->rights->don->creer) { throw new RestException(401, "Insuffisant rights"); } // Check mandatory fields $result = $this->_validate($request_data); foreach($request_data as $field => $value) { - $this->commande->$field = $value; + $this->don->$field = $value; } /*if (isset($request_data["lines"])) { $lines = array(); foreach ($request_data["lines"] as $line) { array_push($lines, (object) $line); } - $this->commande->lines = $lines; + $this->don->lines = $lines; }*/ - if ($this->commande->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors)); + if ($this->don->create(DolibarrApiAccess::$user) < 0) { + throw new RestException(500, "Error creating order", array_merge(array($this->don->error), $this->don->errors)); } - return $this->commande->id; + return $this->don->id; } /** @@ -220,36 +210,30 @@ class Donations extends DolibarrApi */ function put($id, $request_data = null) { - if (! DolibarrApiAccess::$user->rights->commande->creer) { + if (! DolibarrApiAccess::$user->rights->don->creer) { throw new RestException(401); } - $result = $this->commande->fetch($id); + $result = $this->don->fetch($id); if (! $result) { - throw new RestException(404, 'Order not found'); + throw new RestException(404, 'Donation not found'); } - if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + if (! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { if ($field == 'id') continue; - $this->commande->$field = $value; + $this->don->$field = $value; } - // Update availability - if (!empty($this->commande->availability_id)) { - if ($this->commande->availability($this->commande->availability_id) < 0) - throw new RestException(400, 'Error while updating availability'); - } - - if ($this->commande->update(DolibarrApiAccess::$user) > 0) + if ($this->don->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { - throw new RestException(500, $this->commande->error); + throw new RestException(500, $this->don->error); } } @@ -269,7 +253,7 @@ class Donations extends DolibarrApi throw new RestException(404, 'Donation not found'); } - if( ! DolibarrApi::_checkAccessToResource('don', $this->don->id)) { + if( ! DolibarrApi::_checkAccessToResource('donation', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -309,10 +293,10 @@ class Donations extends DolibarrApi */ function validate($id, $idwarehouse = 0, $notrigger = 0) { - if(! DolibarrApiAccess::$user->rights->commande->creer) { + if(! DolibarrApiAccess::$user->rights->don->creer) { throw new RestException(401); } - $result = $this->commande->fetch($id); + $result = $this->don->fetch($id); if( ! $result ) { throw new RestException(404, 'Donation not found'); } @@ -321,25 +305,25 @@ class Donations extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); + $result = $this->don->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); if ($result == 0) { throw new RestException(304, 'Error nothing done. May be object is already validated'); } if ($result < 0) { - throw new RestException(500, 'Error when validating Order: '.$this->commande->error); + throw new RestException(500, 'Error when validating Order: '.$this->don->error); } - $result = $this->commande->fetch($id); + $result = $this->don->fetch($id); if( ! $result ) { throw new RestException(404, 'Order not found'); } - if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) { + if( ! DolibarrApi::_checkAccessToResource('don', $this->don->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $this->commande->fetchObjectLinked(); + $this->don->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->commande); + return $this->_cleanObjectDatas($this->don); } /** @@ -372,12 +356,12 @@ class Donations extends DolibarrApi */ function _validate($data) { - $commande = array(); + $don = array(); foreach (Orders::$FIELDS as $field) { if (!isset($data[$field])) throw new RestException(400, $field ." field missing"); - $commande[$field] = $data[$field]; + $don[$field] = $data[$field]; } - return $commande; + return $don; } } From 894123fb06bab62986d4941f1d52ff7417e50e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 24 Feb 2019 20:06:55 +0100 Subject: [PATCH 118/190] PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket --- dev/initdemo/sftpget_and_loaddump.php | 2 +- dev/initdemo/updatedemo.php | 2 +- dev/setup/codesniffer/ruleset.xml | 3 +- .../thirdparty_lettering_supplier.php | 7 +- .../accountancy/journal/purchasesjournal.php | 16 ++--- htdocs/cashdesk/facturation_verif.php | 2 +- htdocs/cashdesk/validation_verif.php | 2 +- .../categories/class/api_categories.class.php | 2 +- htdocs/categories/class/categorie.class.php | 3 +- .../mailing/class/advtargetemailing.class.php | 29 ++++---- .../html.formadvtargetemailing.class.php | 71 ++++++++++--------- .../core/class/commondocgenerator.class.php | 22 +++--- htdocs/core/class/html.formmail.class.php | 6 +- htdocs/core/class/smtps.class.php | 6 +- htdocs/core/lib/functions.lib.php | 12 ++-- htdocs/core/lib/functionsnumtoword.lib.php | 14 ++-- htdocs/expedition/card.php | 8 +-- .../class/api_supplier_invoices.class.php | 20 +++--- .../fourn/class/api_supplier_orders.class.php | 23 +++--- htdocs/opensurvey/wizard/choix_date.php | 9 +-- .../stock/class/api_warehouses.class.php | 2 +- htdocs/societe/class/societe.class.php | 10 +-- htdocs/stripe/payment.php | 20 +++--- htdocs/takepos/ajax.php | 30 ++++---- htdocs/takepos/floors.php | 10 +-- htdocs/takepos/pay.php | 2 +- htdocs/takepos/receipt.php | 2 +- 27 files changed, 169 insertions(+), 166 deletions(-) diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index e9641ac6816..e261895b617 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -48,7 +48,7 @@ if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.i if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only -if (! $res) die ("Failed to include master.inc.php file\n"); +if (! $res) die("Failed to include master.inc.php file\n"); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 606bdbe6f56..53ae2251f35 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -43,7 +43,7 @@ if (! $res && file_exists("../../master.inc.php")) $res=@include "../../master.i if (! $res && file_exists("../../../master.inc.php")) $res=@include "../../../master.inc.php"; if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include $path."../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only if (! $res && preg_match('/\/nltechno([^\/]*)\//', $_SERVER["PHP_SELF"], $reg)) $res=@include "../../../dolibarr".$reg[1]."/htdocs/master.inc.php"; // Used on dev env only -if (! $res) die ("Failed to include master.inc.php file\n"); +if (! $res) die("Failed to include master.inc.php file\n"); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 6098a0e0139..296c6cb9b6f 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -428,5 +428,6 @@ - + + diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 67ae907d9a4..bf2b8d4f948 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -173,17 +173,16 @@ while ($obj = $db->fetch_object($resql)) { $sql.= $db->plimit($limit+1, $offset); -dol_syslog ("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); +dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); $resql = $db->query($sql); -if (! $resql) -{ +if (! $resql) { dol_print_error($db); exit; } $num = $db->num_rows($resql); -dol_syslog ("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); +dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index c6434da6388..6bbc4ad9c62 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -633,12 +633,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)). '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Thirdparty") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -654,12 +654,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '""' . $sep; - print '"' . utf8_decode (dol_trunc($accountingaccount->label, 32)) . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep; print '"' . $journal . '"' ; @@ -679,7 +679,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)) . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '""' . $sep; @@ -700,12 +700,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . $key . '"' . $sep; print '"' . $date . '"' . $sep; print '"' . $val["refsologest"] . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 32)). '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 32)). '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Thirdparty") . '"' . $sep; - print '"' . utf8_decode (dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . ' NPR"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep; print '"' . $journal . '"' ; diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 3c455f102f9..a7aab12b2ef 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $action = GETPOST('action', 'alpha'); $obj_facturation = unserialize($_SESSION['serObjFacturation']); -unset ($_SESSION['serObjFacturation']); +unset($_SESSION['serObjFacturation']); switch($action) diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index b75878b11bd..9d47c63a75a 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -359,7 +359,7 @@ switch ($action) // End of case: valide_facture } -unset ($_SESSION['serObjFacturation']); +unset($_SESSION['serObjFacturation']); $_SESSION['serObjFacturation'] = serialize($obj_facturation); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index f5b13437ba9..2b670ae5286 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -220,7 +220,7 @@ class Categories extends DolibarrApi if ($this->category->update(DolibarrApiAccess::$user) > 0) { - return $this->get ($id); + return $this->get($id); } else { diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 20d9a862f33..99433a9b8f0 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1472,8 +1472,7 @@ class Categorie extends CommonObject // We want to reverse lookup $map_type = array_flip($this->MAP_ID); $type = $map_type[$type]; -dol_syslog( get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", - LOG_WARNING ); + dol_syslog(get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", LOG_WARNING); } // Generation requete recherche diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 00aae3a8b08..567f968e3d2 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -423,12 +423,15 @@ class AdvanceTargetingMailing extends CommonObject $this->db->begin(); dol_syslog(get_class($this)."::update sql=".$sql, 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) - { - if (! $notrigger) - { + //if (! $error) + //{ + // if (! $notrigger) + // { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -438,8 +441,8 @@ class AdvanceTargetingMailing extends CommonObject //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + // } + //} // Commit or rollback if ($error) @@ -790,15 +793,15 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])){ $sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')"; } - }elseif ($extrafields->attribute_type[$key] == 'boolean') { + } elseif ($extrafields->attribute_type[$key] == 'boolean') { if ($arrayquery['options_'.$key.'_cnct']!=''){ if ($arrayquery['options_'.$key.'_cnct']==0) { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct']." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))"; - }else { + } else { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct'].")"; } } - }else{ + } else { if (is_array($arrayquery['options_'.$key.'_cnct'])) { $sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key.'_cnct'])."'))"; } elseif (!empty($arrayquery['options_'.$key.'_cnct'])) { @@ -965,12 +968,12 @@ class AdvanceTargetingMailing extends CommonObject } if (count($return_sql_like)>0) { - $return_sql_criteria .= '(' . implode (' OR ', $return_sql_like) .')'; + $return_sql_criteria .= '(' . implode(' OR ', $return_sql_like) .')'; } if (count($return_sql_not_like)>0) { - $return_sql_criteria .= ' AND (' . implode (' AND ', $return_sql_not_like).')'; + $return_sql_criteria .= ' AND (' . implode(' AND ', $return_sql_not_like).')'; } - }else { + } else { $return_sql_criteria .= $column_to_test . ' LIKE \''.$this->db->escape($criteria).'\''; } diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 26b16e50d68..66303647dbc 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2014 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 @@ -43,10 +44,10 @@ class FormAdvTargetEmailing extends Form */ function __construct($db) { - global $langs; + global $langs; - $this->db = $db; - } + $this->db = $db; + } /** * Affiche un champs select contenant une liste @@ -64,7 +65,7 @@ class FormAdvTargetEmailing extends Form $sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectlevel"; $sql .= " WHERE active > 0"; $sql .= " ORDER BY sortorder"; - dol_syslog (get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG); + dol_syslog(get_class($this) . '::multiselectProspectionStatus sql=' . $sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -83,7 +84,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return combo list of activated countries, into language of user @@ -120,10 +121,10 @@ class FormAdvTargetEmailing extends Form $foundselected = false; while ($i < $num) { - $obj = $this->db->fetch_object ($resql); + $obj = $this->db->fetch_object($resql); $countryArray [$i] ['rowid'] = $obj->rowid; $countryArray [$i] ['code_iso'] = $obj->code_iso; - $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv ("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); + $countryArray [$i] ['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country" . $obj->code_iso) != "Country" . $obj->code_iso ? $langs->transnoentitiesnoconv("Country" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); $label[$i] = $countryArray[$i]['label']; $i ++; } @@ -143,7 +144,7 @@ class FormAdvTargetEmailing extends Form } return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return select list for categories (to use in form search selectors) @@ -166,26 +167,26 @@ class FormAdvTargetEmailing extends Form $sql_usr .= " WHERE u2.entity IN (0," . $conf->entity . ")"; $sql_usr .= " AND u2.rowid = sc.fk_user "; - if (! empty ($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) + if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql_usr .= " AND u2.statut<>0 "; $sql_usr .= " ORDER BY name ASC"; // print $sql_usr;exit; - $resql_usr = $this->db->query ($sql_usr); + $resql_usr = $this->db->query($sql_usr); if ($resql_usr) { - while ( $obj_usr = $this->db->fetch_object ($resql_usr) ) { + while ( $obj_usr = $this->db->fetch_object($resql_usr) ) { $label = $obj_usr->firstname . " " . $obj_usr->name . " (" . $obj_usr->login . ')'; $options_array [$obj_usr->rowid] = $label; } - $this->db->free ($resql_usr); + $this->db->free($resql_usr); } else { - dol_print_error ($this->db); + dol_print_error($this->db); } - return $this->advMultiselectarray ($htmlname, $options_array, $selected_array); - } + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); + } /** * Return select list for categories (to use in form search selectors) @@ -210,7 +211,7 @@ class FormAdvTargetEmailing extends Form } asort($options_array); return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } + } /** * Return multiselect list of entities for extrafeild type sellist @@ -227,8 +228,8 @@ class FormAdvTargetEmailing extends Form if (is_array($sqlqueryparam)) { - $param_list = array_keys ($sqlqueryparam); - $InfoFieldList = explode (":", $param_list [0]); + $param_list = array_keys($sqlqueryparam); + $InfoFieldList = explode(":", $param_list [0]); // 0 1 : tableName // 1 2 : label field name Nom du champ contenant le libelle @@ -237,8 +238,8 @@ class FormAdvTargetEmailing extends Form $keyList = 'rowid'; - if (count ($InfoFieldList) >= 3) { - if (strpos ($InfoFieldList [3], 'extra.') !== false) { + if (count($InfoFieldList) >= 3) { + if (strpos($InfoFieldList [3], 'extra.') !== false) { $keyList = 'main.' . $InfoFieldList [2] . ' as rowid'; } else { $keyList = $InfoFieldList [2] . ' as rowid'; @@ -247,10 +248,10 @@ class FormAdvTargetEmailing extends Form $sql = 'SELECT ' . $keyList . ', ' . $InfoFieldList [1]; $sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList [0]; - if (! empty ($InfoFieldList [3])) { + if (! empty($InfoFieldList [3])) { // We have to join on extrafield table - if (strpos ($InfoFieldList [3], 'extra') !== false) { + if (strpos($InfoFieldList [3], 'extra') !== false) { $sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList [0] . '_extrafields as extra'; $sql .= ' WHERE extra.fk_object=main.' . $InfoFieldList [2] . ' AND ' . $InfoFieldList [3]; } else { @@ -270,13 +271,13 @@ class FormAdvTargetEmailing extends Form $i = 0; if ($num) { while ( $i < $num ) { - $obj = $this->db->fetch_object ($resql); - $labeltoshow = dol_trunc ($obj->$InfoFieldList [1], 90); + $obj = $this->db->fetch_object($resql); + $labeltoshow = dol_trunc($obj->$InfoFieldList [1], 90); $options_array[$obj->rowid]=$labeltoshow; $i ++; } } - $this->db->free ($resql); + $this->db->free($resql); } } @@ -328,7 +329,7 @@ class FormAdvTargetEmailing extends Form dol_print_error($this->db); } - return $this->advMultiselectarray ($htmlname, $options_array, $selected_array); + return $this->advMultiselectarray($htmlname, $options_array, $selected_array); } /** @@ -347,7 +348,7 @@ class FormAdvTargetEmailing extends Form $form=new Form($this->db); $return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295); return $return; - } + } /** * Return combo list with customer categories @@ -438,19 +439,19 @@ class FormAdvTargetEmailing extends Form $sql .= " WHERE type_element='$type_element'"; $sql .= " ORDER BY c.name"; - dol_syslog (get_class ($this) . "::".__METHOD__, LOG_DEBUG); - $resql = $this->db->query ($sql); + dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG); + $resql = $this->db->query($sql); if ($resql) { $out .= ''; } else { - dol_print_error ($this->db); + dol_print_error($this->db); } - $this->db->free ($resql); + $this->db->free($resql); return $out; - } + } } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 98d7e720628..c1b483efe8c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -570,7 +570,7 @@ abstract class CommonDocGenerator 'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs), ); - // Units + // Units if ($conf->global->PRODUCT_USE_UNITS) { $resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long')); @@ -882,7 +882,7 @@ abstract class CommonDocGenerator // Sorting - uasort ($this->cols, array( $this, 'columnSort' )); + uasort($this->cols, array($this, 'columnSort')); // Positionning $curX = $this->page_largeur-$this->marge_droite; // start from right @@ -945,10 +945,10 @@ abstract class CommonDocGenerator } /** - * get column content width from column key + * get column content width from column key * - * @param string $colKey the column key - * @return float width in mm + * @param string $colKey the column key + * @return float width in mm */ function getColumnContentWidth($colKey) { @@ -1025,13 +1025,13 @@ abstract class CommonDocGenerator /** - * print standard column content + * print standard column content * - * @param PDF $pdf pdf object - * @param float $curY curent Y position - * @param string $colKey the column key - * @param string $columnText column text - * @return int new rank on success and -1 on error + * @param PDF $pdf pdf object + * @param float $curY curent Y position + * @param string $colKey the column key + * @param string $columnText column text + * @return int new rank on success and -1 on error */ function printStdColumnContent($pdf, &$curY, $colKey, $columnText = '') { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 6ea2e01fbfc..1159c74dc8d 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -228,9 +228,9 @@ class FormMail extends Form if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';', $_SESSION["listofmimes".$keytoavoidconflict]); if ($keytodelete >= 0) { - unset ($listofpaths[$keytodelete]); - unset ($listofnames[$keytodelete]); - unset ($listofmimes[$keytodelete]); + unset($listofpaths[$keytodelete]); + unset($listofnames[$keytodelete]); + unset($listofmimes[$keytodelete]); $_SESSION["listofpaths".$keytoavoidconflict]=join(';', $listofpaths); $_SESSION["listofnames".$keytoavoidconflict]=join(';', $listofnames); $_SESSION["listofmimes".$keytoavoidconflict]=join(';', $listofmimes); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f59ad79c430..695464f536f 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -655,7 +655,7 @@ class SMTPs $_retVal = true; // if we have a path... - if ( ! empty ($_strConfigPath) ) + if ( ! empty($_strConfigPath) ) { // If the path is not valid, this will NOT generate an error, // it will simply return false. @@ -989,7 +989,7 @@ class SMTPs $aryHost = $this->_msgRecipients; // Only run this if we have something - if ( !empty ($_addrList)) + if ( !empty($_addrList)) { // $_addrList can be a STRING or an array if ( is_string($_addrList) ) @@ -1409,7 +1409,7 @@ class SMTPs // If we have ZERO, we have a problem if( $keyCount === 0 ) - die ("Sorry, no content"); + die("Sorry, no content"); // If we have ONE, we can use the simple format elseif( $keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 45a8d5bd5c6..c541808399d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6610,12 +6610,12 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen $temp = array(); foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; - if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); - else - { - ($case_sensitive) ? natsort($temp) : natcasesort($temp); - if($order!='asc') $temp=array_reverse($temp, true); - } + if (! $natsort) { + ($order=='asc') ? asort($temp) : arsort($temp); + } else { + ($case_sensitive) ? natsort($temp) : natcasesort($temp); + if($order!='asc') $temp=array_reverse($temp, true); + } $sorted = array(); diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 7f4d44f73f6..6481604ff64 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -38,10 +38,10 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false) global $conf; $num = str_replace(array(',', ' '), '', trim($num)); - if(! $num) { + if (! $num) { return false; } - if($centimes && strlen($num) == 1) { + if ($centimes && strlen($num) == 1) { $num = $num*10; } $TNum = explode('.', $num); @@ -151,7 +151,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') if ($numero >= 1000000000001) return -1; // Get 2 decimals to cents, another functions round or truncate - $strnumber = number_format ($numero, 10); + $strnumber = number_format($numero, 10); $len=strlen($strnumber); for ($i=0; $i<$len; $i++) { @@ -187,7 +187,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $DdMMillon * 10000000000; $UdMMillon = (int) ($numero / 1000000000); $numero = $numero - $UdMMillon * 1000000000; - $entexto .= hundreds2text ($CdMMillon, $DdMMillon, $UdMMillon); + $entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon); $entexto .= " MIL "; } if ($number >= 1000000){ @@ -197,7 +197,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $DdMILLON * 10000000; $udMILLON = (int) ($numero / 1000000); $numero = $numero - $udMILLON * 1000000; - $entexto .= hundreds2text ($CdMILLON, $DdMILLON, $udMILLON); + $entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON); if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1) $entexto .= " MILLÓN "; else @@ -210,7 +210,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $ddm * 10000; $udm = (int) ($numero / 1000); $numero = $numero - $udm * 1000; - $entexto .= hundreds2text ($cdm, $ddm, $udm); + $entexto .= hundreds2text($cdm, $ddm, $udm); if ($cdm || $ddm || $udm) $entexto .= " MIL "; } @@ -218,7 +218,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $numero = $numero - $c * 100; $d = (int) ($numero / 10); $u = (int) $numero - $d * 10; - $entexto .= hundreds2text ($c, $d, $u); + $entexto .= hundreds2text($c, $d, $u); if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000) $entexto .= " DE"; $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5a7b7ff2e42..4886d5c5086 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -121,7 +121,7 @@ if (empty($reshook)) { $action = ''; $object->fetch($id); // show shipment also after canceling modification - } + } include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once @@ -784,8 +784,7 @@ if (empty($reshook)) $stockLocation="entl".$detail_entrepot->line_id; $qty = "qtyl".$detail_entrepot->line_id; $warehouse = GETPOST($stockLocation, 'int'); - if (!empty ($warehouse)) - { + if (!empty($warehouse)) { $line->id = $detail_entrepot->line_id; $line->entrepot_id = $warehouse; $line->qty = GETPOST($qty, 'int'); @@ -800,8 +799,9 @@ if (empty($reshook)) } } } - else // Product no predefined + else { + // Product no predefined $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int'); diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 69e6ff160dc..4391d14ea3c 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -185,8 +185,8 @@ class SupplierInvoices extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -221,8 +221,8 @@ class SupplierInvoices extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { @@ -239,7 +239,7 @@ class SupplierInvoices extends DolibarrApi } if($this->invoice->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } @@ -253,8 +253,8 @@ class SupplierInvoices extends DolibarrApi function delete($id) { if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Supplier invoice not found'); @@ -306,9 +306,9 @@ class SupplierInvoices extends DolibarrApi throw new RestException(404, 'Invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); if ($result == 0) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index b48635d3fd1..38c9ab9e200 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -190,8 +190,8 @@ class SupplierOrders extends DolibarrApi function post($request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401, "Insuffisant rights"); - } + throw new RestException(401, "Insuffisant rights"); + } // Check mandatory fields $result = $this->_validate($request_data); @@ -226,8 +226,8 @@ class SupplierOrders extends DolibarrApi function put($id, $request_data = null) { if(! DolibarrApiAccess::$user->rights->fournisseur->commande->creer) { - throw new RestException(401); - } + throw new RestException(401); + } $result = $this->order->fetch($id); if( ! $result ) { @@ -244,7 +244,7 @@ class SupplierOrders extends DolibarrApi } if($this->order->update($id, DolibarrApiAccess::$user)) - return $this->get ($id); + return $this->get($id); return false; } @@ -257,20 +257,19 @@ class SupplierOrders extends DolibarrApi */ function delete($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { - throw new RestException(401); - } + if (! DolibarrApiAccess::$user->rights->fournisseur->commande->supprimer) { + throw new RestException(401); + } $result = $this->order->fetch($id); - if( ! $result ) { + if ( ! $result) { throw new RestException(404, 'Supplier order not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { + if ( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->order->id, '', 'commande')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( $this->order->delete(DolibarrApiAccess::$user) < 0) - { + if ( $this->order->delete(DolibarrApiAccess::$user) < 0) { throw new RestException(500); } diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 93e3d1128e2..8840da3f3e7 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -1,6 +1,6 @@ - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2013 Laurent Destailleur + * Copyright (C) 2014 Marcos García * * 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 @@ -448,7 +448,7 @@ if (issetAndNoEmpty('reporterhoraires')) { if (issetAndNoEmpty('resethoraires')) { $nbofchoice=count($_SESSION["totalchoixjour"]); for ($i = 0; $i < $nbofchoice; $i++) { - unset ($_SESSION["horaires$i"]); + unset($_SESSION["horaires$i"]); } } @@ -484,7 +484,8 @@ for ($i = 0; $i < $nbrejourmois + $premierjourmois; $i++) { //bouton vert if (($numerojour >= $jourAJ && $_SESSION["mois"] == $moisAJ && $_SESSION["annee"] == $anneeAJ) || ($_SESSION["mois"] > $moisAJ && $_SESSION["annee"] == $anneeAJ) || $_SESSION["annee"] > $anneeAJ) { print ''.$numerojour.'
'.$langs->trans('TotalTTC').''.price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).'
'.$langs->trans("Facebook").'
'.$langs->trans("LinkedIn").'
".$langs->trans("Birthday")."\n"; print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc'); @@ -1281,10 +1290,16 @@ else } // Facebook - if (! empty($conf->socialnetworks->enabled)) - { - print '
'.$langs->trans("Facebook").'facebook).'">
'.$langs->trans("Facebook").'facebook).'">
'.$langs->trans("LinkedIn").'linkedin).'">
".$langs->trans("Birthday")."\n"; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 22429de9200..66ee5ee16f2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -137,6 +137,11 @@ class Adherent extends CommonObject */ public $facebook; + /** + * @var string linkedin account + */ + public $linkedin; + /** * @var string Phone number */ @@ -550,6 +555,7 @@ class Adherent extends CommonObject $sql.= ", skype = '".$this->db->escape($this->skype)."'"; $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; + $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; $sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null"); $sql.= ", phone_perso = ".($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile = ".($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); @@ -660,6 +666,7 @@ class Adherent extends CommonObject $luser->skype=$this->skype; $luser->twitter=$this->twitter; $luser->facebook=$this->facebook; + $luser->linkedin=$this->linkedin; $luser->office_phone=$this->phone; $luser->user_mobile=$this->phone_mobile; @@ -701,6 +708,7 @@ class Adherent extends CommonObject $lthirdparty->skype=$this->skype; $lthirdparty->twitter=$this->twitter; $lthirdparty->facebook=$this->facebook; + $lthirdparty->linkedin=$this->linkedin; $lthirdparty->phone=$this->phone; $lthirdparty->state_id=$this->state_id; $lthirdparty->country_id=$this->country_id; @@ -1189,7 +1197,7 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql.= " d.note_public,"; - $sql.= " d.email, d.skype, d.twitter, d.facebook, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; + $sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.datec as datec,"; $sql.= " d.tms as datem,"; @@ -1266,6 +1274,7 @@ class Adherent extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->photo = $obj->photo; $this->statut = $obj->statut; @@ -2362,6 +2371,7 @@ class Adherent extends CommonObject $this->skype = 'skypepseudo'; $this->twitter = 'twitterpseudo'; $this->facebook = 'facebookpseudo'; + $this->linkedin = 'linkedinpseudo'; $this->phone = '0999999999'; $this->phone_perso = '0999999998'; $this->phone_mobile = '0999999997'; @@ -2469,8 +2479,9 @@ class Adherent extends CommonObject if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; if ($this->twitter && ! empty($conf->global->LDAP_MEMBER_FIELD_TWITTER)) $info[$conf->global->LDAP_MEMBER_FIELD_TWITTER] = $this->twitter; - if ($this->facebook && ! empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook; - if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; + if ($this->facebook && ! empty($conf->global->LDAP_MEMBER_FIELD_FACEBOOK)) $info[$conf->global->LDAP_MEMBER_FIELD_FACEBOOK] = $this->facebook; + if ($this->linkedin && ! empty($conf->global->LDAP_MEMBER_FIELD_LINKEDIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LINKEDIN] = $this->linkedin; + if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php index f723d13d540..8b7c061dc64 100644 --- a/htdocs/admin/socialnetworks.php +++ b/htdocs/admin/socialnetworks.php @@ -1,5 +1,6 @@ + * Copyright (C) 2019 Alexandre Spangaro * * 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 @@ -96,7 +97,7 @@ dol_fiche_head($head, 'setup', '', 0, 'user'); print '
'; -$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); +$arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook', 'linkedin'=>'LinkedIn'); foreach($arrayofsocialnetworks as $snkey => $snlabel) { $consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 63704ab6bca..1eb9a13f877 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -189,6 +189,7 @@ if (empty($reshook)) $object->skype = GETPOST("skype", 'alpha'); $object->twitter = GETPOST("twitter", 'alpha'); $object->facebook = GETPOST("facebook", 'alpha'); + $object->linkedin = GETPOST("linkedin", 'alpha'); $object->email = GETPOST("email", 'alpha'); $object->phone_pro = GETPOST("phone_pro", 'alpha'); $object->phone_perso = GETPOST("phone_perso", 'alpha'); @@ -362,6 +363,7 @@ if (empty($reshook)) $object->skype = GETPOST("skype", 'alpha'); $object->twitter = GETPOST("twitter", 'alpha'); $object->facebook = GETPOST("facebook", 'alpha'); + $object->linkedin = GETPOST("linkedin", 'alpha'); $object->phone_pro = GETPOST("phone_pro", 'alpha'); $object->phone_perso = GETPOST("phone_perso", 'alpha'); $object->phone_mobile = GETPOST("phone_mobile", 'alpha'); @@ -698,6 +700,12 @@ else print '
facebook).'">
linkedin.'">
twitter).'">
facebook).'">
facebook).'">
linkedin).'">
'; + print ''; + print ''; @@ -696,6 +706,7 @@ if (! empty($arrayfields['p.email']['checked'])) print_liste_field if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['p.linkedin']['checked'])) print_liste_field_titre($arrayfields['p.linkedin']['label'], $_SERVER["PHP_SELF"], "p.linkedin", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, 'align="center"', $sortfield, $sortorder); // Extra fields @@ -843,12 +854,18 @@ while ($i < min($num, $limit)) if (! $i) $totalarray['nbfield']++; } // Facebook - if (! empty($arrayfields['p.facebook']['checked'])) - { - if (! empty($conf->socialnetworks->enabled)) { print ''.dol_print_socialnetworks($obj->facebook, $obj->rowid, $obj->socid, 'facebook').''.dol_print_socialnetworks($obj->facebook, $obj->rowid, $obj->socid, 'facebook').''.dol_print_socialnetworks($obj->linkedin, $obj->rowid, $obj->socid, 'linkedin').''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1f86d60598c..98b9d93580a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -672,6 +672,8 @@ abstract class CommonObject $outdone++; if ($this->facebook) $out.=dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook'); $outdone++; + if ($this->linkedin) $out.=dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin'); + $outdone++; } $out.=''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index be046ae889d..6826122b93b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2976,7 +2976,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithoutext, array( 'bank', 'close_title', 'delete', 'edit', 'ellipsis-h', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'note', 'sign-out', 'split', 'switch_off', 'switch_on', 'unlink', 'uparrow', '1downarrow', '1uparrow', - 'jabber','skype','twitter','facebook' + 'jabber','skype','twitter','facebook','linkedin' ) )) { $fakey = $pictowithoutext; diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 1bac8ec18e6..e1d8cb69b78 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -94,4 +94,9 @@ ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer; ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL; -ALTER TABLE llx_payment_various ADD COLUMN subledger_account varchar(32); \ No newline at end of file +ALTER TABLE llx_payment_various ADD COLUMN subledger_account varchar(32); + +ALTER TABLE llx_societe ADD COLUMN linkedin varchar(255) after whatsapp; +ALTER TABLE llx_socpeople ADD COLUMN linkedin varchar(255) after whatsapp; +ALTER TABLE llx_adherent ADD COLUMN linkedin varchar(255) after whatsapp; +ALTER TABLE llx_user ADD COLUMN linkedin varchar(255) after whatsapp; diff --git a/htdocs/install/mysql/tables/llx_adherent.sql b/htdocs/install/mysql/tables/llx_adherent.sql index ede4de2e487..588fb323dae 100644 --- a/htdocs/install/mysql/tables/llx_adherent.sql +++ b/htdocs/install/mysql/tables/llx_adherent.sql @@ -51,6 +51,7 @@ create table llx_adherent skype varchar(255), twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql index 6225ae416e8..ed4919c3fc5 100644 --- a/htdocs/install/mysql/tables/llx_societe.sql +++ b/htdocs/install/mysql/tables/llx_societe.sql @@ -54,6 +54,7 @@ create table llx_societe skype varchar(255), -- twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 00456e3ece6..4ed401e39da 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -46,6 +46,7 @@ create table llx_socpeople skype varchar(255), twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 90dc8a835ef..ef00ae046af 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -58,6 +58,7 @@ create table llx_user skype varchar(255), twitter varchar(255), -- facebook varchar(255), -- + linkedin varchar(255), -- instagram varchar(255), -- snapchat varchar(255), -- googleplus varchar(255), -- diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a8a41527af0..95dc554ef71 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -146,7 +146,7 @@ if (empty($reshook)) $object->client = $object->client | $soc_origin->client; $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; $listofproperties=array( - 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'url', 'barcode', + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'linkedin', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', @@ -407,6 +407,7 @@ if (empty($reshook)) $object->skype = GETPOST('skype', 'alpha'); $object->twitter = GETPOST('twitter', 'alpha'); $object->facebook = GETPOST('facebook', 'alpha'); + $object->linkedin = GETPOST('linkedin', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); @@ -970,6 +971,7 @@ else $object->skype = GETPOST('skype', 'alpha'); $object->twitter = GETPOST('twitter', 'alpha'); $object->facebook = GETPOST('facebook', 'alpha'); + $object->linkedin = GETPOST('linkedin', 'alpha'); $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); @@ -1304,13 +1306,21 @@ else print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; - print 'facebook).'">'; - print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; + print 'facebook).'">'; + print '
'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).''; + print 'linkedin).'">'; + print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
'.$form->editfieldkey('LinkedIn', 'linkedin', '', $object, 0).'
'.$langs->trans("LinkedIn").''; + if (! empty($ldap_linkedin)) + { + print ''; + print $ldap_linkedin; + } + else + { + print ''; + } + print '
'; @@ -2287,7 +2307,7 @@ else print '
'.$langs->trans("Facebook").'
'.$langs->trans("LinkedIn").''; + if ($caneditfield && empty($object->ldap_sid)) + { + print ''; + } + else + { + print ''; + print $object->linkedin; + } + print '
'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a6bc202d17f..ef6e2c23971 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -73,6 +73,7 @@ class User extends CommonObject public $skype; public $twitter; public $facebook; + public $linkedin; public $job; // job position public $signature; @@ -227,7 +228,7 @@ class User extends CommonObject $login=trim($login); // Get user - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.twitter, u.facebook,"; + $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.job, u.skype, u.twitter, u.facebook, u.linkedin,"; $sql.= " u.signature, u.office_phone, u.office_fax, u.user_mobile,"; $sql.= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; $sql.= " u.admin, u.login, u.note,"; @@ -335,6 +336,7 @@ class User extends CommonObject $this->skype = $obj->skype; $this->twitter = $obj->twitter; $this->facebook = $obj->facebook; + $this->linkedin = $obj->linkedin; $this->job = $obj->job; $this->signature = $obj->signature; $this->admin = $obj->admin; @@ -1252,6 +1254,7 @@ class User extends CommonObject $this->skype = $contact->skype; $this->twitter = $contact->twitter; $this->facebook = $contact->facebook; + $this->linkedin = $contact->linkedin; $this->office_phone = $contact->phone_pro; $this->office_fax = $contact->fax; $this->user_mobile = $contact->phone_mobile; @@ -1469,6 +1472,7 @@ class User extends CommonObject $this->skype = trim($this->skype); $this->twitter = trim($this->twitter); $this->facebook = trim($this->facebook); + $this->linkedin = trim($this->linkedin); $this->job = trim($this->job); $this->signature = trim($this->signature); @@ -1521,6 +1525,7 @@ class User extends CommonObject $sql.= ", skype = '".$this->db->escape($this->skype)."'"; $sql.= ", twitter = '".$this->db->escape($this->twitter)."'"; $sql.= ", facebook = '".$this->db->escape($this->facebook)."'"; + $sql.= ", linkedin = '".$this->db->escape($this->linkedin)."'"; $sql.= ", job = '".$this->db->escape($this->job)."'"; $sql.= ", signature = '".$this->db->escape($this->signature)."'"; $sql.= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; @@ -1609,6 +1614,7 @@ class User extends CommonObject $adh->skype=$this->skype; $adh->twitter=$this->twitter; $adh->facebook=$this->facebook; + $adh->linkedin=$this->linkedin; $adh->phone=$this->office_phone; $adh->phone_mobile=$this->user_mobile; @@ -1661,6 +1667,7 @@ class User extends CommonObject $tmpobj->skype=$this->skype; $tmpobj->twitter=$this->twitter; $tmpobj->facebook=$this->facebook; + $tmpobj->linkedin=$this->linkedin; $tmpobj->phone_pro=$this->office_phone; $tmpobj->phone_mobile=$this->user_mobile; @@ -2528,7 +2535,8 @@ $mailfile = new CMailFile( 'LDAP_FIELD_SID' => 'ldap_sid', 'LDAP_FIELD_SKYPE' => 'skype', 'LDAP_FIELD_TWITTER' => 'twitter', - 'LDAP_FIELD_FACEBOOK' => 'facebook' + 'LDAP_FIELD_FACEBOOK' => 'facebook', + 'LDAP_FIELD_LINKEDIN' => 'linkedin' ); // Champs @@ -2642,6 +2650,7 @@ $mailfile = new CMailFile( $this->skype='skypepseudo'; $this->twitter='twitterpseudo'; $this->facebook='facebookpseudo'; + $this->linkedin='linkedinpseudo'; $this->office_phone='0999999999'; $this->office_fax='0999999998'; $this->user_mobile='0999999997'; @@ -2796,6 +2805,7 @@ $mailfile = new CMailFile( $this->skype=$ldapuser->{$conf->global->LDAP_FIELD_SKYPE}; $this->twitter=$ldapuser->{$conf->global->LDAP_FIELD_TWITTER}; $this->facebook=$ldapuser->{$conf->global->LDAP_FIELD_FACEBOOK}; + $this->linkedin=$ldapuser->{$conf->global->LDAP_FIELD_LINKEDIN}; $this->ldap_sid=$ldapuser->{$conf->global->LDAP_FIELD_SID}; $this->job=$ldapuser->{$conf->global->LDAP_FIELD_TITLE}; From 6fa016dc850cf293718cefc9b21d7ebddec4c725 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 25 Feb 2019 10:44:22 +0100 Subject: [PATCH 127/190] FIX wrong feature2 when user rights "group_advance" is used --- htdocs/user/group/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1be76e8fb4d..fd497e6986a 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -35,12 +35,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $canreadperms=($user->admin || $user->rights->user->user->lire); $caneditperms=($user->admin || $user->rights->user->user->creer); $candisableperms=($user->admin || $user->rights->user->user->supprimer); +$feature2 = 'user'; + // Advanced permissions if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadperms=($user->admin || $user->rights->user->group_advance->read); $caneditperms=($user->admin || $user->rights->user->group_advance->write); $candisableperms=($user->admin || $user->rights->user->group_advance->delete); + $feature2 = 'group_advance'; } // Load translation files required by page @@ -55,7 +58,7 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'groupcard' $userid = GETPOST('user', 'int'); // Security check -$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); +$result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); // Users/Groups management only in master entity if transverse mode if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) From c0be66b5e5c496b4f18ca7df2f62ab617f801735 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 14:55:29 +0100 Subject: [PATCH 128/190] FXI Remove duplicate record before trying to create unique key --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 8e9d82c5fd1..966058e88d7 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -266,8 +266,12 @@ CREATE TABLE llx_pos_cash_fence( UPDATE llx_const set name = 'PRELEVEMENT_END_TO_END' where name = 'END_TO_END'; UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; --- Delete duplicate accounting account not used +-- Delete duplicate accounting account, but only if not used +DROP TABLE tmp_llx_accouting_account; +CREATE TABLE tmp_llx_accouting_account AS SELECT MIN(rowid) as MINID, account_number, entity, fk_pcg_version, count(*) AS NB FROM llx_accounting_account group BY account_number, entity, fk_pcg_version HAVING count(*) >= 2 order by account_number, entity, fk_pcg_version; +--SELECT * from tmp_llx_accouting_account; +DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)) ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; From 1be1ee16709c7ff16ea99868c8e2e32636d760e0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 14:56:28 +0100 Subject: [PATCH 129/190] Remove duplicate record --- htdocs/install/mysql/migration/repair.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 22409441eac..6a2fe099fdd 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -376,6 +376,16 @@ update llx_bank_url as bu set url_id = (select e.fk_user_author from tmp_bank_ur drop table tmp_bank_url_expense_user; +-- Delete duplicate accounting account, but only if not used +DROP TABLE tmp_llx_accouting_account; +CREATE TABLE tmp_llx_accouting_account AS SELECT MIN(rowid) as MINID, account_number, entity, fk_pcg_version, count(*) AS NB FROM llx_accounting_account group BY account_number, entity, fk_pcg_version HAVING count(*) >= 2 order by account_number, entity, fk_pcg_version; +--SELECT * from tmp_llx_accouting_account; +DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)) + +ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; +ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); + + -- VMYSQL4.1 update llx_projet_task_time set task_datehour = task_date where task_datehour < task_date or task_datehour > DATE_ADD(task_date, interval 1 day); From 3ba69fc93a182ef3bba70256900f753b20fc3b28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 15:06:55 +0100 Subject: [PATCH 130/190] Fix missing ; after sql request --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 2 +- htdocs/install/mysql/migration/repair.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index 966058e88d7..31689120cfc 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -271,7 +271,7 @@ UPDATE llx_const set name = 'PRELEVEMENT_USTRD' where name = 'USTRD'; DROP TABLE tmp_llx_accouting_account; CREATE TABLE tmp_llx_accouting_account AS SELECT MIN(rowid) as MINID, account_number, entity, fk_pcg_version, count(*) AS NB FROM llx_accounting_account group BY account_number, entity, fk_pcg_version HAVING count(*) >= 2 order by account_number, entity, fk_pcg_version; --SELECT * from tmp_llx_accouting_account; -DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)) +DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)); ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 6a2fe099fdd..b678cab18b7 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -380,7 +380,7 @@ drop table tmp_bank_url_expense_user; DROP TABLE tmp_llx_accouting_account; CREATE TABLE tmp_llx_accouting_account AS SELECT MIN(rowid) as MINID, account_number, entity, fk_pcg_version, count(*) AS NB FROM llx_accounting_account group BY account_number, entity, fk_pcg_version HAVING count(*) >= 2 order by account_number, entity, fk_pcg_version; --SELECT * from tmp_llx_accouting_account; -DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)) +DELETE from llx_accounting_account where rowid in (select minid from tmp_llx_accouting_account where minid NOT IN (SELECT fk_code_ventilation from llx_facturedet) AND minid NOT IN (SELECT fk_code_ventilation from llx_facture_fourn_det) AND minid NOT IN (SELECT fk_code_ventilation from llx_expensereport_det)); ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); From dde18e803dd692d361002b2ab958ffc6a7c4644c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 15:09:56 +0100 Subject: [PATCH 131/190] Fix transaction --- .../facture/class/api_invoices.class.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index afecfd33b45..9bbb155eb60 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -372,7 +372,7 @@ class Invoices extends DolibarrApi throw new RestException(304, $this->invoice->error); } } - + /** * Add a contact type of given invoice * @@ -939,9 +939,8 @@ class Invoices extends DolibarrApi if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } - - $this->db->begin(); - + + $result = $this->invoice->fetch($id); if( ! $result ) { throw new RestException(404, 'Invoice not found'); @@ -958,8 +957,12 @@ class Invoices extends DolibarrApi if (! $this->invoice->paye) // protection against multiple submit { + $this->db->begin(); + $this->invoice->fetch_lines(); - + + $amount_ht = $amount_tva = $amount_ttc = array(); + // Loop on each vat rate $i=0; foreach($this->invoice->lines as $line) @@ -1009,14 +1012,14 @@ class Invoices extends DolibarrApi } else { - throw new RestException(500, 'Could not set paid'); - $this->db->rollback(); + $this->db->rollback(); + throw new RestException(500, 'Could not set paid'); } } else { - throw new RestException(500, 'Discount creation error'); - $this->db->rollback(); + $this->db->rollback(); + throw new RestException(500, 'Discount creation error'); } } From 8234c094124be615378169927406e50934bac647 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 15:15:17 +0100 Subject: [PATCH 132/190] Try some fixes --- htdocs/stripe/class/stripe.class.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 8cc5b0218b1..646e5c19b12 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -243,13 +243,13 @@ class Stripe extends CommonObject /** * Get the Stripe payment intent * - * @param Societe $object Object tp pay on Stripe - * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() - * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect - * @param int $status Status (0=test, 1=live) - * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt - * @param int $mode automatic=automatic payment, manual=need confirmation - * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found + * @param Societe $object Object to pay with Stripe + * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() + * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int $status Status (0=test, 1=live) + * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt + * @param int $mode automatic=automatic payment, manual=need confirmation + * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found */ public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic') { @@ -284,7 +284,7 @@ class Stripe extends CommonObject $obj = $this->db->fetch_object($resql); $intent = $obj->ext_payment_id; - dol_syslog(get_class($this) . "::customerStripe found stripe customer key_account = ".$tiers); + dol_syslog(get_class($this) . "::customerStripe found record"); // Force to use the correct API key global $stripearrayofkeysbyenv; @@ -308,7 +308,7 @@ class Stripe extends CommonObject if (! in_array($object->multicurrency_code, $arrayzerounitcurrency)) $stripeamount=$object->multicurrency_total_ttc * 100; else $stripeamount = $object->multicurrency_total_ttc; - $fee = round(($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); + $fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); } @@ -328,9 +328,9 @@ class Stripe extends CommonObject { $dataforintent["application_fee"] = $fee; } - if ($societe->email && $usethirdpartyemailforreceiptemail) + if ($usethirdpartyemailforreceiptemail && $object->thirdparty->email) { - $dataforintent["receipt_email"] = $societe->email; + $dataforintent["receipt_email"] = $object->thirdparty->email; } try { From 5ffc1822d92825988192c053ee02bd1b535b3fc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 19:01:51 +0100 Subject: [PATCH 133/190] Translation --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8b3a5a6600b..a54ba98a7e5 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -150,7 +150,7 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transfer +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of bank transfer ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions From 25d277acebdab803abbefb88842d578cfc28c112 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 19:02:41 +0100 Subject: [PATCH 134/190] More complete translation --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index a54ba98a7e5..e613d38ab05 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -150,7 +150,7 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of bank transfer +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions From fc1d0b2dd5a13d1982772e4ebeeff5292f5e9343 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Feb 2019 19:07:29 +0100 Subject: [PATCH 135/190] Add missing translation --- htdocs/langs/en_US/accountancy.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e613d38ab05..472e2166f6b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -207,6 +207,7 @@ DescThirdPartyReport=Consult here the list of third-party customers and vendors ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error +ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service From f6fc9190f373c14ad4f5bcf60ff2d4f83c44c870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josep=20Llu=C3=ADs?= Date: Mon, 25 Feb 2019 19:41:40 +0100 Subject: [PATCH 136/190] Add no_email field in contact list Add no_email field in contact list --- htdocs/contact/list.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index aa27e43ee71..783c887efda 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -10,6 +10,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Josep Lluís Amador * * 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 @@ -68,6 +69,7 @@ $search_phone_pro=GETPOST("search_phone_pro", 'alpha'); $search_phone_mobile=GETPOST("search_phone_mobile", 'alpha'); $search_fax=GETPOST("search_fax", 'alpha'); $search_email=GETPOST("search_email", 'alpha'); +$search_no_email=GETPOST("search_no_email",'int'); $search_skype=GETPOST("search_skype", 'alpha'); $search_twitter=GETPOST("search_twitter", 'alpha'); $search_facebook=GETPOST("search_facebook", 'alpha'); @@ -159,6 +161,7 @@ $arrayfields=array( 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), 'p.fax'=>array('label'=>"Fax", 'checked'=>0), 'p.email'=>array('label'=>"EMail", 'checked'=>1), + 'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(! empty($conf->mailing->enabled))), 'p.jabberid'=>array('label'=>"Jabber", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.skype'=>array('label'=>"Skype", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), 'p.twitter'=>array('label'=>"Twitter", 'checked'=>1, 'enabled'=>(! empty($conf->socialnetworks->enabled))), @@ -222,6 +225,7 @@ if (empty($reshook)) $search_phone_mobile=""; $search_fax=""; $search_email=""; + $search_no_email=-1; $search_skype=""; $search_twitter=""; $search_facebook=""; @@ -258,7 +262,7 @@ $contactstatic=new Contact($db); $title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")); $sql = "SELECT s.rowid as socid, s.nom as name,"; -$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.skype,"; +$sql.= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email, p.skype,"; $sql.= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql.= " co.code as country_code"; // Add fields from extrafields @@ -325,6 +329,7 @@ if (strlen($search_email)) $sql.= natural_search('p.email', $search_ema if (strlen($search_zip)) $sql.= natural_search("p.zip", $search_zip); if (strlen($search_town)) $sql.= natural_search("p.town", $search_town); +if ($search_no_email != '' && $search_no_email >= 0) $sql.= " AND p.no_email = ".$db->escape($search_no_email); if ($search_status != '' && $search_status >= 0) $sql.= " AND p.statut = ".$db->escape($search_status); if ($search_import_key) $sql.= natural_search("p.import_key", $search_import_key); if ($type == "o") // filtre sur type @@ -422,6 +427,7 @@ if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($sea if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($search_phone_mobile); if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax); if ($search_email != '') $param.='&search_email='.urlencode($search_email); +if ($search_no_email != '') $param.='&search_no_email='.urlencode($search_no_email); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); @@ -607,6 +613,12 @@ if (! empty($arrayfields['p.email']['checked'])) print ''; print ''; + print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'),'1'=>$langs->trans('Yes')),$search_no_email); + print ''; @@ -696,6 +708,7 @@ if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); +if (! empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'],$_SERVER["PHP_SELF"],"p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.skype']['checked'])) print_liste_field_titre($arrayfields['p.skype']['label'], $_SERVER["PHP_SELF"], "p.skype", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder); if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder); @@ -839,7 +852,12 @@ while ($i < min($num, $limit)) print ''.dol_print_email($obj->email, $obj->rowid, $obj->socid, 'AC_EMAIL', 18).''.yn($obj->no_email).'
' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print '
' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '
'; - print $this->selectAnalyticCodesTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); + // Group + print '
'; + print $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); print '
'; - $formTicket->selectAnalyticCodesTickets($search_category, 'search_category', '', 2, 1, 1); + $formTicket->selectGroupTickets($search_category, 'search_category', '', 2, 1, 1); print ''; print $langs->trans('TicketChangeCategory'); print ''; - print $formticket->selectAnalyticCodesTickets($object->category_code, 'update_value_category', '', 2); + print $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2); print '
' . $langs->trans("AnalyticCode") . ''; + // Group + print '
' . $langs->trans("TicketGroup") . ''; print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); /*if ($user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 618eb654b1c..806bed19064 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -186,7 +186,7 @@ class Ticket extends CommonObject 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), - 'category_code' => array('type'=>'varchar(32)', 'label'=>'Category', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), + 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 7466a0308e1..2e9f76ff8a3 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -354,8 +354,8 @@ if ($result) { print $objp->severity_label; print "'; - print $tickesupstatic->getLibStatut(3); + print ''; + print $tickesupstatic->getLibStatut(5); print "
'; - $formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth200')); + $formTicket->selectTypesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth150')); print ''; - $formTicket->selectAnalyticCodesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth200')); + $formTicket->selectGroupTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth150')); print ''; - $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth200')); + $formTicket->selectSeveritiesTickets(dol_escape_htmltag($search[$key]), 'search_'.$key.'', '', 0, 1, 1, 0, ($val['css']?$val['css']:'maxwidth150')); print ''; + print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css']?$val['css']:'maxwidth150')); + print ''; - print Form::multiselectarray('search_fk_statut', $object->statuts_short, $search[$key], 0, 0, '', 1, 0, '', '', ''); + $arrayofstatus = array(); + $arrayofstatus['openall']='-- '.$langs->trans('OpenAll').' --'; + foreach ($object->statuts_short as $key2 => $val2) + { + $arrayofstatus[$key2] = $val2; + if ($key2 == '6') $arrayofstatus['closeall']='-- '.$langs->trans('ClosedAll').' --'; + } + print ''; + //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, array_values($search[$key]), 0, 0, 'minwidth150', 1, 0, '', '', ''); print '
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'.$langs->trans("LinkedToDolibarrThirdParty").''.$company->getNomUrl(1).'
'; - - // Name - print ''; - print ''; - print ''; - print ''; - - // Address - print ''; - print ''; - print ''; - print ''; - - // Zipcode - print ''; - print ''; - print ''; - print ''; - - // Town - print ''; - print ''; - print ''; - print ''; - - // Country - print ''; - print ''; - print ''; - print ''; - - // Status - print ''; - print ''; - print ''; - - print '
'. $form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).'
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; - print ''; - print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; -print $formcompany->select_ziptown( - GETPOST('zipcode', 'alpha'), - 'zipcode', - array ( - 'town', - 'selectcountry_id' - ), - 6 - ); - print '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; -print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( - 'zipcode', - 'selectcountry_id' - )); - print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; - print $form->select_country(GETPOST('country_id', 'int')>0?GETPOST('country_id', 'int'):$mysoc->country_id, 'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'.$form->editfieldkey('Status', 'status', '', $object, 0, 'string', '', 1).''; - print $form->selectarray('status', $status2label, GETPOST('status', 'alpha')); - print '
'; - - dol_fiche_end(); - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print ''; + $result=$object->fetch($socid); + if ($result <= 0) dol_print_error('', $object->error); } -// Part to edit record -if (($id || $ref) && $action == 'edit') +$title=$langs->trans("ThirdParty"); +if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('Card'); +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; + +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { - $result = $object->fetch($id); - if ($result > 0) + // ----------------------------------------- + // When used with CANVAS + // ----------------------------------------- + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template +} +else +{ + // ----------------------------------------- + // When used in standard mode + // ----------------------------------------- + if ($action == 'create') { - $head = establishment_prepare_head($object); + /* + * Creation + */ + $private=GETPOST("private", "int"); + if (! empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1; + if (empty($private)) $private=0; - if ($action == 'edit') + // Load object modCodeTiers + $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building'); + $module = substr($module, 0, dol_strlen($module)-4); + } + $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) + { + $res=dol_include_once($dirroot.$module.'.php'); + if ($res) break; + } + $modCodeClient = new $module; + // Load object modCodeFournisseur + $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') + { + $module = substr($module, 0, dol_strlen($module)-4); + } + $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) + { + $res=dol_include_once($dirroot.$module.'.php'); + if ($res) break; + } + $modCodeFournisseur = new $module; - print '
' . "\n"; - print ''; + // Define if customer/prospect or supplier status is set or not + if (GETPOST("type")!='f') + { + $object->client=-1; + if (! empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client=3; } + } + // Prospect / Customer + if (GETPOST("type")=='c') { + if (! empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { + $object->client=$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; + } else { + $object->client=3; + } + } + if (GETPOST("type")=='p') { $object->client=2; } + if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && ! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; } + + $object->name = GETPOST('name', 'alpha'); + $object->firstname = GETPOST('firstname', 'alpha'); + $object->particulier = $private; + $object->prefix_comm = GETPOST('prefix_comm'); + $object->client = GETPOST('client')?GETPOST('client'):$object->client; + + if(empty($duplicate_code_error)) { + $object->code_client = GETPOST('customer_code', 'alpha'); + $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + } + else { + setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), '', 'warnings'); + } + + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->state_id = GETPOST('state_id', 'int'); + $object->skype = GETPOST('skype', 'alpha'); + $object->twitter = GETPOST('twitter', 'alpha'); + $object->facebook = GETPOST('facebook', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); + $object->fax = GETPOST('fax', 'alpha'); + $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); + $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); + $object->capital = GETPOST('capital', 'alpha'); + $object->barcode = GETPOST('barcode', 'alpha'); + $object->idprof1 = GETPOST('idprof1', 'alpha'); + $object->idprof2 = GETPOST('idprof2', 'alpha'); + $object->idprof3 = GETPOST('idprof3', 'alpha'); + $object->idprof4 = GETPOST('idprof4', 'alpha'); + $object->idprof5 = GETPOST('idprof5', 'alpha'); + $object->idprof6 = GETPOST('idprof6', 'alpha'); + $object->typent_id = GETPOST('typent_id', 'int'); + $object->effectif_id = GETPOST('effectif_id', 'int'); + $object->civility_id = GETPOST('civility_id', 'int'); + + $object->tva_assuj = GETPOST('assujtva_value', 'int'); + $object->status = GETPOST('status', 'int'); + + //Local Taxes + $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'int'); + $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'int'); + + $object->localtax1_value =GETPOST('lt1', 'int'); + $object->localtax2_value =GETPOST('lt2', 'int'); + + $object->tva_intra = GETPOST('tva_intra', 'alpha'); + + $object->commercial_id = GETPOST('commercial_id', 'int'); + $object->default_lang = GETPOST('default_lang'); + + $object->logo = (isset($_FILES['photo'])?dol_sanitizeFileName($_FILES['photo']['name']):''); + + // Gestion du logo de la société + $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos"; + $file_OK = (isset($_FILES['photo'])?is_uploaded_file($_FILES['photo']['tmp_name']):false); + if ($file_OK) + { + if (image_format_supported($_FILES['photo']['name'])) + { + dol_mkdir($dir); + + if (@is_dir($dir)) + { + $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); + + if (! $result > 0) + { + $errors[] = "ErrorFailedToSaveFile"; + } + else + { + // Create thumbs + $object->addThumbs($newfile); + } + } + } + } + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; + if ($object->country_id) + { + $tmparray=getCountry($object->country_id, 'all'); + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; + } + $object->forme_juridique_code=GETPOST('forme_juridique_code'); + /* Show create form */ + + $linkback=""; + print load_fiche_titre($langs->trans("NewThirdParty"), $linkback, 'title_companies.png'); + + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) + { + print "\n".''."\n"; + + print '
'; + print '
'; + print $langs->trans("ThirdPartyType").':     '; + print '
'; + print ''; + print '     '; + print ''; + print '
'; + print "
\n"; + } + + dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error'); + + print ''; // Chrome ignor autocomplete + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; + + dol_fiche_head(null, 'card', '', 0, ''); + + print ''; + + // Name, firstname + print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; + print ''; + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + { + print ''; + } + print ''; + + // If javascript on, we show option individual + if ($conf->use_javascript_ajax) + { + print ''; + print ''; + print ''; + // Title + print ''; + print ''; + } + + // Alias names (commercial, trademark or alias names) + print ''; + print ''; + + // Prospect/Customer + print ''; + print ''; + + print ''; + + if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) + { + // Supplier + print ''; + print ''; + print ''; + } + + // Status + print ''; + + // Barcode + if (! empty($conf->barcode->enabled)) + { + print ''; + print ''; + } + + // Address + print ''; + print ''; + + // Zip / Town + print ''; + + // Country + print ''; + + // State + if (empty($conf->global->SOCIETE_DISABLE_STATE)) + { + if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) + { + print ''; + } + + // Email / Web + print ''; + print ''; + print ''; + print ''; + + if (! empty($conf->socialnetworks->enabled)) + { + // Skype + if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) + { + print ''; + print ''; + } + // Twitter + if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) + { + print ''; + print ''; + } + // Facebook + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } + } + + // Phone / Fax + print ''; + print ''; + print ''; + print ''; + + // Prof ids + $i=1; $j=0; + while ($i <= 6) + { + $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof!='-') + { + $key='idprof'.$i; + + if (($j % 2) == 0) print ''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + print ''; + if (($j % 2) == 1) print ''; + $j++; + } + $i++; + } + if ($j % 2 == 1) print ''; + + // Vat is used + print ''; + print ''; + print ''; + print ''; + print ''; + + // Local Taxes + //TODO: Place into a function to control showing by country or study better option + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + { + print ''; + } + elseif($mysoc->localtax1_assuj=="1") + { + print ''; + } + elseif($mysoc->localtax2_assuj=="1") + { + print ''; + } + + // Type - Size + print ''; + print ''; + + // Legal Form + print ''; + print ''; + + // Capital + print ''; + print ''; + + if (! empty($conf->global->MAIN_MULTILANGS)) + { + print ''; + print ''; + } + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } + + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + $langs->load('categories'); + + // Customer + //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { + print '"; + //} + + // Supplier + //if ($object->fournisseur) { + print '"; + //} + } + + // Multicurrency + if (! empty($conf->multicurrency->enabled)) + { + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + + // Assign a sale representative + print ''; + print ''; + print ''; + + // Ajout du logo + print ''; + print ''; + print ''; + print ''; + + print '
'; + if ($object->particulier || $private) + { + print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; + } + else + { + print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; + } + print ''.$langs->trans('Prefix').'
'.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).'
'.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).''; + print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; + $selected=GETPOST('client', 'int')!=''?GETPOST('client', 'int'):$object->client; + print $formcompany->selectProspectCustomerType($selected); + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + print '
'; + $tmpcode=$object->code_client; + if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object, 0); + print ''; + print ''; + $s=$modCodeClient->getToolTip($langs, $object, 0); + print $form->textwithpicto('', $s, 1); + print '
'; + print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; + $default = -1; + if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1; + print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int')!=''?GETPOST('fournisseur', 'int'):(GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0)); + print ''; + if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + { + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); + } + print ''; + if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + { + print '
'; + $tmpcode=$object->code_fournisseur; + if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object, 1); + print ''; + print ''; + $s=$modCodeFournisseur->getToolTip($langs, $object, 1); + print $form->textwithpicto('', $s, 1); + print '
'; + } + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; + print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1); + print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; + print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print $formcompany->select_ziptown($object->town, 'town', array('zipcode','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); + print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; + print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; + } + else + { + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; + } + + if ($object->country_id) print $formcompany->select_state($object->state_id, $object->country_code); + else print $countrynotdefined; + print '
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).''; + print 'skype).'">'; + print '
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).''; + print 'twitter).'">'; + print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; + print 'facebook).'">'; + print '
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory)?0:1)).''; + + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); + print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; + print $form->selectyesno('assujtva_value', GETPOSTISSET('assujtva_value')?GETPOST('assujtva_value', 'int'):1, 1); // Assujeti par defaut en creation + print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; + $s = ''; + + if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) + { + $s.=' '; + + if (! empty($conf->use_javascript_ajax)) + { + print "\n"; + print ''; + print "\n"; + $s.=''.$langs->trans("VATIntraCheck").''; + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + } + else + { + $s.='country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + } + } + print $s; + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1:0), 1); + print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0), 1); + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1:0), 1); + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0), 1); + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''."\n"; + $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); + if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); + if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; + if ($object->country_id) + { + print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); + } + else + { + print $countrynotdefined; + } + print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; + print ''.$langs->trans("Currency".$conf->currency).'
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; + print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); + print '
' . $form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0) . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); + print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); + print "
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); + print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); + print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); + print '
'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; + $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); + // Note: If user has no right to "see all thirdparties", we for selection of sale representative to him, so after creation he can see the record. + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir)?array($user->id):array()))); + print $form->multiselectarray('commercial', $userlist, $selected, null, null, null, null, "90%"); + print '
'.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; + print ''; + print '
'."\n"; + + dol_fiche_end(); + + print '
'; + print ''; + if (! empty($backtopage)) + { + print '     '; + print ''; + } + else + { + print '     '; + print ''; + } + print '
'."\n"; + + print '
'."\n"; + } + elseif ($action == 'edit') + { + //print load_fiche_titre($langs->trans("EditCompany")); + + if ($socid) + { + $res=$object->fetch_optionals(); + //if ($res < 0) { dol_print_error($db); exit; } + + $head = societe_prepare_head($object); + + // Load object modCodeTiers + $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') + { + $module = substr($module, 0, dol_strlen($module)-4); + } + $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) + { + $res=dol_include_once($dirroot.$module.'.php'); + if ($res) break; + } + $modCodeClient = new $module($db); + // We verified if the tag prefix is used + if ($modCodeClient->code_auto) + { + $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed(); + } + $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') + { + $module = substr($module, 0, dol_strlen($module)-4); + } + $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) + { + $res=dol_include_once($dirroot.$module.'.php'); + if ($res) break; + } + $modCodeFournisseur = new $module($db); + // On verifie si la balise prefix est utilisee + if ($modCodeFournisseur->code_auto) + { + $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed(); + } + + $object->oldcopy = clone $object; + + if (GETPOSTISSET('name')) + { + // We overwrite with values if posted + $object->name = GETPOST('name', 'alpha'); + $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); + $object->client = GETPOST('client', 'int'); + $object->code_client = GETPOST('customer_code', 'alpha'); + $object->fournisseur = GETPOST('fournisseur', 'int'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id')?GETPOST('country_id', 'int'):$mysoc->country_id; + $object->state_id = GETPOST('state_id', 'int'); + $object->skype = GETPOST('skype', 'alpha'); + $object->twitter = GETPOST('twitter', 'alpha'); + $object->facebook = GETPOST('facebook', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); + $object->fax = GETPOST('fax', 'alpha'); + $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); + $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); + $object->capital = GETPOST('capital', 'alpha'); + $object->idprof1 = GETPOST('idprof1', 'alpha'); + $object->idprof2 = GETPOST('idprof2', 'alpha'); + $object->idprof3 = GETPOST('idprof3', 'alpha'); + $object->idprof4 = GETPOST('idprof4', 'alpha'); + $object->idprof5 = GETPOST('idprof5', 'alpha'); + $object->idprof6 = GETPOST('idprof6', 'alpha'); + $object->typent_id = GETPOST('typent_id', 'int'); + $object->effectif_id = GETPOST('effectif_id', 'int'); + $object->barcode = GETPOST('barcode', 'alpha'); + $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); + $object->default_lang = GETPOST('default_lang', 'alpha'); + + $object->tva_assuj = GETPOST('assujtva_value', 'int'); + $object->tva_intra = GETPOST('tva_intra', 'alpha'); + $object->status = GETPOST('status', 'int'); + + // Webservices url/key + $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); + $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); + + //Incoterms + if (!empty($conf->incoterm->enabled)) + { + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); + } + + //Local Taxes + $object->localtax1_assuj = GETPOST('localtax1assuj_value'); + $object->localtax2_assuj = GETPOST('localtax2assuj_value'); + + $object->localtax1_value =GETPOST('lt1'); + $object->localtax2_value =GETPOST('lt2'); + + // We set country_id, and country_code label of the chosen country + if ($object->country_id > 0) + { + $tmparray=getCountry($object->country_id, 'all'); + $object->country_code = $tmparray['code']; + $object->country = $tmparray['label']; + } + } + + if($object->localtax1_assuj==0){ + $sub=0; + }else{$sub=1;} + if($object->localtax2_assuj==0){ + $sub2=0; + }else{$sub2=1;} + + if ($conf->use_javascript_ajax) + { + print "\n".''."\n"; + } + + print '
'; print ''; - print ''; + print ''; + print ''; + print ''; + if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; + + dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); + + print '
'; print ''; - // Ref - print ""; - print ''; + // Ref/ID + if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) + { + print ''; + } // Name - print ''; + print ''; + + // Alias names (commercial, trademark or alias names) + print ''; + print ''; + + // Prefix + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + { + print ''; + } + + // Prospect/Customer + print ''; + print ''; + print ''; - // Address - print ''; - print ''; + // Supplier + if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) + { + print ''; + print ''; + print ''; + } - // Zipcode / Town - print ''; - print ''; + // Barcode + if (! empty($conf->barcode->enabled)) + { + print ''; + print ''; + } - // Country - print ''; - print ''; - print ''; + // Status + print ''; - // Status - print ''; + // Address + print ''; + print ''; + + // Zip / Town + print ''; + + // Country + print ''; + + // State + if (empty($conf->global->SOCIETE_DISABLE_STATE)) + { + if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) + { + print ''; + } + + // EMail / Web + print ''; + print ''; + print ''; + print ''; + + if (! empty($conf->socialnetworks->enabled)) + { + // Skype + if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) + { + print ''; + print ''; + } + // Twitter + if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) + { + print ''; + print ''; + } + // Facebook + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } + } + + // Phone / Fax + print ''; + print ''; + print ''; + print ''; + + // Prof ids + $i=1; $j=0; + while ($i <= 6) + { + $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof!='-') + { + $key='idprof'.$i; + + if (($j % 2) == 0) print ''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + print ''; + if (($j % 2) == 1) print ''; + $j++; + } + $i++; + } + if ($j % 2 == 1) print ''; + + // VAT is used + print ''; + + // Local Taxes + //TODO: Place into a function to control showing by country or study better option + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + { + print ''; + + print ''; + } + elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") + { + print ''; + } + elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") + { + print ''; + } + + // VAT Code + print ''; + print ''; + print ''; + + // Type - Size + print ''; + print ''; + + // Juridical type + print ''; + + // Capital + print ''; + print ''; + + // Default language + if (! empty($conf->global->MAIN_MULTILANGS)) + { + print ''; + print ''; + } + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + print ''; + } + + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + print ''; + print '"; + + // Supplier + print ''; + print '"; + } + + // Multicurrency + if (! empty($conf->multicurrency->enabled)) + { + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + + // Webservices url/key + if (!empty($conf->syncsupplierwebservices->enabled)) { + print ''; + print ''; + print ''; + print ''; + } + + // Logo + print ''; + print ''; + print ''; + print ''; + + // Assign sale representative + print ''; + print ''; + print ''; print '
'.$langs->trans("Ref").''; - print $object->id; - print '
'.$langs->trans("ID").''; + print $object->ref; + print '
'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; - print ''; + print '
'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).'
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; + // It does not change the prefix mode using the auto numbering prefix + if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) + { + print ''; + print $object->prefix_comm; + } + else + { + print ''; + } + print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; + print $formcompany->selectProspectCustomerType($object->client); + print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; + + print '
'; + if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) + { + $tmpcode=$object->code_client; + if (empty($tmpcode) && ! empty($object->oldcopy->code_client)) $tmpcode=$object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. + if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object, 0); + print ''; + } + elseif ($object->codeclient_modifiable()) + { + print ''; + } + else + { + print $object->code_client; + print ''; + } + print ''; + $s=$modCodeClient->getToolTip($langs, $object, 0); + print $form->textwithpicto('', $s, 1); + print '
'; + print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; - print ''; - print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; + print $form->selectyesno("fournisseur", $object->fournisseur, 1); + print ''; + if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + { + print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); + } + print ''; + if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + { + print '
'; + if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) + { + $tmpcode=$object->code_fournisseur; + if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. + if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object, 1); + print ''; + } + elseif ($object->codefournisseur_modifiable()) + { + print ''; + } + else + { + print $object->code_fournisseur; + print ''; + } + print ''; + $s=$modCodeFournisseur->getToolTip($langs, $object, 1); + print $form->textwithpicto('', $s, 1); + print '
'; + } + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; -print $formcompany->select_ziptown($object->zip, 'zipcode', array ( - 'town', - 'selectcountry_id' - ), 6) . '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; -print $formcompany->select_ziptown($object->town, 'town', array ( - 'zipcode', - 'selectcountry_id' - )) . '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; + print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; - print $form->select_country($object->fk_country, 'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; + print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->status); + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0, 'string', '', 1).''; - print $form->selectarray('status', $status2label, $object->status); - print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone'); + print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; + print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id), 'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; + } + else + { + print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; + } + + print $formcompany->select_state($object->state_id, $object->country_code); + print '
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', ! (empty($conf->global->$idprof_mandatory) || ! $object->isACompany())).''; + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); + print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; + print $form->selectyesno('assujtva_value', $object->tva_assuj, 1); + print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; + print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); + if(! isOnlyOneLocalTax(1)) + { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''; + } + print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; + print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); + if (! isOnlyOneLocalTax(2)) + { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''; + } + print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; + print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); + if(! isOnlyOneLocalTax(1)) + { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''; + } + print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; + print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); + if(! isOnlyOneLocalTax(2)) + { + print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''; + } + print '
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; + $s =''; + + if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) + { + $s.='   '; + + if ($conf->use_javascript_ajax) + { + print "\n"; + print ''; + print "\n"; + $s.=''.$langs->trans("VATIntraCheck").''; + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + } + else + { + $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + } + } + print $s; + print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; + print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); + print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '.$langs->trans("Currency".$conf->currency).'
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; + print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1); + print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); + print '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); + $arrayselected=array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print "
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); + $arrayselected=array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); + print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); + print '
'.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).'
'.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; + if ($object->logo) print $form->showphoto('societe', $object); + $caneditfield=1; + if ($caneditfield) + { + if ($object->logo) print "
\n"; + print ''; + if ($object->logo) print ''; + //print ''; + print ''; + print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; + } + print '
'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; + $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); + $arrayselected = GETPOST('commercial', 'array'); + if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1); + print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%"); + print '
'; + print '
'; - dol_fiche_end(); + dol_fiche_end(); - print '
'; - print ''; - print '     '; - print ''; + print '
'; + print ''; + print '     '; + print ''; print '
'; print ''; } } - else dol_print_error($db); -} - -if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) -{ - $res = $object->fetch_optionals(); - - $head = establishment_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("Establishment"), -1, 'building'); - - // Confirmation to delete - if ($action == 'delete') + else { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteEstablishment"), $langs->trans("ConfirmDeleteEstablishment"), "confirm_delete"); + /* + * View + */ + + if (!empty($object->id)) $res=$object->fetch_optionals(); + //if ($res < 0) { dol_print_error($db); exit; } + + + $head = societe_prepare_head($object); + + dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), -1, 'company'); + + // Confirm delete third party + if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) + { + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete"); + } + + if ($action == 'merge') + { + $formquestion = array( + array( + 'name' => 'soc_origin', + 'label' => $langs->trans('MergeOriginThirdparty'), + 'type' => 'other', + 'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth200') + ) + ); + + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 250); + } + + dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); + + + print '
'; + print '
'; + + print '
'; + print ''; + + // Prospect/Customer + print ''; + + // Supplier + if (! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)) + { + print ''; + } + + // Prefix + if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + { + print ''; + print $htmllogobar; $htmllogobar=''; + print ''; + } + + // Customer code + if ($object->client) + { + print ''; + print $htmllogobar; $htmllogobar=''; + print ''; + } + + // Supplier code + if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) + { + print ''; + print $htmllogobar; $htmllogobar=''; + print ''; + } + + // Barcode + if (! empty($conf->barcode->enabled)) + { + print ''; + if ($htmllogobar) $htmllogobar.=$form->showbarcode($object); + print $htmllogobar; + $htmllogobar=''; + print ''; + } + + // Prof ids + $i=1; $j=0; + while ($i <= 6) + { + $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof!='-') + { + //if (($j % 2) == 0) print ''; + print ''; + print ''; + //if (($j % 2) == 1) print ''; + print ''; + $j++; + } + $i++; + } + //if ($j % 2 == 1) print ''; + + + // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier. + // We don't need them into customer profile. + // Except for spain and localtax where localtax depends on buyer and not seller + + if ($object->fournisseur) + { + // VAT is used + print ''; + print ''; + } + + // Local Taxes + if ($object->fournisseur || $mysoc->country_code=='ES') + { + if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + { + print ''; + + if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) + { + print ''; + print ''; + print ''; + print ''; + if($action == 'editRE') + { + print ''; + } + else + { + print ''; + } + print ''; + } + if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) + { + print ''; + print ''; + print ''; + print ''; + if($action == 'editIRPF'){ + print ''; + }else{ + print ''; + } + print ''; + } + } + elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") + { + print ''; + if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) + { + print ''; + print ''; + print ''; + print ''; + if($action == 'editRE'){ + print ''; + }else{ + print ''; + } + print ''; + } + } + elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") + { + print ''; + if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) + { + + print ''; + print ''; + print ''; + print ''; + if($action == 'editIRPF'){ + print ''; + }else{ + print ''; + } + print ''; + } + } + } + + // Sale tax code (VAT code) + print ''; + print ''; + print ''; + + // Type + Staff + $arr = $formcompany->typent_array(1); + $object->typent= $arr[$object->typent_code]; + print ''; + print ''; + + print '
'.$langs->trans('ProspectCustomer').''; + print $object->getLibCustProspStatut(); + print '
'.$langs->trans('Supplier').''; + print yn($object->fournisseur); + print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print $langs->trans('CustomerCode').''; + print $object->code_client; + if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; + print '
'; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print '
'; + print $langs->trans('Gencod').''.$object->barcode; + print '
'.$idprof.''; + $key='idprof'.$i; + print $object->$key; + if ($object->$key) + { + if ($object->id_prof_check($i, $object) > 0) print '   '.$object->id_prof_url($i, $object); + else print ' ('.$langs->trans("ErrorWrongValue").')'; + } + print '
'; + print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling')); + print ''; + print yn($object->tva_assuj); + print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print yn($object->localtax1_assuj); + print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''.$object->localtax1_value.'
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; + print yn($object->localtax1_assuj); + print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); + print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; + print yn($object->localtax2_assuj); + print '
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; + $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); + print ''.$object->localtax2_value.'
'.$langs->trans('VATIntra').''; + if ($object->tva_intra) + { + $s=''; + $s.=$object->tva_intra; + $s.=''; + + if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) + { + $s.='   '; + + if ($conf->use_javascript_ajax) + { + print "\n"; + print ''; + print "\n"; + $s.=''.$langs->trans("VATIntraCheck").''; + $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); + } + else + { + $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + } + } + print $s; + } + else + { + print ' '; + } + print '
'.$langs->trans("ThirdPartyType").''.$object->typent.'
'.$langs->trans("Staff").''.$object->effectif.'
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Tags / categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + // Customer + if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { + print ''; + print '"; + } + + // Supplier + if ($object->fournisseur) { + print ''; + print '"; + } + } + + // Legal + print ''; + + // Capital + print ''; + + // Default language + if (! empty($conf->global->MAIN_MULTILANGS)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print ''; + } + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print ''; + } + + // Multicurrency + if (! empty($conf->multicurrency->enabled)) + { + print ''; + print ''; + print ''; + } + + // Other attributes + $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + // Parent company + if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) + { + // Payment term + print ''; + print ''; + } + + // Sales representative + include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; + + // Module Adherent + if (! empty($conf->adherent->enabled)) + { + $langs->load("members"); + print ''; + print ''; + print "\n"; + } + + // Webservices url/key + if (!empty($conf->syncsupplierwebservices->enabled)) { + print ''; + print ''; + } + + print '
' . $langs->trans("CustomersCategoriesShort") . ''; + print $form->showCategories($object->id, 'customer', 1); + print "
' . $langs->trans("SuppliersCategoriesShort") . ''; + print $form->showCategories($object->id, 'supplier', 1); + print "
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; + if ($object->capital) print price($object->capital, '', $langs, 0, -1, -1, $conf->currency); + else print ' '; + print '
'.$langs->trans("DefaultLang").''; + //$s=picto_from_langcode($object->default_lang); + //print ($s?$s.' ':''); + $langs->load("languages"); + $labellang = ($object->default_lang?$langs->trans('Language_'.$object->default_lang):''); + print $labellang; + print '
'; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->societe->creer) print ''.img_edit('', 1).''; + else print ' '; + print '
'; + print '
'; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id); + } + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code, 1) : ''; + print '
'; + print ''; + if ($action != 'editparentcompany') print ''; + print '
'; + print $langs->trans('ParentCompany'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; + print '
'; + if ($action == 'editparentcompany') + { + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'editparentcompany', 's.rowid <> '.$object->id, 1); + } + else + { + $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'none', 's.rowid <> '.$object->id, 1); + } + print '
'.$langs->trans("LinkedToDolibarrMember").''; + $adh=new Adherent($db); + $result=$adh->fetch('', '', $object->id); + if ($result > 0) + { + $adh->ref=$adh->getFullName($langs); + print $adh->getNomUrl(1); + } + else + { + print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; + } + print '
'.$langs->trans("WebServiceURL").''.dol_print_url($object->webservices_url).''.$langs->trans('WebServiceKey').''.$object->webservices_key.'
'; + print '
'; + + print '
'; + print '
'; + + dol_fiche_end(); + + + /* + * Actions + */ + if ($action != 'presend') + { + print '
'."\n"; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) + { + $at_least_one_email_contact = false; + $TContact = $object->contact_array_objects(); + foreach ($TContact as &$contact) + { + if (!empty($contact->email)) + { + $at_least_one_email_contact = true; + break; + } + } + + if (! empty($object->email) || $at_least_one_email_contact) + { + $langs->load("mails"); + print ''; + } + else + { + $langs->load("mails"); + print ''; + } + + if ($user->rights->societe->creer) + { + print ''."\n"; + } + + if ($user->rights->societe->supprimer) + { + print ''; + } + + if ($user->rights->societe->supprimer) + { + if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile + { + print '
'.$langs->trans('Delete').'
'."\n"; + } + else + { + print ''."\n"; + } + } + } + + print '
'."\n"; + } + + //Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + + if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) + { + print ''; // ancre + + /* + * Documents generes + */ + $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; + $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; + $genallowed=$user->rights->societe->lire; + $delallowed=$user->rights->societe->creer; + + print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); + } + + // Subsidiaries list + if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) + { + $result=show_subsidiaries($conf, $langs, $db, $object); + } + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty + + print '
'; + + if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) + { + // Contacts list + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) + { + $result=show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); + } + + // Addresses list + if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) + { + $result=show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); + } + } + } + + // Presend form + $modelmail='thirdparty'; + $defaulttopic='Information'; + $diroutput = $conf->societe->dir_output; + $trackid = 'thi'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } - - - // Object card - // ------------------------------------------------------------ - - $linkback = '' . $langs->trans("BackToList") . ''; - - $morehtmlref='
'; - $morehtmlref.='
'; - - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', $morehtmlref); - - - print '
'; - //print '
'; - print '
'; - print ''."\n"; - - // Name - print ''; - print ''; - print ''; - print ''; - - // Address - print ''; - print ''; - print ''; - print ''; - - // Zipcode - print ''; - print ''; - print ''; - print ''; - - // Town - print ''; - print ''; - print ''; - print ''; - - // Country - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Name").''.$object->name.'
'.$langs->trans("Address").''.$object->address.'
'.$langs->trans("Zipcode").''.$object->zip.'
'.$langs->trans("Town").''.$object->town.'
'.$langs->trans("Country").''; - if ($object->country_id > 0) - { - $img=picto_from_langcode($object->country_code); - print $img?$img.' ':''; - print getCountry($object->getCountryCode(), 0, $db); - } - print '
'; - print '
'; - - print '

'; - - dol_fiche_end(); - - /* - * Barre d'actions - */ - - print '
'; - print ''.$langs->trans('Modify').''; - print ''.$langs->trans('Delete').''; - print '
'; } // End of page From 0e7ed6d1696998505d385d35e5ddc82d36d24d43 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 26 Feb 2019 18:45:53 +0100 Subject: [PATCH 151/190] Add parent company --- htdocs/hrm/class/establishment.class.php | 64 +++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 5759d567761..ec579132f44 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -208,6 +208,7 @@ class Establishment extends CommonObject $sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null'); $sql .= ", status = ".$this->db->escape($this->status); $sql .= ", fk_user_mod = " . $user->id; + $sql .= ", entity = " . $this->entity; $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); @@ -230,7 +231,7 @@ class Establishment extends CommonObject */ function fetch($id) { - $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id,"; + $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status, e.fk_country as country_id, e.entity,"; $sql.= ' c.code as country_code, c.label as country'; $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON e.fk_country = c.rowid'; @@ -249,6 +250,7 @@ class Establishment extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; $this->status = $obj->status; + $this->entity = $obj->entity; $this->country_id = $obj->country_id; $this->country_code = $obj->country_code; @@ -352,7 +354,7 @@ class Establishment extends CommonObject */ function info($id) { - $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod'; + $sql = 'SELECT e.rowid, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; $sql.= ' WHERE e.rowid = '.$id; @@ -389,6 +391,37 @@ class Establishment extends CommonObject dol_print_error($this->db); } } + + /** + * Get on record Establishment + * + * @param int $id Id of record + * @return obj + */ + function getEstablishment($id) + { + $sql = 'SELECT e.rowid, e.name, e.datec, e.fk_user_author, e.tms, e.fk_user_mod, e.entity'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'establishment as e'; + $sql.= ' WHERE e.rowid = '.$id; + + dol_syslog(get_class($this)."::fetch info", LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + } + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + + return $obj; + } /** * Return clicable name (with picto eventually) @@ -414,6 +447,33 @@ class Establishment extends CommonObject if ($withpicto != 2) $result.=$link.$this->name.$linkend; return $result; } + + /** + * Return clicable name (with picto eventually) + * + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @return string String with URL + */ + function getNomUrlParent($id = 0, $withpicto = 0) + { + global $langs; + + $result=''; + + $obj = $this->getEstablishment(($id>0)?$id:$conf->entity); + + $link = ''; + $linkend=''; + + $picto='building'; + + $label=$langs->trans("Show").': '.$obj->name; + + if ($withpicto) $result.=($link.img_object($label, $picto).$linkend); + if ($withpicto && $withpicto != 2) $result.=' '; + if ($withpicto != 2) $result.=$link.$obj->name.$linkend; + return $result; + } /** * Return account country code From a706710f44f945c1e8c736f801fac2e6dbc32523 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 26 Feb 2019 18:46:30 +0100 Subject: [PATCH 152/190] Add parent company --- htdocs/hrm/admin/admin_establishment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 4ea0b76a9d4..ee2f69a6d39 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -78,7 +78,7 @@ dol_fiche_head($head, 'establishments', $langs->trans("HRM"), -1, "user"); $sql = "SELECT e.rowid, e.name, e.address, e.zip, e.town, e.status"; $sql.= " FROM ".MAIN_DB_PREFIX."establishment as e"; -$sql.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE 1 = 1"; $sql.= $db->order($sortfield, $sortorder); $sql.= $db->plimit($limit+1, $offset); From 9e82c37963d8ab72fdc8672dfb8f819a8de1f302 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Feb 2019 19:27:04 +0100 Subject: [PATCH 153/190] WIP Start module BOM --- htdocs/bom/admin/setup.php | 146 ++ htdocs/bom/bom_card.php | 471 +++++++ htdocs/bom/bom_document.php | 166 +++ htdocs/bom/bom_list.php | 596 ++++++++ htdocs/bom/bom_note.php | 164 +++ htdocs/bom/class/api_bom.class.php | 324 +++++ htdocs/bom/class/bom.class.php | 1208 +++++++++++++++++ htdocs/bom/lib/bom.lib.php | 125 ++ htdocs/bom/modulebuilder.txt | 3 + htdocs/core/menus/standard/eldy.lib.php | 33 + htdocs/core/modules/modBom.class.php | 374 +++++ .../install/mysql/migration/9.0.0-10.0.0.sql | 61 + .../install/mysql/tables/llx_bom_bom.key.sql | 28 + htdocs/install/mysql/tables/llx_bom_bom.sql | 34 + .../mysql/tables/llx_bom_bom_extrafields.sql | 23 + .../mysql/tables/llx_bom_bomline.key.sql | 26 + .../install/mysql/tables/llx_bom_bomline.sql | 27 + .../tables/llx_bom_bomline_extrafields.sql | 23 + test/phpunit/BillOfMaterialsTest.php | 110 ++ 19 files changed, 3942 insertions(+) create mode 100644 htdocs/bom/admin/setup.php create mode 100644 htdocs/bom/bom_card.php create mode 100644 htdocs/bom/bom_document.php create mode 100644 htdocs/bom/bom_list.php create mode 100644 htdocs/bom/bom_note.php create mode 100644 htdocs/bom/class/api_bom.class.php create mode 100644 htdocs/bom/class/bom.class.php create mode 100644 htdocs/bom/lib/bom.lib.php create mode 100644 htdocs/bom/modulebuilder.txt create mode 100644 htdocs/core/modules/modBom.class.php create mode 100644 htdocs/install/mysql/tables/llx_bom_bom.key.sql create mode 100644 htdocs/install/mysql/tables/llx_bom_bom.sql create mode 100644 htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql create mode 100644 htdocs/install/mysql/tables/llx_bom_bomline.key.sql create mode 100644 htdocs/install/mysql/tables/llx_bom_bomline.sql create mode 100644 htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql create mode 100644 test/phpunit/BillOfMaterialsTest.php diff --git a/htdocs/bom/admin/setup.php b/htdocs/bom/admin/setup.php new file mode 100644 index 00000000000..ed8ee70d652 --- /dev/null +++ b/htdocs/bom/admin/setup.php @@ -0,0 +1,146 @@ + + * Copyright (C) 2019 Maxime Kohlhaas + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom/admin/setup.php + * \ingroup bom + * \brief Bom setup page. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +global $langs, $user; + +// Libraries +require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; +require_once '../lib/bom.lib.php'; +//require_once "../class/myclass.class.php"; + +// Translations +$langs->loadLangs(array("admin", "bom@bom")); + +// Access control +if (! $user->admin) accessforbidden(); + +// Parameters +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +$arrayofparameters=array( + 'BILLOFMATERIALS_MYPARAM1'=>array('css'=>'minwidth200','enabled'=>1), + 'BILLOFMATERIALS_MYPARAM2'=>array('css'=>'minwidth500','enabled'=>1) +); + + +/* + * Actions + */ +if ((float) DOL_VERSION >= 6) +{ + include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +} + + +/* + * View + */ + +$page_name = "BomSetup"; +llxHeader('', $langs->trans($page_name)); + +// Subheader +$linkback = ''.$langs->trans("BackToModuleList").''; + +print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom@bom'); + +// Configuration header +$head = bomAdminPrepareHead(); +dol_fiche_head($head, 'settings', '', -1, "bom@bom"); + +// Setup page goes here +echo $langs->trans("BomSetupPage").'

'; + + +if ($action == 'edit') +{ + print '
'; + print ''; + print ''; + + print ''; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); + print '
'; + + print '
'; + print ''; + print '
'; + + print '
'; + print '
'; +} +else +{ + if (! empty($arrayofparameters)) + { + print ''; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); + print '' . $conf->global->$key . '
'; + + print '
'; + print ''.$langs->trans("Modify").''; + print '
'; + } + else + { + print '
'.$langs->trans("NothingToSetup"); + } +} + + +// Page end +dol_fiche_end(); + +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php new file mode 100644 index 00000000000..7b258579819 --- /dev/null +++ b/htdocs/bom/bom_card.php @@ -0,0 +1,471 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_card.php + * \ingroup bom + * \brief Page to create/edit/view bom + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. +//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies + + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/bom/class/bom.class.php'); +dol_include_once('/bom/lib/bom_bom.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bomcard'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object=new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomcard','globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options=$extrafields->getOptionalsFromPost($object->table_element,'','search_'); + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all",'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); +} + +if (empty($action) && empty($id) && empty($ref)) $action='view'; + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0); +//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); + + +/* + * Actions + * + * Put here all code to do according to value of "action" parameter + */ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + $error=0; + + $permissiontoadd = $user->rights->bom->write; + $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); + $backurlforlist = dol_buildpath('/bom/bom_list.php',1); + if (empty($backtopage)) { + if (empty($id)) $backtopage = $backurlforlist; + else $backtopage = dol_buildpath('/bom/bom_card.php',1).($id > 0 ? $id : '__ID__'); + } + $triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record + + // Actions cancel, add, update, delete or clone + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + + // Actions to send emails + $trigger_name='BILLOFMATERIALS_SENTBYMAIL'; + $autocopy='MAIN_MAIL_AUTOCOPY_BILLOFMATERIALS_TO'; + $trackid='bom'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; +} + + + + +/* + * View + * + * Put here all code to build page + */ + +$form=new Form($db); +$formfile=new FormFile($db); + +llxHeader('','BillOfMaterials',''); + +// Example : Adding jquery code +print ''; + + +// Part to create +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("BillOfMaterials"))); + + print '
'; + print ''; + print ''; + print ''; + + dol_fiche_head(array(), ''); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + + print '
'."\n"; + + dol_fiche_end(); + + print '
'; + print ''; + print '  '; + print ''; // Cancel for create does not post form if we don't know the backtopage + print '
'; + + print '
'; +} + +// Part to edit record +if (($id || $ref) && $action == 'edit') +{ + print load_fiche_titre($langs->trans("BillOfMaterials")); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + dol_fiche_head(); + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + dol_fiche_end(); + + print '
'; + print '   '; + print '
'; + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = bomPrepareHead($object); + dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); + + $formconfirm = ''; + + // Confirmation to delete + if ($action == 'delete') + { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1); + } + + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneBillOfMaterials'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + + // Confirmation of action xxxx + if ($action == 'xxx') + { + $formquestion=array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + } + + // Call Hook formConfirm + $parameters = array('lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref bis + $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->bom->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->bom->write) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(); + } else { + $morehtmlref.=''; + } + } + } + */ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswithonsecondcolumn'; + include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + + print '
'; + print '
'; + print '
'; + + print '

'; + + dol_fiche_end(); + + + // Buttons for actions + if ($action != 'presend' && $action != 'editline') { + print '
'."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + if (empty($reshook)) + { + // Send + print '' . $langs->trans('SendMail') . ''."\n"; + + // Modify + if ($user->rights->bom->write) + { + print ''.$langs->trans("Modify").''."\n"; + } + else + { + print ''.$langs->trans('Modify').''."\n"; + } + + // Clone + if ($user->rights->bom->write) + { + print ''; + } + + /* + if ($user->rights->bom->write) + { + if ($object->status == 1) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + */ + + if ($user->rights->bom->delete) + { + print ''.$langs->trans('Delete').''."\n"; + } + else + { + print ''.$langs->trans('Delete').''."\n"; + } + } + print '
'."\n"; + } + + + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } + + if ($action != 'presend') + { + print '
'; + print ''; // ancre + + // Documents + /*$objref = dol_sanitizeFileName($object->ref); + $relativepath = $comref . '/' . $comref . '.pdf'; + $filedir = $conf->bom->dir_output . '/' . $objref; + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->bom->create; // If you can create/edit, you can remove a file on card + print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + */ + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + + print '
'; + + $MAXEVENT = 10; + + $morehtmlright = ''; + $morehtmlright.= $langs->trans("SeeAll"); + $morehtmlright.= ''; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright); + + print '
'; + } + + //Select mail models is same action as presend + /* + if (GETPOST('modelselected')) $action = 'presend'; + + // Presend form + $modelmail='inventory'; + $defaulttopic='InformationMessage'; + $diroutput = $conf->product->dir_output.'/inventory'; + $trackid = 'stockinv'.$object->id; + + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + */ +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php new file mode 100644 index 00000000000..9c508408f53 --- /dev/null +++ b/htdocs/bom/bom_document.php @@ -0,0 +1,166 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_document.php + * \ingroup bom + * \brief Tab for documents linked to BillOfMaterials + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +dol_include_once('/bom/class/bom.class.php'); +dol_include_once('/bom/lib/bom_bom.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","companies","other","mails")); + + +$action=GETPOST('action','aZ09'); +$confirm=GETPOST('confirm'); +$id=(GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int')); +$ref = GETPOST('ref', 'alpha'); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'bom', $id); + +// Get parameters +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="name"; +//if (! $sortfield) $sortfield="position_name"; + +// Initialize technical objects +$object=new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomdocument','globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals + +//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->id); +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/bom/" . dol_sanitizeFileName($object->ref); + + +/* + * Actions + */ + +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; + + +/* + * View + */ + +$form = new Form($db); + +$title=$langs->trans("BillOfMaterials").' - '.$langs->trans("Files"); +$help_url=''; +//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('', $title, $help_url); + +if ($object->id) +{ + /* + * Show tabs + */ + $head = bomPrepareHead($object); + + dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); + + + // Build file list + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $totalsize=0; + foreach($filearray as $key => $file) + { + $totalsize+=$file['size']; + } + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + + print '
'; + print ''; + + // Number of files + print ''; + + // Total size + print ''; + + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + + print '
'; + + dol_fiche_end(); + + $modulepart = 'bom'; + //$permission = $user->rights->bom->create; + $permission = 1; + //$permtoedit = $user->rights->bom->create; + $permtoedit = 1; + $param = '&id=' . $object->id; + + //$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/'; + $relativepathwithnofile='bom/' . dol_sanitizeFileName($object->ref).'/'; + + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; +} +else +{ + accessforbidden('',0,0); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php new file mode 100644 index 00000000000..f96f1bf1beb --- /dev/null +++ b/htdocs/bom/bom_list.php @@ -0,0 +1,596 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_list.php + * \ingroup bom + * \brief List page for bom + */ + +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs +//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters +//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters +//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). +//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) +//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data +//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php +//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library +//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) +//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value +//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler +//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message +//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +dol_include_once('/bom/class/bom.class.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","other")); + +$action = GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm','alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'bomlist'; // To manage different context of search +$backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print') + +$id = GETPOST('id','int'); + +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +//if (! $sortfield) $sortfield="p.date_fin"; +//if (! $sortorder) $sortorder="DESC"; + +// Initialize technical objects +$object = new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); // Load $extrafields->attributes['bom'] +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,'','search_'); + +// Default sort order (if not yet defined by previous GETPOST) +if (! $sortfield) $sortfield="t.".key($object->fields); // Set here default search field. By default 1st field in definition. +if (! $sortorder) $sortorder="ASC"; + +// Security check +$socid=0; +if ($user->societe_id > 0) // Protection if external user +{ + //$socid = $user->societe_id; + accessforbidden(); +} +//$result = restrictedArea($user, 'bom', $id, ''); + +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all",'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); +} + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array(); +foreach($object->fields as $key => $val) +{ + if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label']; +} + +// Definition of fields for list +$arrayfields=array(); +foreach($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']); +} +// Extra fields +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +{ + foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } +} +$object->fields = dol_sort_array($object->fields, 'position'); +$arrayfields = dol_sort_array($arrayfields, 'position'); + + + +/* + * Actions + */ + +if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers + { + foreach($object->fields as $key => $val) + { + $search[$key]=''; + } + $toselect=''; + $search_array_options=array(); + } + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + $objectclass='BillOfMaterials'; + $objectlabel='BillOfMaterials'; + $permtoread = $user->rights->bom->read; + $permtodelete = $user->rights->bom->delete; + $uploaddir = $conf->bom->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; +} + + + +/* + * View + */ + +$form=new Form($db); + +$now=dol_now(); + +//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials"; +$help_url=''; +$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("BillOfMaterialss")); + + +// Build and execute select +// -------------------------------------------------------------------- +$sql = 'SELECT '; +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/','', $sql); +$sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; +if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; +else $sql.=" WHERE 1 = 1"; +foreach($search as $key => $val) +{ + if ($key == 'status' && $search[$key] == -1) continue; + $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0); + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); +} +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + +/* If a group by is required +$sql.= " GROUP BY " +foreach($object->fields as $key => $val) +{ + $sql.='t.'.$key.', '; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/','', $sql); +*/ + +$sql.=$db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) +{ + $num = $nbtotalofrecords; +} +else +{ + $sql.= $db->plimit($limit+1, $offset); + + $resql=$db->query($sql); + if (! $resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); +} + +// Direct jump if only one record found +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".dol_buildpath('/bom/bom_card.php', 1).'?id='.$id); + exit; +} + + +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $title, $help_url); + +// Example : Adding jquery code +print ''; + +$arrayofselected=is_array($toselect)?$toselect:array(); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); +foreach($search as $key => $val) +{ + $param.= '&search_'.$key.'='.urlencode($search[$key]); +} +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// List of mass actions available +$arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), +); +if ($user->rights->bom->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$newcardbutton=''; +//if ($user->rights->bom->creer) +//{ + $newcardbutton=''.$langs->trans('New').''; + $newcardbutton.= ''; + $newcardbutton.= ''; +//} +//else +//{ +// $newcardbutton=''.$langs->trans('New'); +// $newcardbutton.= ''; +// $newcardbutton.= ''; +//} + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail="SendBillOfMaterialsRef"; +$modelmail="bom"; +$objecttmp=new BillOfMaterials($db); +$trackid='xxxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($sall) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; +} + +$moreforfilter = ''; +/*$moreforfilter.='
'; +$moreforfilter.= $langs->trans('MyFilter') . ': '; +$moreforfilter.= '
';*/ + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + +if (! empty($moreforfilter)) +{ + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + + +// Fields title search +// -------------------------------------------------------------------- +print ''; +foreach($object->fields as $key => $val) +{ + $cssforfield=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) print ''; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print ''; +print ''."\n"; + + +// Fields title label +// -------------------------------------------------------------------- +print ''; +foreach($object->fields as $key => $val) +{ + $cssforfield=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; + } +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; +print ''."\n"; + + +// Detect if we need a fetch on each output line +$needToFetchEachLine=0; +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } +} + + +// Loop on record +// -------------------------------------------------------------------- +$i=0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + // Store properties in $object + $object->id = $obj->rowid; + foreach($object->fields as $key => $val) + { + if (isset($obj->$key)) $object->$key = $obj->$key; + } + + // Show here line of result + print ''; + foreach($object->fields as $key => $val) + { + $cssforfield=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + + if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; + + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + print $object->showOutputField($val, $key, $obj->$key, ''); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; + $totalarray['val']['t.'.$key] += $obj->$key; + } + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''; + + $i++; +} + +// Show total line +if (isset($totalarray['pos'])) +{ + print ''; + $i=0; + while ($i < $totalarray['nbfield']) + { + $i++; + if (! empty($totalarray['pos'][$i])) print ''; + else + { + if ($i == 1) + { + if ($num < $limit) print ''; + else print ''; + } + else print ''; + } + } + print ''; +} + +// If no record found +if ($num == 0) +{ + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; +} + + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; +print '
'; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").'
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print '
'."\n"; + +if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) +{ + $hidegeneratedfilelistifempty=1; + if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0; + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + $formfile = new FormFile($db); + + // Show list of available documents + $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; + $urlsource.=str_replace('&','&',$param); + + $filedir=$diroutputmassaction; + $genallowed=$user->rights->bom->read; + $delallowed=$user->rights->bom->create; + + print $formfile->showdocuments('massfilesarea_bom','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php new file mode 100644 index 00000000000..58d73a3582a --- /dev/null +++ b/htdocs/bom/bom_note.php @@ -0,0 +1,164 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom_note.php + * \ingroup bom + * \brief Car with notes on BillOfMaterials + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; +if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; +if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; +if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; +if (! $res) die("Include of main fails"); + +dol_include_once('/bom/class/bom.class.php'); +dol_include_once('/bom/lib/bom_bom.lib.php'); + +// Load translation files required by the page +$langs->loadLangs(array("bom@bom","companies")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$backtopage = GETPOST('backtopage', 'alpha'); + +// Initialize technical objects +$object=new BillOfMaterials($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('bom'); + +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'bom', $id); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity] . "/" . $object->id; + +$permissionnote=1; +//$permissionnote=$user->rights->bom->creer; // Used by the include of actions_setnotes.inc.php + + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + + +/* + * View + */ + +$form = new Form($db); + +//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'; +$help_url=''; +llxHeader('',$langs->trans('BillOfMaterials'),$help_url); + +if ($id > 0 || ! empty($ref)) +{ + $object->fetch_thirdparty(); + + $head = bomPrepareHead($object); + + dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); + + // Object card + // ------------------------------------------------------------ + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + /* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->bom->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + }*/ + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + dol_fiche_end(); +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/bom/class/api_bom.class.php b/htdocs/bom/class/api_bom.class.php new file mode 100644 index 00000000000..096d171bfd4 --- /dev/null +++ b/htdocs/bom/class/api_bom.class.php @@ -0,0 +1,324 @@ + + * Copyright (C) 2019 Maxime Kohlhaas + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +use Luracast\Restler\RestException; + +dol_include_once('/bom/class/bom.class.php'); + + + +/** + * \file bom/class/api_bom.class.php + * \ingroup bom + * \brief File for API management of bom. + */ + +/** + * API class for bom bom + * + * @smart-auto-routing false + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class BillOfMaterialsApi extends DolibarrApi +{ + /** + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'name', + ); + + + /** + * @var BillOfMaterials $bom {@type BillOfMaterials} + */ + public $bom; + + /** + * Constructor + * + * @url GET / + * + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->bom = new BillOfMaterials($this->db); + } + + /** + * Get properties of a bom object + * + * Return an array with bom informations + * + * @param int $id ID of bom + * @return array|mixed data without useless information + * + * @url GET boms/{id} + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->bom->read) { + throw new RestException(401); + } + + $result = $this->bom->fetch($id); + if( ! $result ) { + throw new RestException(404, 'BillOfMaterials not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('bom',$this->bom->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->bom); + } + + + /** + * List boms + * + * Get a list of boms + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of order objects + * + * @throws RestException + * + * @url GET /boms/ + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + global $db, $conf; + + $obj_ret = array(); + + $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + + $restictonsocid = 0; // Set to 1 if there is a field socid in table of object + + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if ($restictonsocid && ! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."bom_mytable as t"; + + if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + $sql.= " WHERE 1 = 1"; + + // Example of use $mode + //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; + //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; + + $tmpobject = new BillOfMaterials($db); + if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')'; + if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid; + if ($restictonsocid && $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + // Insert sale filter + if ($restictonsocid && $search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < $num) + { + $obj = $db->fetch_object($result); + $bom_static = new BillOfMaterials($db); + if($bom_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($bom_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve bom list'); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No bom found'); + } + return $obj_ret; + } + + /** + * Create bom object + * + * @param array $request_data Request datas + * @return int ID of bom + * + * @url POST boms/ + */ + function post($request_data = null) + { + if(! DolibarrApiAccess::$user->rights->bom->create) { + throw new RestException(401); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->bom->$field = $value; + } + if( ! $this->bom->create(DolibarrApiAccess::$user)) { + throw new RestException(500); + } + return $this->bom->id; + } + + /** + * Update bom + * + * @param int $id Id of bom to update + * @param array $request_data Datas + * @return int + * + * @url PUT boms/{id} + */ + function put($id, $request_data = null) + { + if(! DolibarrApiAccess::$user->rights->bom->create) { + throw new RestException(401); + } + + $result = $this->bom->fetch($id); + if( ! $result ) { + throw new RestException(404, 'BillOfMaterials not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('bom',$this->bom->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + $this->bom->$field = $value; + } + + if($this->bom->update($id, DolibarrApiAccess::$user)) + return $this->get($id); + + return false; + } + + /** + * Delete bom + * + * @param int $id BillOfMaterials ID + * @return array + * + * @url DELETE bom/{id} + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->bom->delete) { + throw new RestException(401); + } + $result = $this->bom->fetch($id); + if( ! $result ) { + throw new RestException(404, 'BillOfMaterials not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('bom',$this->bom->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( !$this->bom->delete(DolibarrApiAccess::$user, 0)) + { + throw new RestException(500); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'BillOfMaterials deleted' + ) + ); + } + + + /** + * Clean sensible object datas + * + * @param object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) + { + $object = parent::_cleanObjectDatas($object); + + /*unset($object->note); + unset($object->address); + unset($object->barcode_type); + unset($object->barcode_type_code); + unset($object->barcode_type_label); + unset($object->barcode_type_coder);*/ + + return $object; + } + + /** + * Validate fields before create or update object + * + * @param array $data Data to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $bom = array(); + foreach (BillOfMaterialsApi::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $bom[$field] = $data[$field]; + } + return $bom; + } +} diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php new file mode 100644 index 00000000000..9420651df8b --- /dev/null +++ b/htdocs/bom/class/bom.class.php @@ -0,0 +1,1208 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file class/bom.class.php + * \ingroup bom + * \brief This file is a CRUD class file for BillOfMaterials (Create/Read/Update/Delete) + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class for BillOfMaterials + */ +class BillOfMaterials extends CommonObject +{ + /** + * @var string ID to identify managed object + */ + public $element = 'bom'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'bom_bom'; + + /** + * @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var int Does bom support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 1; + + /** + * @var string String with name of icon for bom. Must be the part after the 'object_' into object_bom.png + */ + public $picto = 'bom@bom'; + + + /** + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + */ + + // 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. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text", 'showoncombobox'=>'1',), + 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), + 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), + 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), + 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), + 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Actif', '-1'=>'Inactif')), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1,), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'isameasure'=>'1',), + ); + public $rowid; + public $ref; + public $label; + public $description; + public $note_public; + public $note_private; + public $date_creation; + public $tms; + public $fk_user_creat; + public $fk_user_modif; + public $import_key; + public $status; + public $fk_product; + public $qty; + // END MODULEBUILDER PROPERTIES + + + + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'bomdet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + //public $fk_element = 'fk_bom'; + + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'BillOfMaterialsline'; + + /** + * @var array Array of child tables (child tables to delete before deleting a record) + */ + //protected $childtables=array('bomdet'); + + /** + * @var BillOfMaterialsLine[] Array of subtable lines + */ + //public $lines = array(); + + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs, $user; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0; + + // Unset fields that are disabled + foreach($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + foreach($this->fields as $key => $val) + { + if (is_array($this->fields['status']['arrayofkeyval'])) + { + foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + { + $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone an object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $langs, $hookmanager, $extrafields; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $object->fetchCommon($fromid); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->element); + foreach($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + /*public function fetchLines() + { + $this->lines=array(); + + // Load lines with object BillOfMaterialsLine + + return count($this->lines)?1:0; + }*/ + + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records=array(); + + $sql = 'SELECT'; + $sql .= ' t.rowid'; + // TODO Get all fields + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + $sql .= ' WHERE t.entity = '.$conf->entity; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key=='t.rowid') { + $sqlwhere[] = $key . '='. $value; + } + elseif (strpos($key,'date') !== false) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } + elseif ($key=='customsql') { + $sqlwhere[] = $value; + } + else { + $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) + { + $record = new self($this->db); + + $record->id = $obj->rowid; + // TODO Get other fields + + //var_dump($record->id); + $records[$record->id] = $record; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + + $label = '' . $langs->trans("BillOfMaterials") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = dol_buildpath('/bom/bom_card.php',1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowBillOfMaterials"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + + /* + $hookmanager->initHooks(array('bomdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action,$hookmanager; + $hookmanager->initHooks(array('bomdao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } + + /** + * Return label of the status + * + * @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 of status + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return the status + * + * @param int $status Id status + * @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 of status + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + if (empty($this->labelstatus)) + { + global $langs; + //$langs->load("bom"); + $this->labelstatus[1] = $langs->trans('Enabled'); + $this->labelstatus[0] = $langs->trans('Disabled'); + } + + if ($mode == 0) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 1) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 2) + { + if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + } + elseif ($mode == 3) + { + if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle'); + } + elseif ($mode == 4) + { + if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + } + elseif ($mode == 5) + { + if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle'); + } + elseif ($mode == 6) + { + if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle'); + } + } + + /** + * Load the info information in the object + * + * @param int $id Id of object + * @return void + */ + public function info($id) + { + $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; + $sql.= ' fk_user_creat, fk_user_modif'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql.= ' WHERE t.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + } + + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } + + + /** + * Action executed by scheduler + * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + //public function doScheduledJob($param1, $param2, ...) + public function doScheduledJob() + { + global $conf, $langs; + + //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; + + $error = 0; + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $now = dol_now(); + + $this->db->begin(); + + // ... + + $this->db->commit(); + + return $error; + } +} + + +/** + * Class for BillOfMaterialsLine + */ +class BillOfMaterialsLine extends CommonObject +{ + /** + * @var string ID to identify managed object + */ + public $element = 'bomline'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'bom_bomline'; + + /** + * @var int Does bomline support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 0; + + /** + * @var int Does bomline support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 1; + + /** + * @var string String with name of icon for bomline. Must be the part after the 'object_' into object_bomline.png + */ + public $picto = 'bomline@bom'; + + + /** + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + */ + + // 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. + */ + public $fields=array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), + 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), + 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), + 'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'isameasure'=>'1',), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'index'=>1,), + 'fk_bom' => array('type'=>'integer:BillOfMaterials:societe/class/bom.class.php', 'label'=>'BillOfMaterials', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>-1, 'index'=>1,), + 'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>40, 'notnull'=>1,), + ); + public $rowid; + public $description; + public $import_key; + public $qty; + public $fk_product; + public $fk_bom; + public $rank; + // END MODULEBUILDER PROPERTIES + + + + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'bomlinedet'; + + /** + * @var int Field with ID of parent key if this field has a parent + */ + //public $fk_element = 'fk_bomline'; + + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'BillOfMaterialsLineline'; + + /** + * @var array Array of child tables (child tables to delete before deleting a record) + */ + //protected $childtables=array('bomlinedet'); + + /** + * @var BillOfMaterialsLineLine[] Array of subtable lines + */ + //public $lines = array(); + + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs, $user; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0; + + // Unset fields that are disabled + foreach($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + foreach($this->fields as $key => $val) + { + if (is_array($this->fields['status']['arrayofkeyval'])) + { + foreach($this->fields['status']['arrayofkeyval'] as $key2 => $val2) + { + $this->fields['status']['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone an object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $langs, $hookmanager, $extrafields; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $object->fetchCommon($fromid); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->element); + foreach($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @return int <0 if KO, 0 if not found, >0 if OK + */ + /*public function fetchLines() + { + $this->lines=array(); + + // Load lines with object BillOfMaterialsLineLine + + return count($this->lines)?1:0; + }*/ + + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records=array(); + + $sql = 'SELECT'; + $sql .= ' t.rowid'; + // TODO Get all fields + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + $sql .= ' WHERE t.entity = '.$conf->entity; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key=='t.rowid') { + $sqlwhere[] = $key . '='. $value; + } + elseif (strpos($key,'date') !== false) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } + elseif ($key=='customsql') { + $sqlwhere[] = $value; + } + else { + $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) + { + $record = new self($this->db); + + $record->id = $obj->rowid; + // TODO Get other fields + + //var_dump($record->id); + $records[$record->id] = $record; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + + $label = '' . $langs->trans("BillOfMaterialsLine") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = dol_buildpath('/bom/bomline_card.php',1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowBillOfMaterialsLine"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + + /* + $hookmanager->initHooks(array('bomlinedao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action,$hookmanager; + $hookmanager->initHooks(array('bomlinedao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } + + /** + * Return label of the status + * + * @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 of status + */ + public function getLibStatut($mode = 0) + { + return $this->LibStatut($this->status, $mode); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return the status + * + * @param int $status Id status + * @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 of status + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + if (empty($this->labelstatus)) + { + global $langs; + //$langs->load("bom"); + $this->labelstatus[1] = $langs->trans('Enabled'); + $this->labelstatus[0] = $langs->trans('Disabled'); + } + + if ($mode == 0) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 1) + { + return $this->labelstatus[$status]; + } + elseif ($mode == 2) + { + if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + } + elseif ($mode == 3) + { + if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle'); + } + elseif ($mode == 4) + { + if ($status == 1) return img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + elseif ($status == 0) return img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + } + elseif ($mode == 5) + { + if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle'); + } + elseif ($mode == 6) + { + if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut4', '', false, 0, 0, '', 'valignmiddle'); + elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status],'statut5', '', false, 0, 0, '', 'valignmiddle'); + } + } + + /** + * Load the info information in the object + * + * @param int $id Id of object + * @return void + */ + public function info($id) + { + $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; + $sql.= ' fk_user_creat, fk_user_modif'; + $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql.= ' WHERE t.rowid = '.$id; + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + $this->id = $obj->rowid; + if ($obj->fk_user_author) + { + $cuser = new User($this->db); + $cuser->fetch($obj->fk_user_author); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db); + $vuser->fetch($obj->fk_user_valid); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db); + $cluser->fetch($obj->fk_user_cloture); + $this->user_cloture = $cluser; + } + + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); + $this->date_validation = $this->db->jdate($obj->datev); + } + + $this->db->free($result); + } + else + { + dol_print_error($this->db); + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } + + + /** + * Action executed by scheduler + * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + //public function doScheduledJob($param1, $param2, ...) + public function doScheduledJob() + { + global $conf, $langs; + + //$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log'; + + $error = 0; + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $now = dol_now(); + + $this->db->begin(); + + // ... + + $this->db->commit(); + + return $error; + } +} + diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php new file mode 100644 index 00000000000..ff8820a93b3 --- /dev/null +++ b/htdocs/bom/lib/bom.lib.php @@ -0,0 +1,125 @@ + + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file bom/lib/bom.lib.php + * \ingroup bom + * \brief Library files with common functions for BillOfMaterials + */ + +/** + * Prepare admin pages header + * + * @return array + */ +function bomAdminPrepareHead() +{ + global $langs, $conf; + + $langs->load("bom@bom"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/bom/admin/setup.php", 1); + $head[$h][1] = $langs->trans("Settings"); + $head[$h][2] = 'settings'; + $h++; + + /*$head[$h][0] = dol_buildpath("/bom/admin/about.php", 1); + $head[$h][1] = $langs->trans("About"); + $head[$h][2] = 'about'; + $h++; + */ + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom'); + + return $head; +} + + + + +/** + * Prepare array of tabs for BillOfMaterials + * + * @param BillOfMaterials $object BillOfMaterials + * @return array Array of tabs + */ +function bomPrepareHead($object) +{ + global $db, $langs, $conf; + + $langs->load("bom@bom"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/bom/bom_card.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) + { + $nbNote = 0; + if (!empty($object->note_private)) $nbNote++; + if (!empty($object->note_public)) $nbNote++; + $head[$h][0] = dol_buildpath('/bom/bom_note.php', 1).'?id='.$object->id; + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + $head[$h][2] = 'note'; + $h++; + } + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); + $nbLinks=Link::count($db, $object->element, $object->id); + $head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans('Documents'); + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + $head[$h][2] = 'document'; + $h++; + + $head[$h][0] = dol_buildpath("/bom/bom_agenda.php", 1).'?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + $head[$h][2] = 'agenda'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom'); + + return $head; +} + diff --git a/htdocs/bom/modulebuilder.txt b/htdocs/bom/modulebuilder.txt new file mode 100644 index 00000000000..24ea0d6eac5 --- /dev/null +++ b/htdocs/bom/modulebuilder.txt @@ -0,0 +1,3 @@ +# DO NOT DELETE THIS FILE MANUALLY +# File to flag module built using official module template. +# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module. \ No newline at end of file diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1c20a019eae..b8cbafae488 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -143,6 +143,25 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->add('/product/index.php?mainmenu=products&leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname); } + // MRP + $tmpentry = array( + 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), + 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), + 'module'=>'bom|mrp', + ); + $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); + if ($showmode) + { + $classname=""; + if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } + else $classname = 'class="tmenu"'; + $idsel='products'; + + $chaine=$langs->trans("TMenuMRP"); + + $menu->add('/bom/bom_list.php?mainmenu=mrp&leftmenu=', $chaine, 0, $showmode, $atarget, "bom", '', 30, $id, $idsel, $classname); + } + // Projects $tmpentry=array('enabled'=>(! empty($conf->projet->enabled)), 'perms'=>(! empty($user->rights->projet->lire)), @@ -1443,6 +1462,20 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } } + /* + * Menu PRODUCTS-SERVICES MRP + */ + if ($mainmenu == 'mrp') + { + // BOM + if (! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)) + { + $newmenu->add("", $langs->trans("BOM"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); + $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBom"), 1, $user->rights->bom->write); + $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read); + } + } + /* * Menu PROJECTS */ diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php new file mode 100644 index 00000000000..e9cb8cc631a --- /dev/null +++ b/htdocs/core/modules/modBom.class.php @@ -0,0 +1,374 @@ + + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 Maxime Kohlhaas + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \defgroup bom Module Bom + * \brief Bom module descriptor. + * + * \file htdocs/bom/core/modules/modBom.class.php + * \ingroup bom + * \brief Description and activation file for module Bom + */ +include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; + + +/** + * Description and activation class for module Bom + */ +class modBom extends DolibarrModules +{ + /** + * Constructor. Define names, constants, directories, boxes, permissions + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $langs,$conf; + + $this->db = $db; + + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 650; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'bom'; + + // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' + // It is used to group modules by family in module setup page + $this->family = "products"; + // Module position in the family on 2 digits ('01', '10', '20', ...) + $this->module_position = '90'; + // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); + + // Module label (no space allowed), used if translation string 'ModuleBomName' not found (Bom is name of module). + $this->name = preg_replace('/^mod/i','',get_class($this)); + // Module description, used if translation string 'ModuleBomDesc' not found (Bom is name of module). + $this->description = "Bill of Materials (BOM) definitions for Manufacturing Resource Planning"; + // Used only if file README.md and README-LL.md not found. + $this->descriptionlong = "Bill of Materials definitions. They can be used to make Manufacturing Resource Planning"; + + // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' + $this->version = 'experimental'; + + //Url to the file with your last numberversion of this module + //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; + // Key used in llx_const table to save module status enabled/disabled (where BILLOFMATERIALS is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Name of image file used for this module. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto='generic'; + + // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) + $this->module_parts = array( + /* + 'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers) + 'login' => 0, // Set this to 1 if module has its own login method file (core/login) + 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) + 'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus) + 'theme' => 0, // Set this to 1 if module has its own theme directory (theme) + 'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl) + 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) + 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) + 'css' => array('/bom/css/bom.css.php'), // Set this to relative path of css file if module has its own css file + 'js' => array('/bom/js/bom.js.php'), // Set this to relative path of js file if module must load a js on all pages + 'hooks' => array('data'=>array('hookcontext1','hookcontext2'), 'entity'=>'0'), // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all' + 'moduleforexternal' => 0 // Set this to 1 if feature of module are opened to external users + */ + ); + + // Data directories to create when module is enabled. + // Example: this->dirs = array("/bom/temp","/bom/subdir"); + $this->dirs = array("/bom/temp"); + + // Config pages. Put here list of php page, stored into bom/admin directory, to use to setup module. + $this->config_page_url = array("setup.php@bom"); + + // Dependencies + $this->hidden = false; // A condition to hide module + $this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + $this->langfiles = array("bom@bom"); + //$this->phpmin = array(5,4); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(9,0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + //$this->automatic_activation = array('FR'=>'BomWasAutomaticallyActivatedBecauseOfYourCountryChoice'); + //$this->always_enabled = true; // If true, can't be disabled + + // Constants + // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) + // Example: $this->const=array(0=>array('BILLOFMATERIALS_MYNEWCONST1','chaine','myvalue','This is a constant to add',1), + // 1=>array('BILLOFMATERIALS_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1) + // ); + $this->const = array( + //1=>array('BILLOFMATERIALS_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1) + ); + + // Some keys to add into the overwriting translation tables + /*$this->overwrite_translation = array( + 'en_US:ParentCompany'=>'Parent company or reseller', + 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' + )*/ + + if (! isset($conf->bom) || ! isset($conf->bom->enabled)) + { + $conf->bom=new stdClass(); + $conf->bom->enabled=0; + } + + + // Array to add new pages in new tabs + $this->tabs = array(); + // Example: + // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@bom:$user->rights->bom->read:/bom/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@bom:$user->rights->othermodule->read:/bom/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be + // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) + // 'contact' to add a tab in contact view + // 'contract' to add a tab in contract view + // 'group' to add a tab in group view + // 'intervention' to add a tab in intervention view + // 'invoice' to add a tab in customer invoice view + // 'invoice_supplier' to add a tab in supplier invoice view + // 'member' to add a tab in fundation member view + // 'opensurveypoll' to add a tab in opensurvey poll view + // 'order' to add a tab in customer order view + // 'order_supplier' to add a tab in supplier order view + // 'payment' to add a tab in payment view + // 'payment_supplier' to add a tab in supplier payment view + // 'product' to add a tab in product view + // 'propal' to add a tab in propal view + // 'project' to add a tab in project view + // 'stock' to add a tab in stock view + // 'thirdparty' to add a tab in third party view + // 'user' to add a tab in user view + + + // Dictionaries + $this->dictionaries=array(); + /* Example: + $this->dictionaries=array( + 'langs'=>'mylangfile@bom', + 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor + 'tablib'=>array("Table1","Table2","Table3"), // Label of tables + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields + 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order + 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) + 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) + 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) + 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond'=>array($conf->bom->enabled,$conf->bom->enabled,$conf->bom->enabled) // Condition to show each dictionary + ); + */ + + + // Boxes/Widgets + // Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget. + $this->boxes = array( + //0=>array('file'=>'bomwidget1.php@bom','note'=>'Widget provided by Bom','enabledbydefaulton'=>'Home'), + //1=>array('file'=>'bomwidget2.php@bom','note'=>'Widget provided by Bom'), + //2=>array('file'=>'bomwidget3.php@bom','note'=>'Widget provided by Bom') + ); + + + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week + $this->cronjobs = array( + //0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/bom/class/bom.class.php', 'objectname'=>'Bom', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->bom->enabled', 'priority'=>50) + ); + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->bom->enabled', 'priority'=>50), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->bom->enabled', 'priority'=>50) + // ); + + + // Permissions + $this->rights = array(); // Permission array used by this module + + $r=0; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Read bom of Bom'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Create/Update bom of Bom'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + + $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Delete bom of Bom'; // Permission label + $this->rights[$r][3] = 1; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->bom->level1->level2) + + + // Main menu entries + $this->menu = array(); // List of menus to add + $r=0; + + // Add here entries to declare new menus + + /* BEGIN MODULEBUILDER TOPMENU */ + /*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'top', // This is a Top menu entry + 'titre'=>'Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'', + 'url'=>'/bom/bom_list.php', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. + 'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + */ + /* END MODULEBUILDER TOPMENU */ + + /* BEGIN MODULEBUILDER LEFTMENU BILLOFMATERIALS + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'List Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom_list', + 'url'=>'/bom/bom_list.php', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=bom,fk_leftmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom_new', + 'url'=>'/bom/bom_page.php?action=create', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + */ + /* + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'List Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom', + 'url'=>'/bom/bom_list.php', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1100+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=bom,fk_leftmenu=bom_bom', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New Bom', + 'mainmenu'=>'bom', + 'leftmenu'=>'bom_bom', + 'url'=>'/bom/bom_card.php?action=create', + 'langs'=>'bom@bom', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1100+$r, + 'enabled'=>'$conf->bom->enabled', // Define condition to show or hide menu entry. Use '$conf->bom->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'1', // Use 'perms'=>'$user->rights->bom->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both + */ + /* END MODULEBUILDER LEFTMENU BILLOFMATERIALS */ + + + // Exports + $r=1; + + /* BEGIN MODULEBUILDER EXPORT BILLOFMATERIALS */ + /* + $langs->load("bom@bom"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='BomLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]='bom@bom'; + $keyforclass = 'Bom'; $keyforclassfile='/mymobule/class/bom.class.php'; $keyforelement='bom'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='bom'; $keyforaliasextra='extra'; $keyforelement='bom'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'bom as t'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('bom').')'; + $r++; */ + /* END MODULEBUILDER EXPORT BILLOFMATERIALS */ + } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result=$this->_load_tables('/bom/sql/'); + if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') + + // Create extrafields + include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + + //$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + //$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'bom@bom', '$conf->bom->enabled'); + + $sql = array(); + + return $this->_init($sql, $options); + } + + /** + * Function called when module is disabled. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted + * + * @param string $options Options when enabling module ('', 'noboxes') + * @return int 1 if OK, 0 if KO + */ + public function remove($options = '') + { + $sql = array(); + + return $this->_remove($sql, $options); + } +} diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index dc6856b719e..b2ba0bf3a58 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -164,3 +164,64 @@ ALTER TABLE llx_user ADD COLUMN fk_warehouse INTEGER NULL; -- Save informations for online / API shopping and push to invoice ALTER TABLE llx_commande ADD COLUMN module_source varchar(32); ALTER TABLE llx_commande ADD COLUMN pos_source varchar(32); + + + + + +CREATE TABLE llx_bom_bom( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp NOT NULL, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status integer NOT NULL, + fk_product integer, + qty double(24,8) + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +create table llx_bom_bom_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +CREATE TABLE llx_bom_bomline( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + description text, + import_key varchar(14), + qty double(24,8), + fk_product integer, + fk_bom integer, + rank integer NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; + +create table llx_bom_bomline_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_rowid (rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_ref (ref); +ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_status (status); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product); + +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); diff --git a/htdocs/install/mysql/tables/llx_bom_bom.key.sql b/htdocs/install/mysql/tables/llx_bom_bom.key.sql new file mode 100644 index 00000000000..72631851e1b --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bom.key.sql @@ -0,0 +1,28 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_rowid (rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_ref (ref); +ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_status (status); +ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_bom_bom ADD UNIQUE INDEX uk_bom_bom_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_bom_bom.sql b/htdocs/install/mysql/tables/llx_bom_bom.sql new file mode 100644 index 00000000000..bb8da0726bf --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bom.sql @@ -0,0 +1,34 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +CREATE TABLE llx_bom_bom( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + label varchar(255), + description text, + note_public text, + note_private text, + date_creation datetime NOT NULL, + tms timestamp NOT NULL, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + import_key varchar(14), + status integer NOT NULL, + fk_product integer, + qty double(24,8) + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql b/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql new file mode 100644 index 00000000000..2f748847455 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bom_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + +create table llx_bom_bom_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.key.sql b/htdocs/install/mysql/tables/llx_bom_bomline.key.sql new file mode 100644 index 00000000000..89c65f78644 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bomline.key.sql @@ -0,0 +1,26 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +-- BEGIN MODULEBUILDER INDEXES +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); +ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); +-- END MODULEBUILDER INDEXES + +--ALTER TABLE llx_bom_bomline ADD UNIQUE INDEX uk_bom_bomline_fieldxy(fieldx, fieldy); + +--ALTER TABLE llx_bom_bomline ADD CONSTRAINT llx_bom_bomline_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid); + diff --git a/htdocs/install/mysql/tables/llx_bom_bomline.sql b/htdocs/install/mysql/tables/llx_bom_bomline.sql new file mode 100644 index 00000000000..d1a958e9633 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bomline.sql @@ -0,0 +1,27 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + + +CREATE TABLE llx_bom_bomline( + -- BEGIN MODULEBUILDER FIELDS + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + description text, + import_key varchar(14), + qty double(24,8), + fk_product integer, + fk_bom integer, + rank integer NOT NULL + -- END MODULEBUILDER FIELDS +) ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql b/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql new file mode 100644 index 00000000000..a81715d0184 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_bom_bomline_extrafields.sql @@ -0,0 +1,23 @@ +-- Copyright (C) ---Put here your own copyright and developer email--- +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see http://www.gnu.org/licenses/. + +create table llx_bom_bomline_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + diff --git a/test/phpunit/BillOfMaterialsTest.php b/test/phpunit/BillOfMaterialsTest.php new file mode 100644 index 00000000000..a03d8523b99 --- /dev/null +++ b/test/phpunit/BillOfMaterialsTest.php @@ -0,0 +1,110 @@ + + * Copyright (C) ---Put here your own copyright and developer email--- + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file test/unit/BillOfMaterialsTest.php + * \ingroup billofmaterials + * \brief PHPUnit test for BillOfMaterials class. + */ + +namespace test\unit; + +/** + * Class BillOfMaterialsTest + * @package Testbillofmaterials + */ +class BillOfMaterialsTest extends \PHPUnit_Framework_TestCase +{ + /** + * Global test setup + * @return void + */ + public static function setUpBeforeClass() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Unit test setup + * @return void + */ + protected function setUp() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Verify pre conditions + * @return void + */ + protected function assertPreConditions() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * A sample test + * @return bool + */ + public function testSomething() + { + fwrite(STDOUT, __METHOD__ . "\n"); + // TODO: test something + $this->assertTrue(true); + } + + /** + * Verify post conditions + * @return void + */ + protected function assertPostConditions() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Unit test teardown + * @return void + */ + protected function tearDown() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Global test teardown + * @return void + */ + public static function tearDownAfterClass() + { + fwrite(STDOUT, __METHOD__ . "\n"); + } + + /** + * Unsuccessful test + * + * @param Exception $e Exception + * @return void + * @throws Exception + */ + protected function onNotSuccessfulTest(Exception $e) + { + fwrite(STDOUT, __METHOD__ . "\n"); + throw $e; + } +} From 3ec2338c2d645514ad526cb55336929868710512 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Feb 2019 19:37:32 +0100 Subject: [PATCH 154/190] Look and feel v10 --- htdocs/comm/action/card.php | 4 ++-- htdocs/comm/propal/card.php | 4 ++-- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture/card.php | 4 ++-- htdocs/compta/paiement/cheque/card.php | 5 ----- htdocs/contrat/card.php | 4 ++-- htdocs/don/card.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/fichinter/card.php | 4 ++-- htdocs/fourn/commande/card.php | 4 ++-- htdocs/fourn/facture/card.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/reception/card.php | 2 +- htdocs/supplier_proposal/card.php | 4 ++-- 14 files changed, 21 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 596cc20c9e0..b542cf4dd67 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -895,7 +895,7 @@ if ($action == 'create') $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").' '; $urloption='?action=create'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; @@ -1293,7 +1293,7 @@ if ($id > 0) $numprojet=$formproject->select_projects(($object->socid > 0 ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").' '; } print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ''; + print '   id.($fac_rec?'&fac_rec='.$fac_rec:'')).'">' . $langs->trans("AddProject") . ' '; print '
'; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print '
'.$langs->trans("Project").''; $formproject->select_projects(($soc->id>0?$soc->id:-1), $projectid, "projectid", 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print "
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
' . $langs->trans('Project') . ''; $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
'; print $form->select_company('', 'socid', 's.fournisseur = 1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); - print ' '.$langs->trans("AddThirdParty").''; + print ' '.$langs->trans("AddThirdParty").' '; print '
' . $langs->trans("Project") . ''; $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   id).'">' . $langs->trans("AddProject") . ' '; print '
'; + + // Name + print ''; + print ''; + print ''; + print ''; + + // Parent + print ''; + print ''; + print ''; + print ''; + + // Address + print ''; + print ''; + print ''; + print ''; + + // Zipcode + print ''; + print ''; + print ''; + print ''; + + // Town + print ''; + print ''; + print ''; + print ''; + + // Country + print ''; + print ''; + print ''; + print ''; + + // Status + print ''; + print ''; + print ''; + + print '
'. $form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).'
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; + print $form->select_establishments(GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity, 'entity', 1); + print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; + print ''; + print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; + print $formcompany->select_ziptown( + GETPOST('zipcode', 'alpha'), + 'zipcode', + array ( + 'town', + 'selectcountry_id' + ), + 6 + ); + print '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print $formcompany->select_ziptown(GETPOST('town', 'alpha'), 'town', array ( + 'zipcode', + 'selectcountry_id' + )); + print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; + print $form->select_country(GETPOST('country_id', 'int')>0?GETPOST('country_id', 'int'):$mysoc->country_id, 'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print '
'.$form->editfieldkey('Status', 'status', '', $object, 0, 'string', '', 1).''; + print $form->selectarray('status', $status2label, GETPOST('status', 'alpha')); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print ''; } -$title=$langs->trans("ThirdParty"); -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('Card'); -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('', $title, $help_url); - -$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; - -if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) +// Part to edit record +if (($id || $ref) && $action == 'edit') { - // ----------------------------------------- - // When used with CANVAS - // ----------------------------------------- - $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates - $objcanvas->display_canvas($action); // Show template -} -else -{ - // ----------------------------------------- - // When used in standard mode - // ----------------------------------------- - if ($action == 'create') + $result = $object->fetch($id); + if ($result > 0) { - /* - * Creation - */ - $private=GETPOST("private", "int"); - if (! empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1; - if (empty($private)) $private=0; + $head = establishment_prepare_head($object); - // Load object modCodeTiers - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') + if ($action == 'edit') { - $module = substr($module, 0, dol_strlen($module)-4); - } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) - { - $res=dol_include_once($dirroot.$module.'.php'); - if ($res) break; - } - $modCodeClient = new $module; - // Load object modCodeFournisseur - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') - { - $module = substr($module, 0, dol_strlen($module)-4); - } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) - { - $res=dol_include_once($dirroot.$module.'.php'); - if ($res) break; - } - $modCodeFournisseur = new $module; + dol_fiche_head($head, 'card', $langs->trans("Establishment"), 0, 'building'); - // Define if customer/prospect or supplier status is set or not - if (GETPOST("type")!='f') - { - $object->client=-1; - if (! empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client=3; } - } - // Prospect / Customer - if (GETPOST("type")=='c') { - if (! empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { - $object->client=$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; - } else { - $object->client=3; - } - } - if (GETPOST("type")=='p') { $object->client=2; } - if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && ! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; } - - $object->name = GETPOST('name', 'alpha'); - $object->firstname = GETPOST('firstname', 'alpha'); - $object->particulier = $private; - $object->prefix_comm = GETPOST('prefix_comm'); - $object->client = GETPOST('client')?GETPOST('client'):$object->client; - - if(empty($duplicate_code_error)) { - $object->code_client = GETPOST('customer_code', 'alpha'); - $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; - } - else { - setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), '', 'warnings'); - } - - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - $object->address = GETPOST('address', 'alpha'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->state_id = GETPOST('state_id', 'int'); - $object->skype = GETPOST('skype', 'alpha'); - $object->twitter = GETPOST('twitter', 'alpha'); - $object->facebook = GETPOST('facebook', 'alpha'); - $object->phone = GETPOST('phone', 'alpha'); - $object->fax = GETPOST('fax', 'alpha'); - $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); - $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); - $object->capital = GETPOST('capital', 'alpha'); - $object->barcode = GETPOST('barcode', 'alpha'); - $object->idprof1 = GETPOST('idprof1', 'alpha'); - $object->idprof2 = GETPOST('idprof2', 'alpha'); - $object->idprof3 = GETPOST('idprof3', 'alpha'); - $object->idprof4 = GETPOST('idprof4', 'alpha'); - $object->idprof5 = GETPOST('idprof5', 'alpha'); - $object->idprof6 = GETPOST('idprof6', 'alpha'); - $object->typent_id = GETPOST('typent_id', 'int'); - $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->civility_id = GETPOST('civility_id', 'int'); - - $object->tva_assuj = GETPOST('assujtva_value', 'int'); - $object->status = GETPOST('status', 'int'); - - //Local Taxes - $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'int'); - $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'int'); - - $object->localtax1_value =GETPOST('lt1', 'int'); - $object->localtax2_value =GETPOST('lt2', 'int'); - - $object->tva_intra = GETPOST('tva_intra', 'alpha'); - - $object->commercial_id = GETPOST('commercial_id', 'int'); - $object->default_lang = GETPOST('default_lang'); - - $object->logo = (isset($_FILES['photo'])?dol_sanitizeFileName($_FILES['photo']['name']):''); - - // Gestion du logo de la société - $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos"; - $file_OK = (isset($_FILES['photo'])?is_uploaded_file($_FILES['photo']['tmp_name']):false); - if ($file_OK) - { - if (image_format_supported($_FILES['photo']['name'])) - { - dol_mkdir($dir); - - if (@is_dir($dir)) - { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); - - if (! $result > 0) - { - $errors[] = "ErrorFailedToSaveFile"; - } - else - { - // Create thumbs - $object->addThumbs($newfile); - } - } - } - } - - // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; - if ($object->country_id) - { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; - } - $object->forme_juridique_code=GETPOST('forme_juridique_code'); - /* Show create form */ - - $linkback=""; - print load_fiche_titre($langs->trans("NewThirdParty"), $linkback, 'title_companies.png'); - - if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) - { - print "\n".''."\n"; - - print '
'; - print '
'; - print $langs->trans("ThirdPartyType").':     '; - print '
'; - print ''; - print '     '; - print ''; - print '
'; - print "
\n"; - } - - dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error'); - - print '
'; // Chrome ignor autocomplete - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; - - dol_fiche_head(null, 'card', '', 0, ''); - - print ''; - - // Name, firstname - print 'global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; - print ''; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } - print ''; - - // If javascript on, we show option individual - if ($conf->use_javascript_ajax) - { - print ''; - print ''; - print ''; - // Title - print ''; - print ''; - } - - // Alias names (commercial, trademark or alias names) - print ''; - print ''; - - // Prospect/Customer - print ''; - print ''; - - print ''; - - if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) - { - // Supplier - print ''; - print ''; - print ''; - } - - // Status - print ''; - - // Barcode - if (! empty($conf->barcode->enabled)) - { - print ''; - print ''; - } - - // Address - print ''; - print ''; - - // Zip / Town - print ''; - - // Country - print ''; - - // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) - { - if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) - { - print ''; - } - - // Email / Web - print ''; - print ''; - print ''; - print ''; - - if (! empty($conf->socialnetworks->enabled)) - { - // Skype - if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) - { - print ''; - print ''; - } - // Twitter - if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) - { - print ''; - print ''; - } - // Facebook - if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - { - print ''; - print ''; - } - } - - // Phone / Fax - print ''; - print ''; - print ''; - print ''; - - // Prof ids - $i=1; $j=0; - while ($i <= 6) - { - $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof!='-') - { - $key='idprof'.$i; - - if (($j % 2) == 0) print ''; - - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; - if (($j % 2) == 1) print ''; - $j++; - } - $i++; - } - if ($j % 2 == 1) print ''; - - // Vat is used - print ''; - print ''; - print ''; - print ''; - print ''; - - // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } - - // Type - Size - print ''; - print ''; - - // Legal Form - print ''; - print ''; - - // Capital - print ''; - print ''; - - if (! empty($conf->global->MAIN_MULTILANGS)) - { - print ''; - print ''; - } - - // Incoterms - if (!empty($conf->incoterm->enabled)) - { - print ''; - print ''; - print ''; - } - - // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - $langs->load('categories'); - - // Customer - //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { - print '"; - //} - - // Supplier - //if ($object->fournisseur) { - print '"; - //} - } - - // Multicurrency - if (! empty($conf->multicurrency->enabled)) - { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - } - - // Assign a sale representative - print ''; - print ''; - print ''; - - // Ajout du logo - print ''; - print ''; - print ''; - print ''; - - print '
'; - if ($object->particulier || $private) - { - print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; - } - else - { - print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; - } - print ''.$langs->trans('Prefix').'
'.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).'
'.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).''; - print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').'
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - $selected=GETPOST('client', 'int')!=''?GETPOST('client', 'int'):$object->client; - print $formcompany->selectProspectCustomerType($selected); - print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; - print '
'; - $tmpcode=$object->code_client; - if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object, 0); - print ''; - print ''; - $s=$modCodeClient->getToolTip($langs, $object, 0); - print $form->textwithpicto('', $s, 1); - print '
'; - print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; - $default = -1; - if (! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) $default=1; - print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int')!=''?GETPOST('fournisseur', 'int'):(GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0)); - print ''; - if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - { - print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); - } - print ''; - if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - { - print '
'; - $tmpcode=$object->code_fournisseur; - if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object, 1); - print ''; - print ''; - $s=$modCodeFournisseur->getToolTip($langs, $object, 1); - print $form->textwithpicto('', $s, 1); - print '
'; - } - print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1); - print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; - print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; - print $formcompany->select_ziptown($object->zip, 'zipcode', array('town','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); - print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; - print $formcompany->select_ziptown($object->town, 'town', array('zipcode','selectcountry_id','state_id'), 0, 0, '', 'maxwidth100 quatrevingtpercent'); - print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; - print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id)); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; - } - else - { - print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; - } - - if ($object->country_id) print $formcompany->select_state($object->state_id, $object->country_code); - else print $countrynotdefined; - print '
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', $conf->global->SOCIETE_EMAIL_MANDATORY).'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).''; - print 'skype).'">'; - print '
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).''; - print 'twitter).'">'; - print '
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).''; - print 'facebook).'">'; - print '
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory)?0:1)).''; - - print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); - print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; - print $form->selectyesno('assujtva_value', GETPOSTISSET('assujtva_value')?GETPOST('assujtva_value', 'int'):1, 1); // Assujeti par defaut en creation - print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; - $s = ''; - - if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) - { - $s.=' '; - - if (! empty($conf->use_javascript_ajax)) - { - print "\n"; - print ''; - print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); - } - else - { - $s.='country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; - } - } - print $s; - print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1:0), 1); - print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0), 1); - print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1:0), 1); - print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0), 1); - print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''."\n"; - $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); - if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); - if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; - if ($object->country_id) - { - print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); - } - else - { - print $countrynotdefined; - } - print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; - print ''.$langs->trans("Currency".$conf->currency).'
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; - print $formadmin->select_language(($object->default_lang?$object->default_lang:$conf->global->MAIN_LANG_DEFAULT), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); - print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); - print '
' . $form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0) . ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); - print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); - print "
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); - print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); - print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); - print '
'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; - $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); - // Note: If user has no right to "see all thirdparties", we for selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir)?array($user->id):array()))); - print $form->multiselectarray('commercial', $userlist, $selected, null, null, null, null, "90%"); - print '
'.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; - print ''; - print '
'."\n"; - - dol_fiche_end(); - - print '
'; - print ''; - if (! empty($backtopage)) - { - print '     '; - print ''; - } - else - { - print '     '; - print ''; - } - print '
'."\n"; - - print '
'."\n"; - } - elseif ($action == 'edit') - { - //print load_fiche_titre($langs->trans("EditCompany")); - - if ($socid) - { - $res=$object->fetch_optionals(); - //if ($res < 0) { dol_print_error($db); exit; } - - $head = societe_prepare_head($object); - - // Load object modCodeTiers - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') - { - $module = substr($module, 0, dol_strlen($module)-4); - } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) - { - $res=dol_include_once($dirroot.$module.'.php'); - if ($res) break; - } - $modCodeClient = new $module($db); - // We verified if the tag prefix is used - if ($modCodeClient->code_auto) - { - $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed(); - } - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') - { - $module = substr($module, 0, dol_strlen($module)-4); - } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) - { - $res=dol_include_once($dirroot.$module.'.php'); - if ($res) break; - } - $modCodeFournisseur = new $module($db); - // On verifie si la balise prefix est utilisee - if ($modCodeFournisseur->code_auto) - { - $prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed(); - } - - $object->oldcopy = clone $object; - - if (GETPOSTISSET('name')) - { - // We overwrite with values if posted - $object->name = GETPOST('name', 'alpha'); - $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); - $object->client = GETPOST('client', 'int'); - $object->code_client = GETPOST('customer_code', 'alpha'); - $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - $object->address = GETPOST('address', 'alpha'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->country_id = GETPOST('country_id')?GETPOST('country_id', 'int'):$mysoc->country_id; - $object->state_id = GETPOST('state_id', 'int'); - $object->skype = GETPOST('skype', 'alpha'); - $object->twitter = GETPOST('twitter', 'alpha'); - $object->facebook = GETPOST('facebook', 'alpha'); - $object->phone = GETPOST('phone', 'alpha'); - $object->fax = GETPOST('fax', 'alpha'); - $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); - $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); - $object->capital = GETPOST('capital', 'alpha'); - $object->idprof1 = GETPOST('idprof1', 'alpha'); - $object->idprof2 = GETPOST('idprof2', 'alpha'); - $object->idprof3 = GETPOST('idprof3', 'alpha'); - $object->idprof4 = GETPOST('idprof4', 'alpha'); - $object->idprof5 = GETPOST('idprof5', 'alpha'); - $object->idprof6 = GETPOST('idprof6', 'alpha'); - $object->typent_id = GETPOST('typent_id', 'int'); - $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->barcode = GETPOST('barcode', 'alpha'); - $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); - $object->default_lang = GETPOST('default_lang', 'alpha'); - - $object->tva_assuj = GETPOST('assujtva_value', 'int'); - $object->tva_intra = GETPOST('tva_intra', 'alpha'); - $object->status = GETPOST('status', 'int'); - - // Webservices url/key - $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); - $object->webservices_key = GETPOST('webservices_key', 'san_alpha'); - - //Incoterms - if (!empty($conf->incoterm->enabled)) - { - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); - } - - //Local Taxes - $object->localtax1_assuj = GETPOST('localtax1assuj_value'); - $object->localtax2_assuj = GETPOST('localtax2assuj_value'); - - $object->localtax1_value =GETPOST('lt1'); - $object->localtax2_value =GETPOST('lt2'); - - // We set country_id, and country_code label of the chosen country - if ($object->country_id > 0) - { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code = $tmparray['code']; - $object->country = $tmparray['label']; - } - } - - if($object->localtax1_assuj==0){ - $sub=0; - }else{$sub=1;} - if($object->localtax2_assuj==0){ - $sub2=0; - }else{$sub2=1;} - - if ($conf->use_javascript_ajax) - { - print "\n".''."\n"; - } - - print '
'; - print ''; + print '' . "\n"; print ''; - print ''; - print ''; - if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; + print ''; + print ''; - - dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); - - print '
'; print ''; - // Ref/ID - if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) - { - print ''; - } + // Ref + print ""; + print ''; // Name - print ''; - print ''; - - // Alias names (commercial, trademark or alias names) - print ''; - print ''; - - // Prefix - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } - - // Prospect/Customer - print ''; - print ''; - print ''; + + // Parent + print ''; + print ''; - // Supplier - if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) - { - print ''; - print ''; - print ''; - } + // Address + print ''; + print ''; - // Barcode - if (! empty($conf->barcode->enabled)) - { - print ''; - print ''; - } + // Zipcode / Town + print ''; + print ''; - // Status - print ''; + // Country + print ''; + print ''; + print ''; - // Address - print ''; - print ''; - - // Zip / Town - print ''; - - // Country - print ''; - - // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) - { - if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) - { - print ''; - } - - // EMail / Web - print ''; - print ''; - print ''; - print ''; - - if (! empty($conf->socialnetworks->enabled)) - { - // Skype - if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) - { - print ''; - print ''; - } - // Twitter - if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) - { - print ''; - print ''; - } - // Facebook - if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) - { - print ''; - print ''; - } - } - - // Phone / Fax - print ''; - print ''; - print ''; - print ''; - - // Prof ids - $i=1; $j=0; - while ($i <= 6) - { - $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof!='-') - { - $key='idprof'.$i; - - if (($j % 2) == 0) print ''; - - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; - if (($j % 2) == 1) print ''; - $j++; - } - $i++; - } - if ($j % 2 == 1) print ''; - - // VAT is used - print ''; - - // Local Taxes - //TODO: Place into a function to control showing by country or study better option - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - - print ''; - } - elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") - { - print ''; - } - elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") - { - print ''; - } - - // VAT Code - print ''; - print ''; - print ''; - - // Type - Size - print ''; - print ''; - - // Juridical type - print ''; - - // Capital - print ''; - print ''; - - // Default language - if (! empty($conf->global->MAIN_MULTILANGS)) - { - print ''; - print ''; - } - - // Incoterms - if (!empty($conf->incoterm->enabled)) - { - print ''; - print ''; - print ''; - } - - // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - // Customer - print ''; - print '"; - - // Supplier - print ''; - print '"; - } - - // Multicurrency - if (! empty($conf->multicurrency->enabled)) - { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (empty($reshook)) - { - print $object->showOptionals($extrafields, 'edit'); - } - - // Webservices url/key - if (!empty($conf->syncsupplierwebservices->enabled)) { - print ''; - print ''; - print ''; - print ''; - } - - // Logo - print ''; - print ''; - print ''; - print ''; - - // Assign sale representative - print ''; - print ''; - print ''; + // Status + print ''; print '
'.$langs->trans("ID").''; - print $object->ref; - print '
'.$langs->trans("Ref").''; + print $object->id; + print '
'.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).'
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; - // It does not change the prefix mode using the auto numbering prefix - if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) - { - print ''; - print $object->prefix_comm; - } - else - { - print ''; - } - print '
'.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).''; - print $formcompany->selectProspectCustomerType($object->client); - print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).''; - - print '
'; - if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) - { - $tmpcode=$object->code_client; - if (empty($tmpcode) && ! empty($object->oldcopy->code_client)) $tmpcode=$object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. - if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object, 0); - print ''; - } - elseif ($object->codeclient_modifiable()) - { - print ''; - } - else - { - print $object->code_client; - print ''; - } - print ''; - $s=$modCodeClient->getToolTip($langs, $object, 0); - print $form->textwithpicto('', $s, 1); - print '
'; - + print '
'.$form->editfieldkey('Name', 'name', '', $object, 0, 'string', '', 1).''; + print ''; + print '
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; + print $form->select_establishments($object->entity>0?$object->entity:$conf->entity, 'entity', 1); print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; - print $form->selectyesno("fournisseur", $object->fournisseur, 1); - print ''; - if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - { - print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); - } - print ''; - if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - { - print '
'; - if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) - { - $tmpcode=$object->code_fournisseur; - if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. - if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object, 1); - print ''; - } - elseif ($object->codefournisseur_modifiable()) - { - print ''; - } - else - { - print $object->code_fournisseur; - print ''; - } - print ''; - $s=$modCodeFournisseur->getToolTip($langs, $object, 1); - print $form->textwithpicto('', $s, 1); - print '
'; - } - print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).''; + print ''; + print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; - print '
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; + print $formcompany->select_ziptown($object->zip, 'zipcode', array ( + 'town', + 'selectcountry_id' + ), 6) . '
'.$form->editfieldkey('Town', 'town', '', $object, 0).''; + print $formcompany->select_ziptown($object->town, 'town', array ( + 'zipcode', + 'selectcountry_id' + )) . '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->status); - print '
'.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).''; + print $form->select_country($object->fk_country, 'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + print '
'.$form->editfieldkey('Address', 'address', '', $object, 0).'
'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).''; - print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone'); - print ''.$form->editfieldkey('Town', 'town', '', $object, 0).''; - print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); - print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; - print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id), 'country_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; - } - else - { - print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; - } - - print $formcompany->select_state($object->state_id, $object->country_code); - print '
'.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.$form->editfieldkey('Web', 'url', '', $object, 0).'
'.$form->editfieldkey('Skype', 'skype', '', $object, 0).'
'.$form->editfieldkey('Twitter', 'twitter', '', $object, 0).'
'.$form->editfieldkey('Facebook', 'facebook', '', $object, 0).'
'.$form->editfieldkey('Phone', 'phone', '', $object, 0).''.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', ! (empty($conf->global->$idprof_mandatory) || ! $object->isACompany())).''; - print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); - print '
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; - print $form->selectyesno('assujtva_value', $object->tva_assuj, 1); - print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; - print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); - if(! isOnlyOneLocalTax(1)) - { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''; - } - print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; - print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); - if (! isOnlyOneLocalTax(2)) - { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''; - } - print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; - print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); - if(! isOnlyOneLocalTax(1)) - { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''; - } - print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; - print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); - if(! isOnlyOneLocalTax(2)) - { - print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''; - } - print '
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; - $s =''; - - if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) - { - $s.='   '; - - if ($conf->use_javascript_ajax) - { - print "\n"; - print ''; - print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); - } - else - { - $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; - } - } - print $s; - print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print '
'.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).''; - print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); - print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '.$langs->trans("Currency".$conf->currency).'
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; - print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1); - print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); - print '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); - $arrayselected=array(); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; - } - print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); - print "
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; - $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); - $c = new Categorie($db); - $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); - $arrayselected=array(); - foreach ($cats as $cat) { - $arrayselected[] = $cat->id; - } - print $form->multiselectarray('suppcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); - print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print $form->selectMultiCurrency(($object->multicurrency_code ? $object->multicurrency_code : $conf->currency), 'multicurrency_code', 1); - print '
'.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).'
'.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; - if ($object->logo) print $form->showphoto('societe', $object); - $caneditfield=1; - if ($caneditfield) - { - if ($object->logo) print "
\n"; - print ''; - if ($object->logo) print ''; - //print ''; - print ''; - print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; - } - print '
'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).''; - $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); - $arrayselected = GETPOST('commercial', 'array'); - if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1); - print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%"); - print '
'.$form->editfieldkey('Status', 'status', '', $object, 0, 'string', '', 1).''; + print $form->selectarray('status', $status2label, $object->status); + print '
'; - print '
'; - dol_fiche_end(); + dol_fiche_end(); - print '
'; - print ''; - print '     '; - print ''; + print '
'; + print ''; + print '     '; + print ''; print '
'; print ''; } } - else + else dol_print_error($db); +} + +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +{ + $res = $object->fetch_optionals(); + + $head = establishment_prepare_head($object); + dol_fiche_head($head, 'card', $langs->trans("Establishment"), -1, 'building'); + + // Confirmation to delete + if ($action == 'delete') { - /* - * View - */ - - if (!empty($object->id)) $res=$object->fetch_optionals(); - //if ($res < 0) { dol_print_error($db); exit; } - - - $head = societe_prepare_head($object); - - dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), -1, 'company'); - - // Confirm delete third party - if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) - { - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "action-delete"); - } - - if ($action == 'merge') - { - $formquestion = array( - array( - 'name' => 'soc_origin', - 'label' => $langs->trans('MergeOriginThirdparty'), - 'type' => 'other', - 'value' => $form->select_company('', 'soc_origin', 's.rowid != '.$object->id, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth200') - ) - ); - - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 250); - } - - dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error'); - - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - - - print '
'; - print '
'; - - print '
'; - print ''; - - // Prospect/Customer - print ''; - - // Supplier - if (! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)) - { - print ''; - } - - // Prefix - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - print $htmllogobar; $htmllogobar=''; - print ''; - } - - // Customer code - if ($object->client) - { - print ''; - print $htmllogobar; $htmllogobar=''; - print ''; - } - - // Supplier code - if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) - { - print ''; - print $htmllogobar; $htmllogobar=''; - print ''; - } - - // Barcode - if (! empty($conf->barcode->enabled)) - { - print ''; - if ($htmllogobar) $htmllogobar.=$form->showbarcode($object); - print $htmllogobar; - $htmllogobar=''; - print ''; - } - - // Prof ids - $i=1; $j=0; - while ($i <= 6) - { - $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof!='-') - { - //if (($j % 2) == 0) print ''; - print ''; - print ''; - //if (($j % 2) == 1) print ''; - print ''; - $j++; - } - $i++; - } - //if ($j % 2 == 1) print ''; - - - // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier. - // We don't need them into customer profile. - // Except for spain and localtax where localtax depends on buyer and not seller - - if ($object->fournisseur) - { - // VAT is used - print ''; - print ''; - } - - // Local Taxes - if ($object->fournisseur || $mysoc->country_code=='ES') - { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - - if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) - { - print ''; - print ''; - print ''; - print ''; - if($action == 'editRE') - { - print ''; - } - else - { - print ''; - } - print ''; - } - if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) - { - print ''; - print ''; - print ''; - print ''; - if($action == 'editIRPF'){ - print ''; - }else{ - print ''; - } - print ''; - } - } - elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") - { - print ''; - if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) - { - print ''; - print ''; - print ''; - print ''; - if($action == 'editRE'){ - print ''; - }else{ - print ''; - } - print ''; - } - } - elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") - { - print ''; - if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) - { - - print ''; - print ''; - print ''; - print ''; - if($action == 'editIRPF'){ - print ''; - }else{ - print ''; - } - print ''; - } - } - } - - // Sale tax code (VAT code) - print ''; - print ''; - print ''; - - // Type + Staff - $arr = $formcompany->typent_array(1); - $object->typent= $arr[$object->typent_code]; - print ''; - print ''; - - print '
'.$langs->trans('ProspectCustomer').''; - print $object->getLibCustProspStatut(); - print '
'.$langs->trans('Supplier').''; - print yn($object->fournisseur); - print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print $object->code_client; - if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; - print '
'; - print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; - if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; - print '
'; - print $langs->trans('Gencod').''.$object->barcode; - print '
'.$idprof.''; - $key='idprof'.$i; - print $object->$key; - if ($object->$key) - { - if ($object->id_prof_check($i, $object) > 0) print '   '.$object->id_prof_url($i, $object); - else print ' ('.$langs->trans("ErrorWrongValue").')'; - } - print '
'; - print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling')); - print ''; - print yn($object->tva_assuj); - print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print yn($object->localtax1_assuj); - print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''.$object->localtax1_value.'
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print yn($object->localtax1_assuj); - print '
'.$langs->transcountry("TypeLocaltax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); - print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print yn($object->localtax2_assuj); - print '
'.$langs->transcountry("TypeLocaltax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; - $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); - print ''.$object->localtax2_value.'
'.$langs->trans('VATIntra').''; - if ($object->tva_intra) - { - $s=''; - $s.=$object->tva_intra; - $s.=''; - - if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) - { - $s.='   '; - - if ($conf->use_javascript_ajax) - { - print "\n"; - print ''; - print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; - $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1); - } - else - { - $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; - } - } - print $s; - } - else - { - print ' '; - } - print '
'.$langs->trans("ThirdPartyType").''.$object->typent.'
'.$langs->trans("Staff").''.$object->effectif.'
'; - - print '
'; - print '
'; - - print '
'; - print ''; - - // Tags / categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) - { - // Customer - if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { - print ''; - print '"; - } - - // Supplier - if ($object->fournisseur) { - print ''; - print '"; - } - } - - // Legal - print ''; - - // Capital - print ''; - - // Default language - if (! empty($conf->global->MAIN_MULTILANGS)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - print ''; - } - - // Incoterms - if (!empty($conf->incoterm->enabled)) - { - print ''; - print ''; - } - - // Multicurrency - if (! empty($conf->multicurrency->enabled)) - { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - - // Parent company - if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) - { - // Payment term - print ''; - print ''; - } - - // Sales representative - include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; - - // Module Adherent - if (! empty($conf->adherent->enabled)) - { - $langs->load("members"); - print ''; - print ''; - print "\n"; - } - - // Webservices url/key - if (!empty($conf->syncsupplierwebservices->enabled)) { - print ''; - print ''; - } - - print '
' . $langs->trans("CustomersCategoriesShort") . ''; - print $form->showCategories($object->id, 'customer', 1); - print "
' . $langs->trans("SuppliersCategoriesShort") . ''; - print $form->showCategories($object->id, 'supplier', 1); - print "
'.$langs->trans('JuridicalStatus').''.$object->forme_juridique.'
'.$langs->trans('Capital').''; - if ($object->capital) print price($object->capital, '', $langs, 0, -1, -1, $conf->currency); - else print ' '; - print '
'.$langs->trans("DefaultLang").''; - //$s=picto_from_langcode($object->default_lang); - //print ($s?$s.' ':''); - $langs->load("languages"); - $labellang = ($object->default_lang?$langs->trans('Language_'.$object->default_lang):''); - print $labellang; - print '
'; - print '
'; - print $langs->trans('IncotermLabel'); - print ''; - if ($user->rights->societe->creer) print ''.img_edit('', 1).''; - else print ' '; - print '
'; - print '
'; - if ($action != 'editincoterm') - { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); - } - else - { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id); - } - print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code, 1) : ''; - print '
'; - print ''; - if ($action != 'editparentcompany') print ''; - print '
'; - print $langs->trans('ParentCompany'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'
'; - print '
'; - if ($action == 'editparentcompany') - { - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'editparentcompany', 's.rowid <> '.$object->id, 1); - } - else - { - $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'none', 's.rowid <> '.$object->id, 1); - } - print '
'.$langs->trans("LinkedToDolibarrMember").''; - $adh=new Adherent($db); - $result=$adh->fetch('', '', $object->id); - if ($result > 0) - { - $adh->ref=$adh->getFullName($langs); - print $adh->getNomUrl(1); - } - else - { - print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; - } - print '
'.$langs->trans("WebServiceURL").''.dol_print_url($object->webservices_url).''.$langs->trans('WebServiceKey').''.$object->webservices_key.'
'; - print '
'; - - print '
'; - print '
'; - - dol_fiche_end(); - - - /* - * Actions - */ - if ($action != 'presend') - { - print '
'."\n"; - - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) - { - $at_least_one_email_contact = false; - $TContact = $object->contact_array_objects(); - foreach ($TContact as &$contact) - { - if (!empty($contact->email)) - { - $at_least_one_email_contact = true; - break; - } - } - - if (! empty($object->email) || $at_least_one_email_contact) - { - $langs->load("mails"); - print ''; - } - else - { - $langs->load("mails"); - print ''; - } - - if ($user->rights->societe->creer) - { - print ''."\n"; - } - - if ($user->rights->societe->supprimer) - { - print ''; - } - - if ($user->rights->societe->supprimer) - { - if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile - { - print '
'.$langs->trans('Delete').'
'."\n"; - } - else - { - print ''."\n"; - } - } - } - - print '
'."\n"; - } - - //Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - if ($action != 'presend') - { - print '
'; - - if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) - { - print ''; // ancre - - /* - * Documents generes - */ - $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; - $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; - $genallowed=$user->rights->societe->lire; - $delallowed=$user->rights->societe->creer; - - print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); - } - - // Subsidiaries list - if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) - { - $result=show_subsidiaries($conf, $langs, $db, $object); - } - - print '
'; - - $MAXEVENT = 10; - - $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; - - // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty - - print '
'; - - if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) - { - // Contacts list - if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) - { - $result=show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); - } - - // Addresses list - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - $result=show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); - } - } - } - - // Presend form - $modelmail='thirdparty'; - $defaulttopic='Information'; - $diroutput = $conf->societe->dir_output; - $trackid = 'thi'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteEstablishment"), $langs->trans("ConfirmDeleteEstablishment"), "confirm_delete"); } + + + // Object card + // ------------------------------------------------------------ + + $linkback = '' . $langs->trans("BackToList") . ''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', $morehtmlref); + + + print '
'; + //print '
'; + print '
'; + print ''."\n"; + + // Name + print ''; + print ''; + print ''; + print ''; + + // Parent + print ''; + print ''; + print ''; + print ''; + + // Address + print ''; + print ''; + print ''; + print ''; + + // Zipcode + print ''; + print ''; + print ''; + print ''; + + // Town + print ''; + print ''; + print ''; + print ''; + + // Country + print ''; + print ''; + print ''; + print ''; + + print '
'.$langs->trans("Name").''.$object->name.'
'.$langs->trans("Parent").''.$object->getNomUrlParent($object->entity).'
'.$langs->trans("Address").''.$object->address.'
'.$langs->trans("Zipcode").''.$object->zip.'
'.$langs->trans("Town").''.$object->town.'
'.$langs->trans("Country").''; + if ($object->country_id > 0) + { + $img=picto_from_langcode($object->country_code); + print $img?$img.' ':''; + print getCountry($object->getCountryCode(), 0, $db); + } + print '
'; + print '
'; + + print '

'; + + dol_fiche_end(); + + /* + * Barre d'actions + */ + + print '
'; + print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Delete').''; + print '
'; } // End of page From 242bf0ba49801cea750cd6ad2e073a8f3187f095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 26 Feb 2019 22:56:50 +0100 Subject: [PATCH 157/190] Update html.formticket.class.php --- htdocs/core/class/html.formticket.class.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 8d021d48841..cdbf35dc32b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2016 Christophe Battarel +/* Copyright (C) 2013-2015 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * 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 @@ -291,17 +292,17 @@ class FormTicket // Type print '
'; - print $this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2'); + $this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2'); print '
'; - print $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2'); + $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2'); print '
'; - print $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); + $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); print '
'; - print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); + print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print '
'; @@ -122,7 +122,7 @@ else foreach($arrayofparameters as $key => $val) { print '
'; - print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); + print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip')); print '' . $conf->global->$key . '
linkedin.'">
linkedin).'">
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; - print $form->select_establishments(GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity, 'entity', 1); + print $form->selectEstablishments(GETPOST('entity', 'int')>0?GETPOST('entity', 'int'):$conf->entity, 'entity', 1); print '
'.$form->editfieldkey('Parent', 'entity', '', $object, 0, 'string', '', 1).''; - print $form->select_establishments($object->entity>0?$object->entity:$conf->entity, 'entity', 1); + print $form->selectEstablishments($object->entity>0?$object->entity:$conf->entity, 'entity', 1); print '