From 5bbcb58b4435a0ddd5981faa3393a3b63ac57326 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Sun, 28 Dec 2014 01:26:41 +0100 Subject: [PATCH 01/83] Added expressions for product/service prices --- htdocs/core/boxes/box_produits.php | 44 +++++-- .../core/boxes/box_produits_alerte_stock.php | 41 +++++-- htdocs/core/class/html.form.class.php | 29 +++-- htdocs/fourn/ajax/getSupplierPrices.php | 6 +- .../fourn/class/fournisseur.product.class.php | 102 ++++++++-------- .../install/mysql/migration/3.7.0-3.8.0.sql | 4 +- htdocs/install/mysql/tables/llx_product.sql | 1 + .../tables/llx_product_fournisseur_price.sql | 2 +- .../mysql/tables/llx_product_price.sql | 1 + htdocs/langs/en_US/products.lang | 5 +- htdocs/product/class/priceparser.class.php | 111 ++++++++++++++---- htdocs/product/class/product.class.php | 72 ++++++++++-- htdocs/product/expression.php | 13 +- htdocs/product/fournisseurs.php | 15 +-- htdocs/product/index.php | 17 ++- htdocs/product/price.php | 101 ++++++++++++++-- 16 files changed, 423 insertions(+), 141 deletions(-) mode change 100644 => 100755 htdocs/core/boxes/box_produits.php mode change 100644 => 100755 htdocs/core/boxes/box_produits_alerte_stock.php mode change 100644 => 100755 htdocs/install/mysql/tables/llx_product.sql mode change 100644 => 100755 htdocs/install/mysql/tables/llx_product_price.sql mode change 100644 => 100755 htdocs/product/index.php mode change 100644 => 100755 htdocs/product/price.php diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php old mode 100644 new mode 100755 index d3772ff65f1..2a9b9e984a4 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -63,7 +63,7 @@ class box_produits extends ModeleBoxes if ($user->rights->produit->lire || $user->rights->service->lire) { - $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy"; + $sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; @@ -106,17 +106,37 @@ class box_produits extends ModeleBoxes $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->label, 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); - - if ($objp->price_base_type == 'HT') - { - $price=price($objp->price); - $price_base_type=$langs->trans("HT"); - } - else - { - $price=price($objp->price_ttc); - $price_base_type=$langs->trans("TTC"); - } + if (empty($objp->fk_price_expression)) { + if ($objp->price_base_type == 'HT') + { + $price=price($objp->price); + $price_base_type=$langs->trans("HT"); + } + else + { + $price=price($objp->price_ttc); + $price_base_type=$langs->trans("TTC"); + } + } + else //Parse the dinamic price + { + $product = new Product($this->db); + $product->fetch($objp->rowid, '', '', 1); + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProduct($product); + if ($price_result >= 0) { + if ($objp->price_base_type == 'HT') + { + $price_base_type=$langs->trans("HT"); + } + else + { + $price_result = $price_result * (1 + ($product->tva_tx / 100)); + $price_base_type=$langs->trans("TTC"); + } + $price=price($price_result); + } + } $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $price); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php old mode 100644 new mode 100755 index 1079f623492..91e2372e5c8 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -114,16 +114,37 @@ class box_produits_alerte_stock extends ModeleBoxes 'text' => $objp->label, 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); - if ($objp->price_base_type == 'HT') - { - $price=price($objp->price); - $price_base_type=$langs->trans("HT"); - } - else - { - $price=price($objp->price_ttc); - $price_base_type=$langs->trans("TTC"); - } + if (empty($objp->fk_price_expression)) { + if ($objp->price_base_type == 'HT') + { + $price=price($objp->price); + $price_base_type=$langs->trans("HT"); + } + else + { + $price=price($objp->price_ttc); + $price_base_type=$langs->trans("TTC"); + } + } + else //Parse the dinamic price + { + $product = new Product($this->db); + $product->fetch($objp->rowid, '', '', 1); + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProduct($product); + if ($price_result >= 0) { + if ($objp->price_base_type == 'HT') + { + $price_base_type=$langs->trans("HT"); + } + else + { + $price_result = $price_result * (1 + ($product->tva_tx / 100)); + $price_base_type=$langs->trans("TTC"); + } + $price=price($price_result); + } + } $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $price); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 08bc3b4c85e..678a4d57140 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1522,7 +1522,7 @@ class Form $outarray=array(); $sql = "SELECT "; - $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock"; + $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression"; //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { @@ -1601,6 +1601,8 @@ class Form $result=$this->db->query($sql); if ($result) { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/class/priceparser.class.php'; $num = $this->db->num_rows($result); $out.=''.$form->textwithpicto($langs->trans("PriceExpressionEditor"),$langs->trans("PriceExpressionEditorHelp"),1).''; +$help_text = $langs->trans("PriceExpressionEditorHelp1").'

'.$langs->trans("PriceExpressionEditorHelp2").'

'.$langs->trans("PriceExpressionEditorHelp3").'

'.$langs->trans("PriceExpressionEditorHelp4"); +print ''.$form->textwithpicto($langs->trans("PriceExpressionEditor"),$help_text,1).''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('expression',isset($price_expression->expression)?$price_expression->expression:'','',300,'','',false,false,false,4,80); $doleditor->Create(); @@ -202,7 +209,7 @@ print ''; print ''; -// This code reloads the page depending of selected option, goes back in history when back is pressed +// This code reloads the page depending of selected option, goes to page selected by tab when back is pressed print ''; + } // Price - print ''; + $product = new Product($db); + $product->fetch($id, $ref, '', 1); //Ignore the math expression when getting the price + print ''; $text = $langs->trans('SellingPrice'); print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); print ''; if ($object->price_base_type == 'TTC') { - print ''; + print ''; } else { - print ''; + print ''; } print ''; @@ -732,7 +797,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> // Liste des evolutions du prix $sql = "SELECT p.rowid, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.recuperableonly,"; $sql .= " p.price_level, p.price_min, p.price_min_ttc,p.price_by_qty,"; -$sql .= " p.date_price as dp, u.rowid as user_id, u.login"; +$sql .= " p.date_price as dp, p.fk_price_expression, u.rowid as user_id, u.login"; $sql .= " FROM " . MAIN_DB_PREFIX . "product_price as p,"; $sql .= " " . MAIN_DB_PREFIX . "user as u"; $sql .= " WHERE fk_product = " . $object->id; @@ -777,6 +842,9 @@ if ($result) { print '' . $langs->trans("VAT") . ''; print '' . $langs->trans("HT") . ''; print '' . $langs->trans("TTC") . ''; + if (! empty($conf->dynamicprices->enabled)) { + print '' . $langs->trans("PriceExpressionSelected") . ''; + } print '' . $langs->trans("MinPrice") . ' ' . $langs->trans("HT") . ''; print '' . $langs->trans("MinPrice") . ' ' . $langs->trans("TTC") . ''; print '' . $langs->trans("ChangedBy") . ''; @@ -805,8 +873,25 @@ if ($result) { print '' . $langs->trans($objp->price_base_type) . ""; print '' . vatrate($objp->tva_tx, true, $objp->recuperableonly) . ""; - print '' . price($objp->price) . ""; - print '' . price($objp->price_ttc) . ""; + + //Price + if (! empty($objp->fk_price_expression) && ! empty($conf->dynamicprices->enabled)) + { + $price_expression = new PriceExpression($db); + $res = $price_expression->fetch($objp->fk_price_expression); + $title = $price_expression->title; + print ''; + print ''; + print '' . $title . ""; + } + else + { + print '' . price($objp->price) . ""; + print '' . price($objp->price_ttc) . ""; + if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled + print ''; + } + } print '' . price($objp->price_min) . ''; print '' . price($objp->price_min_ttc) . ''; From c667f8734a61621acc18095b98c3cec4561e8ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 18 Jan 2015 16:42:11 +0100 Subject: [PATCH 02/83] [ task #1793 ] Create new permission to restrict commercial agent margin to logged user --- ChangeLog | 1 + htdocs/core/modules/modMargin.class.php | 9 +++++++++ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/margins.lang | 1 + htdocs/margin/agentMargins.php | 18 +++++++++++++----- htdocs/margin/lib/margins.lib.php | 12 +++++++++--- 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6691ddb2007..67bb5d91ba2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ For users: MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price. - Introduce option MAIN_HTML_TITLE to start to control format of html title content. - Add extrafields on bank account cards. +- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user For translators: - Update language files. diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php index 19100576a83..a9bfb987ca1 100644 --- a/htdocs/core/modules/modMargin.class.php +++ b/htdocs/core/modules/modMargin.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 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 @@ -129,6 +130,14 @@ class modMargin extends DolibarrModules $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; + + $r++; + $this->rights[$r][0] = 59003; // id de la permission + $this->rights[$r][1] = 'Read every user margin'; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'read'; + $this->rights[$r][5] = 'all'; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0b328e705a7..391c6eeaef6 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -761,6 +761,7 @@ Permission55001=Read polls Permission55002=Create/modify polls Permission59001=Read commercial margins Permission59002=Define commercial margins +Permission59003=Read every user margin DictionaryCompanyType=Thirdparties type DictionaryCompanyJuridicalType=Juridical kinds of thirdparties DictionaryProspectLevel=Prospect potential level diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index 0cf9bc34410..bc7446f51f9 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -16,6 +16,7 @@ MarginDetails=Margin details ProductMargins=Product margins CustomerMargins=Customer margins SalesRepresentativeMargins=Sales representative margins +UserMargins=User margins ProductService=Product or Service AllProducts=All products and services ChooseProduct/Service=Choose product or service diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 8a0aefba711..32525114ee3 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -1,6 +1,7 @@ * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2015 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 @@ -34,7 +35,12 @@ $langs->load("products"); $langs->load("margins"); // Security check -$agentid = GETPOST('agentid','int'); + +if ($user->rights->margin->read->all) { + $agentid = GETPOST('agentid', 'int'); +} else { + $agentid = $user->id; +} $mesg = ''; @@ -85,10 +91,12 @@ dol_fiche_head($head, 'agentMargins', $titre, 0, $picto); print '
'; print ''; -print ''; -print ''; +if ($user->rights->margin->read->all) { + print ''; + print ''; +} // Start date print ''; diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index d3ffd9c1bf4..39f9acc5ae4 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 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 @@ -56,7 +57,7 @@ function marges_admin_prepare_head() */ function marges_prepare_head() { - global $langs, $conf; + global $langs, $conf, $user; $langs->load("marges@marges"); $h = 0; @@ -72,10 +73,15 @@ function marges_prepare_head() $head[$h][2] = 'customerMargins'; $h++; + if ($user->rights->margin->read->all) { + $title = 'UserMargins'; + } else { + $title = 'SalesRepresentativeMargins'; + } + $head[$h][0] = DOL_URL_ROOT."/margin/agentMargins.php"; - $head[$h][1] = $langs->trans("SalesRepresentativeMargins"); + $head[$h][1] = $langs->trans($title); $head[$h][2] = 'agentMargins'; - $h++; return $head; } From 2c01370ce6f4dcb148e92459a094ed7e1041153a Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Wed, 21 Jan 2015 05:22:46 +0100 Subject: [PATCH 03/83] Reimplemented 'find_min_price_product_fournisseur()' --- .../fourn/class/fournisseur.product.class.php | 88 +++++++++++++------ 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index dd31e64deee..76577dc9ea6 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -350,7 +350,7 @@ class ProductFournisseur extends Product $this->fourn_remise = $obj->remise; $this->fourn_unitprice = $obj->unitprice; $this->fourn_unitcharges = $obj->unitcharges; - $this->tva_tx = $obj->tva_tx; + $this->fourn_tva_tx = $obj->tva_tx; $this->product_id = $obj->fk_product; // deprecated $this->fk_product = $obj->fk_product; $this->fk_availability = $obj->fk_availability; @@ -476,11 +476,11 @@ class ProductFournisseur extends Product } /** - * Load properties for minimum price + * Load properties for minimum price * - * @param int $prodid Product id - * @param int $qty Minimum quantity - * @return int <0 if KO, >0 if OK, 0 if empty + * @param int $prodid Product id + * @param int $qty Minimum quantity + * @return int <0 if KO, >0 if OK */ function find_min_price_product_fournisseur($prodid, $qty=0) { @@ -498,41 +498,79 @@ class ProductFournisseur extends Product $this->fourn_name = ''; $this->id = ''; - $product_fourn_list = $this->list_product_fournisseur_price($prodid); + $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; + $sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,"; + $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges, "; + $sql.= " pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; + $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; + $sql.= " AND pfp.fk_product = ".$prodid; + $sql.= " AND pfp.fk_soc = s.rowid"; + if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG); - if (is_array($product_fourn_list)) + $resql = $this->db->query($sql); + if ($resql) { - if (count($product_fourn_list) == 0) + $record_array = array(); + + //Store each record to array for later search of min + while ($record = $this->db->fetch_array($resql)) { + $record_array[]=$record; + } + + if (count($record_array) == 0) + { + $this->db->free($resql); return 0; } else { $min = -1; - foreach($product_fourn_list as $productfourn) + foreach($record_array as $record) { - if ($productfourn->fourn_price < $min || $min == -1) + $fourn_price = $record["price"]; + $fourn_unitprice = $record["unitprice"]; + if (!empty($record["fk_supplier_price_expression"])) { + $priceparser = new PriceParser($this->db); + $price_result = $priceparser->parseProductSupplier($prodid, $record["fk_supplier_price_expression"], $record["quantity"], $record["tva_tx"]); + if ($price_result >= 0) { + $fourn_price = price2num($price_result,'MU'); + if ($record["quantity"] != 0) + { + $fourn_unitprice = price2num($fourn_price/$record["quantity"],'MU'); + } + else + { + $fourn_unitprice = $fourn_price; + } + } + } + if ($fourn_unitprice < $min || $min == -1) { - $this->product_fourn_price_id = $productfourn->product_fourn_price_id; - $this->fourn_ref = $productfourn->fourn_ref; - $this->fourn_price = $productfourn->fourn_price; - $this->fourn_qty = $productfourn->fourn_qty; - $this->fourn_remise_percent = $productfourn->fourn_remise_percent; - $this->fourn_remise = $productfourn->fourn_remise; - $this->fourn_unitprice = $productfourn->fourn_unitprice; - $this->fourn_charges = $productfourn->fourn_charges; - $this->fourn_unitcharges = $productfourn->fourn_unitcharges; - $this->fourn_tva_tx = $productfourn->fourn_tva_tx; - $this->fourn_id = $productfourn->fourn_id; - $this->fourn_name = $productfourn->fourn_name; - $this->fk_supplier_price_expression = $productfourn->fk_supplier_price_expression; - $this->id = $productfourn->id; + $this->product_fourn_price_id = $record["product_fourn_price_id"]; + $this->fourn_ref = $record["ref_fourn"]; + $this->fourn_price = $fourn_price; + $this->fourn_qty = $record["quantity"]; + $this->fourn_remise_percent = $record["remise_percent"]; + $this->fourn_remise = $record["remise"]; + $this->fourn_unitprice = $fourn_unitprice; + $this->fourn_charges = $record["charges"]; + $this->fourn_unitcharges = $record["unitcharges"]; + $this->fourn_tva_tx = $record["tva_tx"]; + $this->fourn_id = $record["fourn_id"]; + $this->fourn_name = $record["supplier_name"]; + $this->fk_supplier_price_expression = $record["fk_supplier_price_expression"]; + $this->id = $prodid; + $min = $this->fourn_unitprice; } } - return 1; } + + $this->db->free($resql); + return 1; } else { From 925aa2039bb8a7445e0573427a4ba31d34af6ebd Mon Sep 17 00:00:00 2001 From: frederic34 Date: Fri, 23 Jan 2015 00:55:24 +0100 Subject: [PATCH 04/83] Tooltip and cache for boxes --- htdocs/comm/card.php | 6 +- htdocs/core/boxes/box_activity.php | 8 +- htdocs/core/boxes/box_comptes.php | 6 +- htdocs/core/boxes/box_members.php | 68 ++++--- htdocs/core/boxes/box_produits.php | 85 +++++--- htdocs/core/boxes/modules_boxes.php | 257 +++++++++++++------------ htdocs/public/test/test_arrays.php | 2 +- htdocs/public/test/test_forms.php | 2 +- htdocs/societe/class/societe.class.php | 6 +- htdocs/societe/soc.php | 4 +- 10 files changed, 252 insertions(+), 192 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 8fdab8115a6..2ad30d3b4b9 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -500,7 +500,7 @@ if ($id > 0) { $propal_static = new Propal($db); - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.ref_client, p.remise, "; $sql.= " p.datep as dp, p.fin_validite as datelimite"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; @@ -534,6 +534,7 @@ if ($id > 0) print '\n"; print ''; diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 9eaeb1d8cb4..e1f67ffc88e 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -94,7 +94,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); - $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $data = array(); if ($refresh) { @@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes ); } - $cachefile = DOL_DATA_ROOT.'/facture/temp/boxactivity-invoice2'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice2'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); if ($refresh) { @@ -255,7 +255,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); - $cachefile = DOL_DATA_ROOT.'/commande/temp/boxactivity-order'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-order'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $data = array(); if ($refresh) { @@ -334,7 +334,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); - $cachefile = DOL_DATA_ROOT.'/propale/temp/boxactivity-propal'.$fileid; + $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-propal'.$fileid; $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); $data = array(); if ($refresh) { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 5340b06f0dd..6a6f12e502d 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -127,7 +127,7 @@ class box_comptes extends ModeleBoxes $this->info_box_contents[$i][3] = array( 'td' => 'align="right"', - 'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code) + 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); $i++; @@ -148,10 +148,10 @@ class box_comptes extends ModeleBoxes 'td' => 'align="right" class="liste_total"', 'text' => ' ' ); - $totalamount=price($solde,0,$langs,0,0,-1,$key); + $this->info_box_contents[$i][3] = array( 'td' => 'align="right" class="liste_total"', - 'text' => $totalamount + 'text' => price($solde, 0, $langs, 0, 0, -1, $key) ); $i++; } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 4760a3aaf89..1e87995203a 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -113,39 +113,55 @@ class box_members extends ModeleBoxes $memberstatic->name=$objp->company; } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $memberstatic->getFullName($langs), + 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $memberstatic->getFullName($langs), - 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $memberstatic->getFullName($langs), + 'tooltip' => $memberstatic->getFullName($langs), + 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3)); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => $memberstatic->LibStatut($objp->status,$objp->cotisation,$db->jdate($objp->date_end_subscription),3), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedCustomers")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedCustomers"), + ); - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('align' => 'left', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'align' => 'left', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } - } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index d3772ff65f1..ac1d3d9ec19 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -99,13 +99,19 @@ class box_produits extends ModeleBoxes } } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), + 'tooltip' => $objp->label, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + 'tooltip' => $objp->label, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + ); if ($objp->price_base_type == 'HT') { @@ -117,39 +123,54 @@ class box_produits extends ModeleBoxes $price=price($objp->price_ttc); $price_base_type=$langs->trans("TTC"); } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => $price, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', - 'text' => $price_base_type); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datem,'day')); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem,'day'), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tosell,3,0)); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tosell,3,0), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tobuy,3,1)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tobuy,3,1), + ); $i++; - } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProducts")); + } + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedProducts"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } + } /** * Method to show box diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index aed954fea97..ec1565943c7 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -178,153 +178,172 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" */ function showBox($head, $contents) { - global $langs,$conf; + global $langs, $user, $conf; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite $bcx=array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; + $now = dol_now(); + $cachetime = 900; // 900 : 15mn + $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; + $cachedir = DOL_DATA_ROOT.'/cache/boxes'; + if (! dol_is_dir($cachedir)) dol_mkdir($cachedir); + $cachefile = $cachedir.'/box-'.$fileid; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $out = ''; - dol_syslog(get_class($this).'::showBox'); + if ($refresh) { + dol_syslog(get_class($this).'::showBox'); - // Define nbcol and nblines of the box to show - $nbcol=0; - if (isset($contents[0])) $nbcol=count($contents[0]); - $nblines=count($contents); + // Define nbcol and nblines of the box to show + $nbcol=0; + if (isset($contents[0])) $nbcol=count($contents[0]); + $nblines=count($contents); - print "\n\n\n"; - print '
'."\n"; + $out.= "\n\n"; + $out.= '
'."\n"; - if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) - { - print '
'.$langs->trans('SalesRepresentative').''; -print $form->select_dolusers($agentid,'agentid',1); -print '
'.$langs->trans('SalesRepresentative').''; + print $form->select_dolusers($agentid, 'agentid', 1); + print '
'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')'; $propal_static->id=$objp->propalid; $propal_static->ref=$objp->ref; + $propal_static->ref_client=$objp->ref_client; print $propal_static->getNomUrl(1); if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); @@ -561,7 +562,7 @@ if ($id > 0) $commande_static=new Commande($db); $sql = "SELECT s.nom, s.rowid,"; - $sql.= " c.rowid as cid, c.total_ht, c.ref, c.fk_statut, c.facture,"; + $sql.= " c.rowid as cid, c.total_ht, c.ref, c.ref_client, c.fk_statut, c.facture,"; $sql.= " c.date_commande as dc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql.= " WHERE c.fk_soc = s.rowid "; @@ -611,6 +612,7 @@ if ($id > 0) print ''; $commande_static->id=$objp->cid; $commande_static->ref=$objp->ref; + $commande_static->ref_client=$objp->ref_client; print $commande_static->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dc),'day')."'.price($objp->total_ht).'
'."\n"; - } + if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) + { + $out.= '
'."\n"; + } - // Show box title - if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto'])) - { - //print '
'."\n"; - //print '
'."\n"; - print ''; - print ' 0) { print ' colspan="'.$nbcol.'"'; } - print '>'; - if ($conf->use_javascript_ajax) - { - print '
'; - } - if (! empty($head['text'])) - { - $s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX); - print $s; - } - print ' '; - if (! empty($head['sublink'])) print ''; - if (! empty($head['subpicto'])) print img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); - if (! empty($head['sublink'])) ''; - if (! empty($conf->use_javascript_ajax)) - { - print ''; - // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); - print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); - $label=$head['text']; - if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; - print ''; - print '
'; - } - print ''; - print "\n"; - //print "\n"; - //print "\n"; - } + // Show box title + if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto'])) + { + //$out.= '
'."\n"; + //$out.= ''."\n"; + $out.= ''; + $out.= ' 0) { $out.= ' colspan="'.$nbcol.'"'; } + $out.= '>'; + if ($conf->use_javascript_ajax) + { + $out.= '
'; + } + if (! empty($head['text'])) + { + $s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX); + $out.= $s; + } + $out.= ' '; + if (! empty($head['sublink'])) $out.= ''; + if (! empty($head['subpicto'])) $out.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); + if (! empty($head['sublink'])) ''; + if (! empty($conf->use_javascript_ajax)) + { + $out.= ''; + // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object + $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); + $out.= img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + $label=$head['text']; + if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; + $out.= ''; + $out.= '
'; + } + $out.= ''; + $out.= "\n"; + //$out.= "\n"; + //$out.= "
\n"; + } - // Show box lines - if ($nblines) - { - //print ''."\n"; - // Loop on each record - for ($i=0, $n=$nblines; $i < $n; $i++) - { - if (isset($contents[$i])) - { - $var=!$var; + // Show box lines + if ($nblines) + { + //$out.= '
'."\n"; + // Loop on each record + for ($i=0, $n=$nblines; $i < $n; $i++) + { + if (isset($contents[$i])) + { + $var=!$var; - // TR - if (isset($contents[$i][0]['tr'])) print ''; - else print ''; + // TR + if (isset($contents[$i][0]['tr'])) $out.= ''; + else $out.= ''; - // Loop on each TD - $nbcolthisline=count($contents[$i]); - for ($j=0; $j < $nbcolthisline; $j++) { - // Define tdparam - $tdparam=''; - if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; + // Loop on each TD + $nbcolthisline=count($contents[$i]); + for ($j=0; $j < $nbcolthisline; $j++) { + // Define tdparam + $tdparam=''; + if (isset($contents[$i][$j]['td'])) $tdparam.=' '.$contents[$i][$j]['td']; - if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']=""; - $text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; - $textwithnotags=preg_replace('/<([^>]+)>/i','',$text); - $text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; - $text2withnotags=preg_replace('/<([^>]+)>/i','',$text2); - $textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:''; - //print "xxx $textwithnotags y"; - if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']=""; - $tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:''; + if (empty($contents[$i][$j]['text'])) $contents[$i][$j]['text']=""; + $text=isset($contents[$i][$j]['text'])?$contents[$i][$j]['text']:''; + $textwithnotags=preg_replace('/<([^>]+)>/i','',$text); + $text2=isset($contents[$i][$j]['text2'])?$contents[$i][$j]['text2']:''; + $text2withnotags=preg_replace('/<([^>]+)>/i','',$text2); + $textnoformat=isset($contents[$i][$j]['textnoformat'])?$contents[$i][$j]['textnoformat']:''; + //$out.= "xxx $textwithnotags y"; + if (empty($contents[$i][$j]['tooltip'])) $contents[$i][$j]['tooltip']=""; + $tooltip=isset($contents[$i][$j]['tooltip'])?$contents[$i][$j]['tooltip']:''; - print ''."\n"; + $out.= ''."\n"; - // Url - if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) - { - print '" - print isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; - print '>'; - } + // Url + if (! empty($contents[$i][$j]['url']) && empty($contents[$i][$j]['logo'])) + { + $out.= '" + $out.= isset($contents[$i][$j]['target'])?' target="'.$contents[$i][$j]['target'].'"':''; + $out.= '>'; + } - // Logo - if (! empty($contents[$i][$j]['logo'])) - { - $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); - print ''; - print img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"'); - } + // Logo + if (! empty($contents[$i][$j]['logo'])) + { + $logo=preg_replace("/^object_/i","",$contents[$i][$j]['logo']); + $out.= ''; + $out.= img_object($langs->trans("Show").' '.$tooltip, $logo, 'class="classfortooltip"'); + } - $maxlength=$MAXLENGTHBOX; - if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; + $maxlength=$MAXLENGTHBOX; + if (! empty($contents[$i][$j]['maxlength'])) $maxlength=$contents[$i][$j]['maxlength']; - if ($maxlength) $textwithnotags=dol_trunc($textwithnotags,$maxlength); - if (preg_match('/^'; + // End Url + if (! empty($contents[$i][$j]['url'])) $out.= ''; - if (preg_match('/^\n"; - } + $out.= "\n"; + } - print "\n"; - } - } - } + $out.= "\n"; + } + } + } - if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) - { - print "
\n"; - } + if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto']) || $nblines) + { + $out.= "\n"; + } - // If invisible box with no contents - if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) print "
\n"; + // If invisible box with no contents + if (empty($head['text']) && empty($head['sublink']) && empty($head['subpicto']) && ! $nblines) $out.= "
\n"; - print "\n"; - print "\n\n"; - } + $out.= "\n"; + $out.= "\n\n"; + file_put_contents($cachefile,serialize($out),LOCK_EX); + } else { + dol_syslog(get_class($this).'::showBoxCached'); + $out = unserialize(file_get_contents($cachefile)); + print ""; + + } + print $out; + } } diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 5ff161f0b1a..cae90530d36 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -7,7 +7,7 @@ require '../../main.inc.php'; if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available only frome remote address 127.0.0.1"; + print "Page available only from remote address 127.0.0.1"; exit; } diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index ece0c218160..e8841eea580 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -8,7 +8,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') { - print "Page available only frome remote address 127.0.0.1"; + print "Page available only from remote address 127.0.0.1"; exit; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4ce603ee1ad..e1f2e424dee 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1748,11 +1748,13 @@ class Societe extends CommonObject $lien = 'canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($name, 1).'" class="classfortooltip">'; + $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $lienfin=''; - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCompany").': '.$name, 'company', 'class="classfortooltip"').$lienfin); + if ($withpicto) $result.=($lien.img_object($label, 'company', 'class="classfortooltip"').$lienfin); if ($withpicto && $withpicto != 2) $result.=' '; $result.=$lien.($maxlen?dol_trunc($name,$maxlen):$name).$lienfin; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 5cde8eb572a..d0d9c9cbb47 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1181,8 +1181,8 @@ else $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->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'); From e18577aa620ff6343c870f54818157c11335a15e Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sat, 24 Jan 2015 15:36:47 +0100 Subject: [PATCH 05/83] Tooltip and lib for file cache --- htdocs/adherents/class/adherent.class.php | 3 +- htdocs/admin/ihm.php | 23 +++- .../comm/propal/tpl/linkedobjectblock.tpl.php | 4 +- htdocs/commande/class/commande.class.php | 14 ++- htdocs/commande/list.php | 6 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 8 +- htdocs/compta/facture/class/facture.class.php | 2 + .../facture/tpl/linkedobjectblock.tpl.php | 8 +- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 4 +- htdocs/core/boxes/box_actions.php | 21 ++-- htdocs/core/boxes/box_activity.php | 44 ++++--- htdocs/core/boxes/box_comptes.php | 7 +- htdocs/core/boxes/box_factures_fourn_imp.php | 109 +++++++++++------- htdocs/core/boxes/box_fournisseurs.php | 58 ++++++---- .../core/boxes/box_produits_alerte_stock.php | 70 +++++++---- htdocs/core/boxes/box_project.php | 46 ++++++-- htdocs/core/boxes/box_propales.php | 102 +++++++++------- htdocs/core/boxes/box_prospect.php | 69 ++++++----- htdocs/core/boxes/box_supplier_orders.php | 85 +++++++++----- htdocs/core/boxes/modules_boxes.php | 15 +-- htdocs/core/lib/files.lib.php | 46 ++++++++ .../expedition/tpl/linkedobjectblock.tpl.php | 4 +- .../fichinter/tpl/linkedobjectblock.tpl.php | 4 +- .../class/fournisseur.commande.class.php | 12 +- htdocs/fourn/commande/list.php | 11 +- htdocs/langs/en_US/sendings.lang | 1 + htdocs/product/class/product.class.php | 8 +- htdocs/product/list.php | 1 + htdocs/product/stock/class/entrepot.class.php | 5 +- htdocs/product/stock/list.php | 7 +- 30 files changed, 540 insertions(+), 257 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index f4459adec9f..6ecb4045386 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1563,7 +1563,8 @@ class Adherent extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowMember").': '.$this->ref; + $label = '' . $langs->trans("ShowMember") . ''; + $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'card') diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 6ebf107ffbe..fb685b3d74b 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -63,6 +63,7 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_ACTIVATE_HTML5", $_POST["MAIN_ACTIVATE_HTML5"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity); @@ -173,7 +174,7 @@ if ($action == 'edit') // Edit print ''; print ' '; print ''; - + // Activate Html5 - Developement - Only available on Eldy template if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) { @@ -185,6 +186,16 @@ if ($action == 'edit') // Edit print ''; } + // Activate FileCache - Developement + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + $var=!$var; + print ''.$langs->trans("EnableFileCache").''; + print $form->selectyesno('MAIN_ACTIVATE_FILECACHE',$conf->global->MAIN_ACTIVATE_FILECACHE,1); + print ''; + print ' '; + print ''; + } + // Max size of lists $var=!$var; print ''.$langs->trans("DefaultMaxSizeList").''; @@ -363,7 +374,7 @@ else // Show print ''.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ''; print ' '; print ""; - + // Activate Html5 - Developement - Only available on Eldy template if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_HTML5)) { @@ -373,6 +384,14 @@ else // Show print ""; } + // Activate FileCache - Developement + if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + $var=!$var; + print ''.$langs->trans("EnableFileCache").'' . yn($conf->global->MAIN_ACTIVATE_FILECACHE) . ''; + print ' '; + print ""; + } + $var=!$var; print ''.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . ''; print ' '; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index cb920afd5fc..19763f8510c 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -51,8 +51,8 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > - trans("ShowPropal"),"propal").' '.$object->ref; ?> + > + getNomUrl(1); ?> ref_client; ?> date,'day'); ?> trans("ShowOrder").': '.$this->ref; + $picto = 'order'; + $label = '' . $langs->trans("ShowOrder") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + $label.= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $linkstart = ''; $linkend=''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2c30f4128c6..a0a38d50800 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -109,7 +109,7 @@ $companystatic = new Societe($db); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; llxHeader('',$langs->trans("Orders"),$help_url); -$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,'; +$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; @@ -334,6 +334,10 @@ if ($resql) $generic_commande->id=$objp->rowid; $generic_commande->ref=$objp->ref; + $generic_commande->ref_client = $objp->ref_client; + $generic_commande->total_ht = $objp->total_ht; + $generic_commande->total_tva = $objp->total_tva; + $generic_commande->total_ttc = $objp->total_ttc; $generic_commande->lines=array(); $generic_commande->getLinesArray(); diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index c47aefe0958..cabb63aa2b1 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -36,6 +36,7 @@ print_titre($langs->trans('RelatedOrders')); + @@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + + - + '; + print ''; + print ''; + print ''; + print ''; + + print '
trans("Ref"); ?>trans("RefCustomer"); ?> trans("Date"); ?> trans("AmountHTShort"); ?> trans("Status"); ?>
- trans("ShowOrder"),"order").' '.$object->ref; ?>
getNomUrl(1); ?>ref_client; ?> date,'day'); ?> rights->commande->lire) { @@ -62,7 +64,7 @@ foreach($linkedObjectBlock as $object) ?>
trans('TotalHT'); ?>trans('TotalHT'); ?> rights->commande->lire) { echo price($total); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 32d7fa13122..d30a19cd040 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -859,6 +859,8 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice $label=$langs->trans("ShowInvoice").': '.$this->ref; + if (! empty($this->ref_client)) + $label.= '
' . $langs->trans('RefCustomer') . $this->ref_client; if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index ae3038a6021..12f40f8ef97 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -36,6 +36,7 @@ else print_titre($langs->trans("RelatedBill")); + @@ -47,8 +48,9 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + + - + > + > + diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index ed5e731d896..06d70d65db0 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -95,10 +95,11 @@ class box_actions extends ModeleBoxes //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) $label=empty($objp->label)?$objp->type_label:$objp->label; + $tooltip = $langs->trans('Action'.$objp->code).': '.$label; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', 'logo' => ("action"), - 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, ); @@ -106,21 +107,22 @@ class box_actions extends ModeleBoxes 'td' => 'align="left"', 'text' => dol_trunc($label,32), 'text2'=> $late, - 'tooltip' => $langs->trans('Action'.$objp->code).': '.$label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, ); + $tooltip = $langs->trans('Customer').': '.$objp->name; $this->info_box_contents[$i][2] = array( 'td' => 'align="left" width="16"', 'logo' => ($objp->socid?'company':''), - 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'tooltip' => $tooltip, 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''), ); $this->info_box_contents[$i][3] = array( 'td' => 'align="left"', 'text' => dol_trunc($objp->name,24), - 'tooltip' => $langs->trans('Customer').': '.$objp->name, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid, ); @@ -142,9 +144,13 @@ class box_actions extends ModeleBoxes $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoActionsToDo")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoActionsToDo"), + ); - $db->free($result); + $db->free($result); } else { $this->info_box_contents[0][0] = array( 'td' => 'align="left"', @@ -171,8 +177,7 @@ class box_actions extends ModeleBoxes { global $langs, $conf; parent::showBox($this->info_box_head, $this->info_box_contents); - if ($conf->global->SHOW_DIALOG_HOMEPAGE) - { + if ($conf->global->SHOW_DIALOG_HOMEPAGE) { $actioncejour=false; $contents=$this->info_box_contents; $nblines=count($contents); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index e1f67ffc88e..dcc2b99c887 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -75,6 +75,7 @@ class box_activity extends ModeleBoxes $totalnb = 0; $i = 0; $cachetime = 3600; + $cachedir = DOL_DATA_ROOT.'/cache/boxes'; $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; $now = dol_now(); $nbofyears=2; @@ -94,8 +95,9 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-invoice'.$fileid; + + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); if ($refresh) { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; @@ -118,13 +120,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; @@ -173,8 +177,9 @@ class box_activity extends ModeleBoxes ); } - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-invoice2'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-invoice2'.$fileid; + + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); if ($refresh) { $sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; @@ -193,13 +198,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; @@ -255,9 +262,10 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-order'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-order'.$fileid; + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); + if ($refresh) { $sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb"; @@ -282,13 +290,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; @@ -334,8 +344,8 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); - $cachefile = DOL_DATA_ROOT.'/cache/boxes/boxactivity-propal'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $filename = '/boxactivity-propal'.$fileid; + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); if ($refresh) { $sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb"; @@ -360,13 +370,15 @@ class box_activity extends ModeleBoxes $data[$j]=$db->fetch_object($result); $j++; } - file_put_contents($cachefile,serialize($data),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $data); + } $db->free($result); } else { dol_print_error($db); } } else { - $data = unserialize(file_get_contents($cachefile)); + $data = dol_readcachefile($cachedir, $filename); } if (! empty($data)) { $j=0; diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 6a6f12e502d..da585f7ea71 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -106,17 +106,18 @@ class box_comptes extends ModeleBoxes $solde_total[$objp->currency_code] += $solde; + $tooltip = $langs->trans('Account').': '.$objp->label . '
' . $langs->trans('AccountNumber').': '.$objp->number; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Account').': '.$objp->label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, ); $this->info_box_contents[$i][1] = array( 'td' => 'align="left"', 'text' => $objp->label, - 'tooltip' => $langs->trans('Account').': '.$objp->label, + 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, ); @@ -151,7 +152,7 @@ class box_comptes extends ModeleBoxes $this->info_box_contents[$i][3] = array( 'td' => 'align="right" class="liste_total"', - 'text' => price($solde, 0, $langs, 0, 0, -1, $key) + 'text' => price($solde, 0, $langs, 0, -1, -1, $key) ); $i++; } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index aa217f1c436..37b42f70cfa 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/core/boxes/box_factures_fourn_imp.php + * \file htdocs/core/boxes/box_factures_fourn_imp.php * \ingroup fournisseur - * \brief Fichier de gestion d'une box des factures fournisseurs impayees + * \brief Fichier de gestion d'une box des factures fournisseurs impayees */ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; @@ -29,9 +29,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_factures_fourn_imp extends ModeleBoxes { - var $boxcode="oldestunpaidsupplierbills"; - var $boximg="object_bill"; - var $boxlabel="BoxOldestUnpaidSupplierBills"; + var $boxcode = "oldestunpaidsupplierbills"; + var $boximg = "object_bill"; + var $boxlabel = "BoxOldestUnpaidSupplierBills"; var $depends = array("facture","fournisseur"); var $db; @@ -93,55 +93,82 @@ class box_factures_fourn_imp extends ModeleBoxes $late=''; if ($datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '
' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->facid), - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => ($objp->ref?$objp->ref:$objp->facid), + 'text2'=> $late, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left"', - 'text' => $objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left"', + 'text' => $objp->ref_supplier, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $tooltip = $langs->trans('Supplier') . ': '. $objp->name; + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($datelimite,'day')); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datelimite,'day'), + ); $fac = new FactureFournisseur($db); $fac->fetch($objp->facid); $alreadypaid=$fac->getSommePaiement(); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidSupplierBills")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoUnpaidSupplierBills"), + ); - $db->free($result); - } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } - } + } /** * Method to show box diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index f233221ccaa..19850598505 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -84,36 +84,52 @@ class box_fournisseurs extends ModeleBoxes $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $tooltip = $langs->trans('Supplier') . ': ' . $objp->name; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => $thirdpartystatic->LibStatut($objp->status,3)); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => $thirdpartystatic->LibStatut($objp->status,3), + ); $i++; } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers")); + if ($num==0) $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedSuppliers"), + ); - $db->free($result); + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } - else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 1079f623492..5a1b898fc1f 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -83,8 +83,7 @@ class box_produits_alerte_stock extends ModeleBoxes $langs->load("stocks"); $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $datem=$db->jdate($objp->tms); @@ -106,13 +105,20 @@ class box_produits_alerte_stock extends ModeleBoxes } } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $tooltip = $langs->trans('Product') . ': ' . $objp->label; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->label, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, + ); if ($objp->price_base_type == 'HT') { @@ -124,33 +130,49 @@ class box_produits_alerte_stock extends ModeleBoxes $price=price($objp->price_ttc); $price_base_type=$langs->trans("TTC"); } - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => $price); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => $price, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left" class="nowrap"', - 'text' => $price_base_type); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left" class="nowrap"', + 'text' => $price_base_type, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="center"', - 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte, - 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit"))); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="center"', + 'text' => $objp->total_stock . ' / '.$objp->seuil_stock_alerte, + 'text2'=>img_warning($langs->transnoentitiesnoconv("StockLowerThanLimit")), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tosell,3,0)); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tosell,3,0), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $productstatic->LibStatut($objp->tobuy,3,1)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $productstatic->LibStatut($objp->tobuy,3,1), + ); $i++; - } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoTooLowStockProducts")); + } + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoTooLowStockProducts"), + ); $db->free($result); } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } } else { diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index ef38a2537e6..b765c99c836 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -90,21 +90,24 @@ class box_project extends ModeleBoxes while ($i < $num) { $objp = $db->fetch_object($result); + $tooltip = $langs->trans('Project') . ': ' . $objp->ref; $this->info_box_contents[$i][0] = array( 'td' => 'align="left" width="16"', 'logo' => 'object_project', - 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, ); $this->info_box_contents[$i][1] = array( 'td' => 'align="left"', 'text' => $objp->ref, - 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid, ); $this->info_box_contents[$i][2] = array( 'td' => 'align="left"', - 'text' => $objp->title + 'text' => $objp->title, ); $sql ="SELECT count(*) as nb, sum(progress) as totprogress"; @@ -114,9 +117,15 @@ class box_project extends ModeleBoxes $resultTask = $db->query($sql); if ($resultTask) { $objTask = $db->fetch_object($resultTask); - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks")); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right"', + 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"), + ); if ($objTask->nb > 0 ) - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%"); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%", + ); else $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; @@ -132,11 +141,28 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")." ".$textHead); - $this->info_box_contents[$i][1] = array('td' => '', 'text' => ""); - $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects")); - $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks")); - $this->info_box_contents[$i][4] = array('td' => '', 'text' => ""); + $this->info_box_contents[$i][0] = array( + 'tr' => 'class="liste_total"', + 'td' => 'align="left" ', + 'text' => " ", + ); + $this->info_box_contents[$i][1] = array( + 'td' => '', + 'text' => $langs->trans("Total")." ".$textHead, + 'text' => " ", + ); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right" ', + 'text' => number_format($num, 0, ',', ' ')." ".$langs->trans("Projects"), + ); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" ', + 'text' => number_format($totalnbTask, 0, ',', ' ')." ".$langs->trans("Tasks"), + ); + $this->info_box_contents[$i][4] = array( + 'td' => '', + 'text' => " ", + ); } diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index e9bd47b2a9e..07bf074665f 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -58,7 +58,7 @@ class box_propales extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals",$max)); if ($user->rights->propale->lire) { @@ -83,8 +83,7 @@ class box_propales extends ModeleBoxes $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->dp); $datec=$db->jdate($objp->datec); @@ -97,52 +96,75 @@ class box_propales extends ModeleBoxes $late = img_warning($langs->trans("Late")); } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); + $tooltip = $langs->trans('Proposal') . ': ' . $objp->ref; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->ref, - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->ref, + 'text2'=> $late, + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/comm/propal.php?id=".$objp->rowid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $tooltip = $langs->trans('Customer') . ': ' . $objp->name; + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => dol_trunc($objp->name,40), + 'tooltip' => $tooltip, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => price($objp->total_ht), - ); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => price($objp->total_ht), + ); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day')); + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); - $this->info_box_contents[$i][6] = array('td' => 'align="right" width="18"', - 'text' => $propalstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][6] = array( + 'td' => 'align="right" width="18"', + 'text' => $propalstatic->LibStatut($objp->fk_statut,3), + ); - $i++; - } + $i++; + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProposals")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedProposals"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else - { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); - } + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); + } } /** diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 3020f12f0c4..73d5cf0f70e 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -104,41 +104,58 @@ class box_prospect extends ModeleBoxes $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $objp->name, + 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="right"', - 'text' => dol_print_date($datem, "day")); + $this->info_box_contents[$i][2] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datem, "day"), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', - 'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3))); + $this->info_box_contents[$i][3] = array( + 'td' => 'align="right" width="18"', + 'text' => str_replace('img ','img height="14" ',$prospectstatic->LibProspStatut($objp->fk_stcomm,3)), + ); - $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', - 'text' => $thirdpartystatic->LibStatut($objp->status,3)); + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right" width="18"', + 'text' => $thirdpartystatic->LibStatut($objp->status,3), + ); $i++; - } + } - if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedProspects")); + if ($num==0) + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text'=>$langs->trans("NoRecordedProspects"), + ); - $db->free($resql); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); - } - } - else { + $db->free($resql); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); + } + } else { dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR); - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index d14bf1a539f..7fb66608840 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -82,8 +82,7 @@ class box_supplier_orders extends ModeleBoxes $num = $db->num_rows($result); $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); @@ -91,48 +90,70 @@ class box_supplier_orders extends ModeleBoxes $urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid; $urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid; - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => $urlo); - - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->ref, - 'url' => $urlo); - - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => $urls); - - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->name, - 'url' => $urls); - - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($date,'day'), + $tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref; + $this->info_box_contents[$i][0] = array( + 'td' => 'align="left" width="16"', + 'logo' => $this->boximg, + 'tooltip' => $tooltip, + 'url' => $urlo, ); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3)); + $this->info_box_contents[$i][1] = array( + 'td' => 'align="left"', + 'text' => $objp->ref, + 'tooltip' => $tooltip, + 'url' => $urlo, + ); + + $tooltip = $langs->trans('Supplier') . ': ' . $objp->name; + $this->info_box_contents[$i][2] = array( + 'td' => 'align="left" width="16"', + 'logo' => 'company', + 'tooltip' => $tooltip, + 'url' => $urls, + ); + + $this->info_box_contents[$i][3] = array( + 'td' => 'align="left"', + 'text' => $objp->name, + 'tooltip' => $tooltip, + 'url' => $urls, + ); + + $this->info_box_contents[$i][4] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($date,'day'), + ); + + $this->info_box_contents[$i][5] = array( + 'td' => 'align="right" width="18"', + 'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3), + ); $i++; } if ($num == 0) - $this->info_box_contents[$i][0] = array('td' => 'align="center"', 'text' => $langs->trans("NoSupplierOrder")); + $this->info_box_contents[$i][0] = array( + 'td' => 'align="center"', + 'text' => $langs->trans("NoSupplierOrder"), + ); - $db->free($result); - } - else - { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); + $db->free($result); + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index ec1565943c7..faaaaff2ec6 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -187,13 +187,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; - $now = dol_now(); + $cachetime = 900; // 900 : 15mn - $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; $cachedir = DOL_DATA_ROOT.'/cache/boxes'; - if (! dol_is_dir($cachedir)) dol_mkdir($cachedir); - $cachefile = $cachedir.'/box-'.$fileid; - $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; + $filename = '/box-'.$fileid; + $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $out = ''; if ($refresh) { @@ -335,10 +334,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= "\n"; $out.= "\n\n"; - file_put_contents($cachefile,serialize($out),LOCK_EX); + if (! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { + dol_filecache($cachedir, $filename, $out); + } } else { dol_syslog(get_class($this).'::showBoxCached'); - $out = unserialize(file_get_contents($cachefile)); + $out = dol_readcachefile($cachedir, $filename); print ""; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4b9e7eb520f..8cf4bb3473e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1876,3 +1876,49 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu return $ret; } + +/** + * Store object in file + * + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @param mixed $object Object to store in cachefile + * @return void + */ +function dol_filecache($directory, $filename, $object) +{ + if (! dol_is_dir($directory)) dol_mkdir($directory); + $cachefile = $directory . $filename; + file_put_contents($cachefile, serialize($object), LOCK_EX); + @chmod($cachefile, 0644); +} + +/** + * Test if Refresh needed + * + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @param int $cachetime Cachetime delay + * @return boolean 0 no refresh 1 if refresh needed + */ +function dol_cache_refresh($directory, $filename, $cachetime) +{ + $now = dol_now(); + $cachefile = $directory . $filename; + $refresh = !file_exists($cachefile) || ($now-$cachetime) > dol_filemtime($cachefile); + return $refresh; +} + +/** + * Read object from cachefile + * + * @param string $directory Directory of cache + * @param string $filename Name of filecache + * @return mixed Unserialise from file + */ +function dol_readcachefile($directory, $filename) +{ + $cachefile = $directory . $filename; + $object = unserialize(file_get_contents($cachefile)); + return $object; +} diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index 72206c13e2b..9c6d2c7679a 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -46,8 +46,8 @@ foreach($linkedObjectBlock as $object) { $var=!$var; ?> - > + > + > + > + diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ef25be9469f..24aaa1952aa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -531,7 +531,17 @@ class CommandeFournisseur extends CommonOrder global $langs; $result=''; - $label=$langs->trans("ShowOrder").': '.$this->ref; + $label = '' . $langs->trans("ShowOrder") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref_supplier)) + $label.= '
' . $langs->trans('RefSupplier') . ': ' . $this->ref_supplier; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $lien = ''; $lienfin=''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4f0974abd10..a64ee006fe6 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -99,7 +99,7 @@ $offset = $conf->liste_limit * $page ; */ $sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,"; -$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; +$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur as cf"; @@ -213,11 +213,18 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; + $objectstatic->id=$obj->rowid; + $objectstatic->ref=$obj->ref; + $objectstatic->ref_supplier = $obj->ref_supplier; + $objectstatic->total_ht = $obj->total_ht; + $objectstatic->total_tva = $obj->total_tva; + $objectstatic->total_ttc = $obj->total_ttc; print ""; // Ref - print '\n"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 3bfbbbffbcb..3c3d127223e 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -512,7 +512,10 @@ class Entrepot extends CommonObject global $langs; $result=''; - $label = $langs->trans("ShowStock").': '.$this->libelle; + $label = '' . $langs->trans("ShowWarehouse").''; + $label.= '
' . $langs->trans('Ref') . ': ' . $this->libelle; + if (! empty($this->lieu)) + $label.= '
' . $langs->trans('LocationSummary').': '.$this->lieu; $lien=''; $lienfin=''; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index c85c501fa58..f6417b389e1 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -103,9 +103,12 @@ if ($result) while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); + $entrepot->id = $objp->rowid; + $entrepot->libelle = $objp->ref; + $entrepot->lieu = $objp->lieu; print ""; - print ''; - // Location + print ''; + // Location print ''; // PMP value print ''; print ''; } + + + //Display lines extrafields + if (is_array($extralabelslines) && count($extralabelslines)>0) { + print ''; + $line = new ContratLigne($db); + $line->fetch_optionals($objp->rowid,$extralabelslines); + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan)); + print ''; + } } // Ligne en mode update else @@ -1448,6 +1481,15 @@ else print '
'.$langs->trans("DateEndPlanned").' '; $form->select_date($db->jdate($objp->date_fin),"date_end_update",$usehm,$usehm,($db->jdate($objp->date_fin)>0?0:1),"update"); print ''; + + if (is_array($extralabelslines) && count($extralabelslines)>0) { + print ''; + $line = new ContratLigne($db); + $line->fetch_optionals($objp->rowid,$extralabelslines); + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan)); + print ''; + } + print ''; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9619ae462f4..bbecab53a30 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -907,7 +907,8 @@ class Contrat extends CommonObject $modCodeContract = new $module(); } - if (!empty($modCodeContract->code_auto)) { + //Commerce Efficace - Debut : Modification r�f�rence Contrat + /*if (!empty($modCodeContract->code_auto)) { // Mise a jour ref $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; if ($this->db->query($sql)) @@ -917,7 +918,8 @@ class Contrat extends CommonObject $this->ref="(PROV".$this->id.")"; } } - } + }*/ + //Commerce Efficace - Fin : Modification r�f�rence Contrat // Insert contacts commerciaux ('SALESREPSIGN','contrat') $result=$this->add_contact($this->commercial_signature_id,'SALESREPSIGN','internal'); @@ -1238,9 +1240,10 @@ class Contrat extends CommonObject * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT + * @param array $array_option extrafields array * @return int <0 si erreur, >0 si ok */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0) { global $user, $langs, $conf, $mysoc; @@ -1348,17 +1351,33 @@ class Contrat extends CommonObject $result=$this->update_statut($user); if ($result > 0) { - // Call trigger - $result=$this->call_trigger('LINECONTRACT_CREATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -1; - } - // End call triggers - - $this->db->commit(); - return 1; + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used + { + $contractline = new ContratLigne($this->db); + $contractline->array_options=$array_option; + $contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element); + $result=$contractline->insertExtraFields(); + if ($result < 0) + { + $this->error[]=$contractline->error; + $error++; + } + } + + if (empty($error)) { + // Call trigger + $result=$this->call_trigger('LINECONTRACT_CREATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + // End call triggers + + $this->db->commit(); + return 1; + } } else { @@ -1399,9 +1418,10 @@ class Contrat extends CommonObject * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT + * @param array $array_option extrafields array * @return int < 0 si erreur, > 0 si ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_option=0) { global $user, $conf, $langs, $mysoc; @@ -1501,17 +1521,33 @@ class Contrat extends CommonObject $result=$this->update_statut($user); if ($result >= 0) { - // Call trigger - $result=$this->call_trigger('LINECONTRACT_UPDATE',$user); - if ($result < 0) - { - $this->db->rollback(); - return -3; - } - // End call triggers - - $this->db->commit(); - return 1; + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_option) && count($array_option)>0) // For avoid conflicts if trigger used + { + $contractline = new ContratLigne($this->db); + $contractline->array_options=$array_option; + $contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element); + $result=$contractline->insertExtraFields(); + if ($result < 0) + { + $this->error[]=$contractline->error; + $error++; + } + } + + if (empty($error)) { + // Call trigger + $result=$this->call_trigger('LINECONTRACT_UPDATE',$user); + if ($result < 0) + { + $this->db->rollback(); + return -3; + } + // End call triggers + + $this->db->commit(); + return 1; + } } else { @@ -1560,12 +1596,32 @@ class Contrat extends CommonObject if (! $resql) { $this->error="Error ".$this->db->lasterror(); + $error++; + } + + if (empty($error)) { + // Remove extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + { + $contractline = new ContratLigne($this->db); + $contractline->id= $idline; + $result=$contractline->deleteExtraFields(); + if ($result < 0) + { + $error++; + $this->error="Error ".get_class($this)."::delete deleteExtraFields error -4 ".$contractline->error; + } + } + } + + if (empty($error)) { + $this->db->commit(); + return 1; + } else { + dol_syslog(get_class($this)."::delete ERROR:".$this->error, LOG_ERR); $this->db->rollback(); return -1; } - - $this->db->commit(); - return 1; } else { @@ -2067,6 +2123,9 @@ class ContratLigne extends CommonObject var $statut; // 0 inactive, 4 active, 5 closed var $label; + public $element='contratdet'; + public $table_element='contratdet'; + /** * @var string * @deprecated Use $label instead @@ -2445,10 +2504,21 @@ class ContratLigne extends CommonObject else { $this->error="Error ".$this->db->lasterror(); - $this->db->rollback(); - return -1; + $error++; + //return -1; + } + + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used + { + + $result=$this->insertExtraFields(); + if ($result < 0) + { + $error++; + } } + if (empty($error)) { if (! $notrigger) { // Call trigger @@ -2456,9 +2526,16 @@ class ContratLigne extends CommonObject if ($result < 0) { $error++; $this->db->rollback(); return -1; } // End call triggers } + } + if (empty($error)) { $this->db->commit(); return 1; + } else { + $this->db->rollback(); + $this->errors[]=$this->error; + return -1; + } } diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index b7e82c6dbf2..6fa99914229 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -112,6 +112,11 @@ function contract_admin_prepare_head() $head[$h][2] = 'attributes'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contractdet_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $head[$h][2] = 'attributeslines'; + $h++; + complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin','remove'); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0c345aee5ac..bce94c70a57 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -3,7 +3,7 @@ * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify @@ -273,6 +273,9 @@ else { elseif ($this->table_element_line=='facturedet') { $newline = new FactureLigne($this->db); } + elseif ($this->table_element_line=='contratdet') { + $newline = new ContratLigne($this->db); + } if (is_object($newline)) { print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8)); } From 66c73ca33628d5bc6734c2be3afc7415d46b3f67 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 27 Jan 2015 12:57:36 +0100 Subject: [PATCH 11/83] add missing files for contract line extrafields --- .../contrat/admin/contractdet_extrafields.php | 159 ++++++++++++++++++ .../install/mysql/migration/3.7.0-3.8.0.sql | 12 ++ .../tables/llx_contratdet_extrafields.key.sql | 20 +++ .../tables/llx_contratdet_extrafields.sql | 25 +++ 4 files changed, 216 insertions(+) create mode 100644 htdocs/contrat/admin/contractdet_extrafields.php create mode 100644 htdocs/install/mysql/tables/llx_contratdet_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_contratdet_extrafields.sql diff --git a/htdocs/contrat/admin/contractdet_extrafields.php b/htdocs/contrat/admin/contractdet_extrafields.php new file mode 100644 index 00000000000..21f27cee6d9 --- /dev/null +++ b/htdocs/contrat/admin/contractdet_extrafields.php @@ -0,0 +1,159 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2013 Philippe Grand + * + * 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/contrat/admin/contract_extrafields.php + * \ingroup contrat + * \brief Page to setup extra fields of contract + */ + + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("companies"); +$langs->load("admin"); +$langs->load("contracts"); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='contratdet'; //Must be the $element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader(); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("ContractsSetup"),$linkback,'setup'); + +print '
'; +$head=contract_admin_prepare_head(); + +dol_fiche_head($head, 'attributeslines', $langs->trans("Contracts"), 0, 'contract'); + +$textobject = $langs->transnoentitiesnoconv('Contracts'); + +print $langs->trans("DefineHereComplementaryAttributes",$textobject).'
'."\n"; +print '
'; + +// Load attribute_label +$extrafields->fetch_name_optionals_label($elementtype); + +print "
trans("Ref"); ?>trans("RefCustomer"); ?> trans("Date"); ?> trans("AmountHTShort"); ?> trans("Status"); ?>
- trans("ShowBill"),"bill").' '.$object->ref; ?>
getNomUrl(1); ?>ref_client; ?> date,'day'); ?> rights->facture->lire) { @@ -61,7 +63,7 @@ foreach($linkedObjectBlock as $object) } ?>
trans("TotalHT"); ?>trans("TotalHT"); ?> rights->facture->lire) { echo price($total); diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index d94d45489fd..f7f840dce13 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -42,8 +42,8 @@ foreach($linkedObjectBlock as $object) $object->fetch_lines(); $var=!$var; ?> -
- trans("ShowContract"),"contract").' '.$object->ref; ?>
getNomUrl(1); ?> date_contrat,'day'); ?>   getLibStatut(6); ?>
- trans("ShowShipping"),"sending").' '.$object->ref; ?>
getNomUrl(1); ?> date_creation,'day'); ?> date_delivery,'day'); ?> -
- trans("ShowIntervention"),"intervention").' '.$object->ref; ?>
getNomUrl(1); ?> datev,'day'); ?> getLibStatut(3); ?>
'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.''; + print ''; + print $objectstatic->getNomUrl(1); $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->dir_output.'/commande' . '/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index f6111bac684..f39fcc06574 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -4,6 +4,7 @@ Sending=Shipment Sendings=Shipments Shipment=Shipment Shipments=Shipments +ShowSending=Show Sending Receivings=Receivings SendingsArea=Shipments area ListOfSendings=List of shipments diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a889136de01..434ff255de5 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2814,8 +2814,12 @@ class Product extends CommonObject $result=''; $newref=$this->ref; if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); - if ($this->type == 0) $label = $langs->trans("ShowProduct").': '.$this->ref.' '.$this->label; - if ($this->type == 1) $label = $langs->trans("ShowService").': '.$this->ref.' '.$this->label; + if ($this->type == 0) $label = '' . $langs->trans("ShowProduct") . ''; + if ($this->type == 1) $label = '' . $langs->trans("ShowService") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->label)) + $label .= '
' . $langs->trans('Label') . ': ' . $this->label; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == 'supplier') { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index a5cc97defa7..fb724c252ab 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -420,6 +420,7 @@ else print '
'; $product_static->id = $objp->rowid; $product_static->ref = $objp->ref; + $product_static->label = $objp->label; $product_static->type = $objp->fk_product_type; print $product_static->getNomUrl(1,'',24); print "
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.'' . $entrepot->getNomUrl(1) . ''.$objp->lieu.''; From fae2ae8e2d91b942ad32e7f3343f950dfbcc79a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Jan 2015 22:58:12 +0100 Subject: [PATCH 06/83] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4c9ffa93080..e133ec9d031 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ You can use a Web server and a supported database (MySQL recommended) to install ## UPGRADING - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. -- If you're upgrading from version x.y.z to x.y.w (only third number differs), there is no need to run any migration process +- If you're upgrading from version x.y.z to x.y.w (only third number differs), there is no need to run any migration process. - If you're upgrading from a beta version or from any version x.y.z to any other where x or y number differs, you must call the Dolibarr "install/" page in your browser (this should be done automatically at first dolibarr access) and follow the upgrade process. -- + *Note: migration process can safely be done multiple times.* ## NEWS From 62ae75b3bf1e8076604c7c06ca4462dde9a44f9d Mon Sep 17 00:00:00 2001 From: accett Date: Mon, 26 Jan 2015 14:38:02 -0600 Subject: [PATCH 07/83] Update for Mexico Users Add MXN in the array for countries use the sign currency before. (Mexico does). Add function float2text_moneda to convert the number in the text form for tickets, facture, proposals, etc. --- htdocs/core/lib/functions.lib.php | 104 +++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8a43030dbc..24109f5b8df 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2954,7 +2954,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou { if ($currency_code == 'auto') $currency_code=$conf->currency; - $listofcurrenciesbefore=array('USD','GBP','AUD'); + $listofcurrenciesbefore=array('USD','GBP','AUD','MXN'); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); else { @@ -4962,3 +4962,105 @@ function natural_search($fields, $value) } return " AND " . ($end > 1? '(' : '') . $res; } + +/** + * Function to return text in currency mexican of a + * number less than 1 million and more than zero. + * + * @param float $numero Number to convert + * @return string $entexto Text of the number + * + * Víctor Ortiz Pérez 23 Enero 2015 victor@accett.com.mx + */ +function float2text_moneda($numero){ + $veintis = array("VEINTE","VEINTIUN","VEINTIDÓS","VEINTITRÉS","VEINTICUATRO","VEINTICINCO","VEINTISÉIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); + $unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); + $decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); + $centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); + $number = $numero; + $parte_decimal = $numero - (int)$numero; + $parte_decimal = (int)round($parte_decimal*100); + if ($parte_decimal < 10) + $parte_decimal = "0".$parte_decimal; + $entexto =""; + if ($numero>=1 && $numero<2) { + $entexto .= " UN PESO ".$parte_decimal." / 100 M.N."; + } + elseif ($numero>=0 && $numero<1){ + $entexto .= " CERO PESOS ".$parte_decimal." / 100 M.N."; + } + elseif ($numero>=100 && $numero<101){ + $entexto .= " CIEN PESOS ".$parte_decimal." / 100 M.N."; + } + else { + $cdm = (int)($numero / 100000); + $numero = $numero - $cdm * 100000; + $ddm = (int)($numero / 10000); + $numero = $numero - $ddm * 10000; + $udm = (int)($numero / 1000); + $numero = $numero - $udm * 1000; + $c = (int)($numero / 100); + $numero = $numero - $c * 100; + $d = (int)($numero / 10); + $u = (int)$numero - $d * 10; + $completo=FALSE; + if ($cdm==1 && $ddm==0 && $udm==0){ + $entexto .= "CIEN"; + $completo = TRUE; + } + if ($cdm!=0 && !$completo){ + $entexto .= $centenas[$cdm-1]." "; + } + $completo=FALSE; + if ($ddm>2){ + $entexto .= " ".$decenas[$ddm-1]; + if ($udm!=0){ + $entexto .= " Y "; + } + } + elseif ($ddm!=0){ + $completo=TRUE; + if ($ddm==1){ + $entexto .= " ".$diecis[$udm]; + } + else{ + $entexto .= " ".$veintis[$udm]; + } + } + if ($udm!=0 && !$completo){ + $entexto .= $unidades[$udm-1]; + } + $completo=FALSE; + if ($number>=1000){ + $entexto .= " MIL "; + } + + if ($c==1 && $d==0 && $u==0){ + $entexto .= "CIEN"; + $completo = TRUE; + } + if ($c!=0 && !$completo){ + $entexto .= $centenas[$c-1]." "; + } + if ($d>2){ + $entexto .= " ".$decenas[$d-1]; + if ($u!=0){ + $entexto .= " Y "; + } + } + elseif ($d!=0){ + $completo=TRUE; + if ($d==1){ + $entexto .= " ".$diecis[$u]; + } + else{ + $entexto .= " ".$veintis[$u]; + } + } + if ($u!=0 && !$completo){ + $entexto .= $unidades[$u-1]; + } + $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; + } + return $entexto; +} From 101378b856539ddc35ae3b677047ddf57592535b Mon Sep 17 00:00:00 2001 From: AcceTT Soluciones Computacionales Date: Mon, 26 Jan 2015 20:56:36 -0600 Subject: [PATCH 08/83] Add MXN Add MXN to the array to use currency sing before. --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f8a43030dbc..ad468da0bb5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2954,7 +2954,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou { if ($currency_code == 'auto') $currency_code=$conf->currency; - $listofcurrenciesbefore=array('USD','GBP','AUD'); + $listofcurrenciesbefore=array('USD','GBP','AUD','MXN'); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); else { From 608b09993421adb56eb2493d7f38c7ba5882c9df Mon Sep 17 00:00:00 2001 From: AcceTT Soluciones Computacionales Date: Mon, 26 Jan 2015 21:38:43 -0600 Subject: [PATCH 09/83] Currency symbol in Mexico I tried to change the order of the currency symbol in Mexico is before. --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 271a9f900ae..910ea42e124 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2905,7 +2905,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou { if ($currency_code == 'auto') $currency_code=$conf->currency; - $listofcurrenciesbefore=array('USD','GBP','AUD'); + $listofcurrenciesbefore=array('USD','GBP','AUD','MXN'); if (in_array($currency_code,$listofcurrenciesbefore)) $cursymbolbefore.=$outlangs->getCurrencySymbol($currency_code); else { From a510a1ef5cd746336a7494125d790bde7a348332 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 27 Jan 2015 12:53:02 +0100 Subject: [PATCH 10/83] First step add contract lines extrafields --- htdocs/contrat/card.php | 44 ++++++- htdocs/contrat/class/contrat.class.php | 139 +++++++++++++++++----- htdocs/core/lib/contract.lib.php | 5 + htdocs/core/tpl/objectline_create.tpl.php | 5 +- 4 files changed, 160 insertions(+), 33 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 4770ff10e50..0095d474239 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -84,6 +84,10 @@ if ($id > 0 || ! empty($ref)) { // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); +// fetch optionals attributes lines and labels +$extrafieldsline = new ExtraFields($db); +$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $permissionnote=$user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php @@ -408,6 +412,18 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $error++; } + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + // Unset extrafield + if (is_array($extralabelsline)) { + // Get extra fields + foreach ($extralabelsline as $key => $value) { + unset($_POST["options_" . $key]); + } + } + if (! $error) { // Clean parameters @@ -520,7 +536,8 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $pu_ttc, $info_bits, $fk_fournprice, - $pa_ht + $pa_ht, + $array_option ); } @@ -617,6 +634,12 @@ else if ($action == 'updateligne' && $user->rights->contrat->creer && ! GETPOST( $objectline->fk_fournprice=$fk_fournprice; $objectline->pa_ht=$pa_ht; + // Extrafields + $extrafieldsline = new ExtraFields($db); + $extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $objectline->array_options=$array_option; + // TODO verifier price_min si fk_product et multiprix $result=$objectline->update($user); @@ -1391,6 +1414,16 @@ else print '
"; + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=True; +foreach($extrafields->attribute_type as $key => $value) +{ + $var=!$var; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print '\n"; + print '\n"; + print ""; + // $i++; +} + +print "
'.$langs->trans("Position").''.$langs->trans("Label").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("Unique").''.$langs->trans("Required").' 
".$extrafields->attribute_pos[$key]."".$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 "  ".img_delete()."
"; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Creation d'un champ optionnel + /* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edition d'un champ optionnel */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index cb70f85a32c..b5e3abc62c1 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -70,3 +70,15 @@ create table llx_bank_account_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; +ALTER TABLE llx_bank_account_extrafields ADD INDEX idx_bank_account_extrafields (fk_object); + + +create table llx_contratdet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, -- object id + import_key varchar(14) -- import key +)ENGINE=innodb; + +ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_contratdet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_contratdet_extrafields.key.sql new file mode 100644 index 00000000000..3d2f8546df7 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_contratdet_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2013 Florian Henry +-- +-- 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 . +-- +-- =================================================================== + + +ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql b/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql new file mode 100644 index 00000000000..bc06733572e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_contratdet_extrafields.sql @@ -0,0 +1,25 @@ +-- =================================================================== +-- Copyright (C) 2014 Florian Henry +-- +-- 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 . +-- +-- =================================================================== + +create table llx_contratdet_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, -- object id + import_key varchar(14) -- import key +)ENGINE=innodb; From a560b582f5e8281ae110a8452649a91119933aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 28 Jan 2015 00:02:57 +0100 Subject: [PATCH 12/83] Update functions2.lib.php --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8e3f7a7262f..9a26c727bd4 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -608,7 +608,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m $maskraz=-1; $maskoffset=0; $resetEveryMonth=false; - if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'CounterMustHaveMoreThan3Digits'; + if (dol_strlen($maskcounter) < 3 && empty($conf->global->MAIN_COUNTER_WITH_LESS_3_DIGITS)) return 'ErrorCounterMustHaveMoreThan3Digits'; // Extract value for third party mask counter if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef)) From 7569b32281f3d896391a5ad109dd0e9fe12e177f Mon Sep 17 00:00:00 2001 From: "Ying-Chun Liu (PaulLiu)" Date: Thu, 29 Jan 2015 00:57:54 +0800 Subject: [PATCH 13/83] Fix: webservices productorservice not updating the price. The product.php.class provides another method updatePrice() to update the price of products or services. We should call updatePrice() when we found the SOAP client changes the price or price_net. Signed-off-by: Ying-Chun Liu (PaulLiu) --- .../webservices/server_productorservice.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 6f36b664a3b..911b258536c 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -668,6 +668,25 @@ function updateProductOrService($authentication,$product) { $error++; } + if (! $error) + { + if ($newobject->price_base_type == 'HT') + { + $result=$newobject->updatePrice($newobject->price, $newobject->price_base_type,$fuser); + if ($result <= 0) + { + $error++; + } + } + elseif ($newobject->price_base_type == 'TTC') + { + $result=$newobject->updatePrice($newobject->price_ttc, $newobject->price_base_type); + if ($result <= 0) + { + $error++; + } + } + } if (! $error) { From 3403979ed7065d9814b7a232ed383bce840d00c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 28 Jan 2015 21:27:07 +0100 Subject: [PATCH 14/83] Speed up listing with Is Order Shippable icon --- htdocs/commande/list.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 2c30f4128c6..d8ac06f37da 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -323,6 +323,7 @@ if ($resql) $var=true; $total=0; $subtotal=0; + $productstat_cache=array(); $generic_commande = new Commande($db); $generic_product = new Product($db); @@ -351,18 +352,33 @@ if ($resql) if ($generic_commande->lines[$lig]->product_type==0) { $nbprod++; // order contains real products $generic_product->id = $generic_commande->lines[$lig]->fk_product; - $generic_product->load_stock(); + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { + $generic_product->load_stock(true); + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; + } else { + $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; + } // stock order and stock order_supplier $stock_order=0; $stock_order_supplier=0; if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { if (! empty($conf->commande->enabled)) { - $generic_product->load_stats_commande(0,'1,2'); - $stock_order=$generic_product->stats_commande['qty']; + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { + $generic_product->load_stats_commande(0,'1,2',true); + $stock_order=$generic_product->stats_commande['qty']; + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; + } else { + $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; + } } if (! empty($conf->fournisseur->enabled)) { - $generic_product->load_stats_commande_fournisseur(0,'3'); - $stock_order_supplier=$generic_product->stats_commande_fournisseur['qty']; + if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { + $generic_product->load_stats_commande_fournisseur(0,'3',true); + $stock_order_supplier=$generic_product->stats_commande_fournisseur['qty']; + $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; + } else { + $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; + } } } $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); From 355c5f0b52a6d3b2b872fc6c66fa0cee425059be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 28 Jan 2015 21:32:23 +0100 Subject: [PATCH 15/83] Update list.php --- htdocs/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d8ac06f37da..f42920850c2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -365,20 +365,20 @@ if ($resql) if (! empty($conf->commande->enabled)) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { $generic_product->load_stats_commande(0,'1,2',true); - $stock_order=$generic_product->stats_commande['qty']; $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; } else { $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; } + $stock_order=$generic_product->stats_commande['qty']; } if (! empty($conf->fournisseur->enabled)) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { $generic_product->load_stats_commande_fournisseur(0,'3',true); - $stock_order_supplier=$generic_product->stats_commande_fournisseur['qty']; $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; } else { $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; } + $stock_order_supplier=$generic_product->stats_commande_fournisseur['qty']; } } $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25); From 831bc5393db9c0dd4687aefcb168b59afaa0a3ef Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Wed, 28 Jan 2015 23:17:46 +0200 Subject: [PATCH 16/83] translate UpdateServerOffline live last version --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index bca163db8bd..1f9f6286b1d 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -304,6 +304,7 @@ YouCanSubmitFile=Select module: CurrentVersion=Dolibarr current version CallUpdatePage=Go to the page that updates the database structure and datas: %s. LastStableVersion=Last stable version +UpdateServerOffline=Update server offline GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags could be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as previous but an offset corresponding to the number to the right of the + sign is applied starting on first %s.
{000000@x} same as previous but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
GenericMaskCodes2={cccc} the client code on n characters
{cccc000} the client code on n characters is followed by a counter dedicated for customer. This counter dedicated to customer is reset at same time than global counter.
{tttt} The code of thirdparty type on n characters (see dictionary-thirdparty types).
GenericMaskCodes3=All other characters in the mask will remain intact.
Spaces are not allowed.
From f86db9d6865c6c77448c7c91b0260f11c45baa02 Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Wed, 28 Jan 2015 23:55:12 +0200 Subject: [PATCH 17/83] Correct view link --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 98d25118126..4d63e6224e1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -292,7 +292,7 @@ DoNotUseInProduction=Do not use in production ThisIsProcessToFollow=This is setup to process: StepNb=Step %s FindPackageFromWebSite=Find a package that provides feature you want (for example on official web site %s). -DownloadPackageFromWebSite=Download package. +DownloadPackageFromWebSite=Download package %s. UnpackPackageInDolibarrRoot=Unpack package file into Dolibarr's root directory %s SetupIsReadyForUse=Install is finished and Dolibarr is ready to use with this new component. NotExistsDirect=The alternative root directory is not defined.
From 4e14f6913abb4b44b8d314d29500b6b2fd2d145c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 29 Jan 2015 14:22:13 +0100 Subject: [PATCH 18/83] Fix contract if only service modules is enabled --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index f27d47f2dd5..e3f6c0efeb9 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1237,7 +1237,7 @@ else * Lines of contracts */ - if ($conf->product->enabled) { + if ($conf->product->enabled || $conf->service->enabled) { $productstatic=new Product($db); } From 0d0c10be1ff8c5afb5591f7d6cbec2fa83a389f2 Mon Sep 17 00:00:00 2001 From: cla Date: Thu, 29 Jan 2015 18:17:43 +0100 Subject: [PATCH 19/83] ADD filter fields in list project page --- htdocs/projet/list.php | 81 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 9 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f00a6ef518b..f822eefc0a7 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Bariley / Ocebo * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Claudio Aschieri * * 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 @@ -28,6 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); @@ -64,6 +66,14 @@ $search_label=GETPOST("search_label"); $search_societe=GETPOST("search_societe"); $search_year=GETPOST("search_year"); $search_all=GETPOST("search_all"); +$search_status=GETPOST("search_status",'int'); +$search_public=GETPOST("search_public",'int'); + +$day = GETPOST('day','int'); +$month = GETPOST('month','int'); +$year = GETPOST('year','int'); + + // Purge criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers @@ -73,6 +83,11 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_societe=""; $search_year=""; $search_all=0; + $search_status=1; + $search_public=""; + $day=""; + $month=""; + $year=""; } /* @@ -81,6 +96,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $projectstatic = new Project($db); $socstatic = new Societe($db); +$form = new Form($db); +$formother = new FormOther($db); llxHeader("",$langs->trans("Projects"),"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"); @@ -109,14 +126,29 @@ if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } -if ($search_year) { - $sql .= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($search_year,12,false)).")"; - $sql .= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($search_year,1,false)).")"; +if ($month > 0) +{ + if ($year > 0 && empty($day)) + $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + else if ($year > 0 && ! empty($day)) + $sql.= " AND p.datee BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + else + $sql.= " AND date_format(p.datee, '%m') = '".$month."'"; } +else if ($year > 0) +{ + $sql.= " AND p.datee BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; +} + if ($search_all) { $sql .= natural_search(array('p.ref','p.title','s.nom'), $search_all); } + +if ($search_status!='') $sql .= " AND p.fk_statut = ".$db->escape($search_status); + +if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); @@ -127,6 +159,16 @@ if ($resql) $var=true; $num = $db->num_rows($resql); $i = 0; + + $param=''; + if ($month) $param.='&month='.$month; + if ($year) $param.='&year=' .$year; + if ($search_ref != '') $param.='&search_ref='.$search_ref; + if ($search_label != '') $param.='&search_label='.$search_label; + if ($search_societe != '') $param.='&search_societe='.$search_societe; + if ($search_status != '') $param.='&search_status='.$search_status; + if ($search_public != '') $param.='&search_public='.$search_public; + $text=$langs->trans("Projects"); if ($mine) $text=$langs->trans('MyProjects'); @@ -144,11 +186,13 @@ if ($resql) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); + print ''; print "\n"; print ''; @@ -161,7 +205,21 @@ if ($resql) print ''; - print ''; + print ''; + + print ''; + print ''; print ''; + // Date end + print ''; + // Visibility print ''; print ''; if ($resql) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ad99f68c9b0..0c8553e424d 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -55,6 +55,7 @@ class MouvementStock extends CommonObject * 2=output (stock decrease), 3=input (stock increase) * @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed. * @param string $label Label of stock movement + * @param string $inventorycode Inventory code * @param string $datem Force date of movement * @param date $eatby eat-by date * @param date $sellby sell-by date @@ -62,21 +63,27 @@ class MouvementStock extends CommonObject * @param boolean $skip_sellby If set to true, stock mouvement is done without impacting batch record * @return int <0 if KO, 0 if fk_product is null, >0 if OK */ - function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $datem='',$eatby='',$sellby='',$batch='',$skip_sellby=false) + function _create($user, $fk_product, $entrepot_id, $qty, $type, $price=0, $label='', $inventorycode='', $datem='',$eatby='',$sellby='',$batch='',$skip_sellby=false) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $error = 0; - dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price label=$label"); + dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode"); // Clean parameters if (empty($price)) $price=0; + $now=(! empty($datem) ? $datem : dol_now()); + // Check parameters if (empty($fk_product)) return 0; - $now=(! empty($datem) ? $datem : dol_now()); - + // Set properties of movement + $this->product_id = $fk_product; + $this->entrepot_id = $entrepot_id; + $this->qty = $qty; + $this->type = $type; + $this->db->begin(); $product = new Product($this->db); @@ -94,19 +101,22 @@ class MouvementStock extends CommonObject if ($movestock && $entrepot_id > 0) // Change stock for current product, change for subproduct is done after { - if(!empty($this->origin)) { + if(!empty($this->origin)) { // This is set by caller for tracking reason $origintype = $this->origin->element; $fk_origin = $this->origin->id; } else { $origintype = ''; $fk_origin = 0; } + + $mvid = 0; $sql = "INSERT INTO ".MAIN_DB_PREFIX."stock_mouvement"; - $sql.= " (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author, label, price, fk_origin, origintype)"; - $sql.= " VALUES ('".$this->db->idate($now)."', ".$fk_product.", ".$entrepot_id.", ".$qty.", ".$type.","; + $sql.= " (datem, fk_product, fk_entrepot, value, type_mouvement, fk_user_author, label, inventorycode, price, fk_origin, origintype)"; + $sql.= " VALUES ('".$this->db->idate($now)."', ".$this->product_id.", ".$this->entrepot_id.", ".$this->qty.", ".$this->type.","; $sql.= " ".$user->id.","; $sql.= " '".$this->db->escape($label)."',"; + $sql.= " '".$this->db->escape($inventorycode)."',"; $sql.= " '".price2num($price)."',"; $sql.= " '".$fk_origin."',"; $sql.= " '".$origintype."'"; @@ -117,6 +127,7 @@ class MouvementStock extends CommonObject if ($resql) { $mvid = $this->db->last_insert_id(MAIN_DB_PREFIX."stock_mouvement"); + $this->id = $mvid; } else { @@ -159,10 +170,11 @@ class MouvementStock extends CommonObject } // Calculate new PMP. + $newpmp=0; + $newpmpwarehouse=0; + /* if (! $error) { - $newpmp=0; - $newpmpwarehouse=0; // Note: PMP is calculated on stock input only (type of movement = 0 or 3). If type == 0 or 3, qty should be > 0. // Note: Price should always be >0 or 0. PMP should be always >0 (calculated on input) if (($type == 0 || $type == 3) && $price > 0) @@ -190,9 +202,9 @@ class MouvementStock extends CommonObject if ($oldpmpwarehouse > 0) $newpmpwarehouse=price2num((($oldqtywarehousetouse * $oldpmpwarehouse) + ($qty * $price)) / ($oldqtywarehousetouse + $qty), 'MU'); else $newpmpwarehouse=$price; - /*print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; - print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; - exit;*/ + //print "oldqtytouse=".$oldqtytouse." oldpmp=".$oldpmp." oldqtywarehousetouse=".$oldqtywarehousetouse." oldpmpwarehouse=".$oldpmpwarehouse." "; + //print "qty=".$qty." newpmp=".$newpmp." newpmpwarehouse=".$newpmpwarehouse; + //exit; } else if ($type == 1 || $type == 2) { @@ -204,7 +216,8 @@ class MouvementStock extends CommonObject $newpmpwarehouse = $oldpmpwarehouse; } } - + */ + // Update denormalized value of stock in product_stock and product if (! $error) { @@ -262,21 +275,15 @@ class MouvementStock extends CommonObject // Add movement for sub products (recursive call) if (! $error && ! empty($conf->global->PRODUIT_SOUSPRODUITS)) { - $error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label); // we use 0 as price, because pmp is not changed for subproduct + $error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label, $inventorycode); // we use 0 as price, because pmp is not changed for subproduct } if ($movestock && ! $error) { - $this->product_id = $fk_product; - $this->entrepot_id = $entrepot_id; - $this->qty = $qty; - // Call trigger $result=$this->call_trigger('STOCK_MOVEMENT',$user); if ($result < 0) $error++; // End call triggers - - //FIXME: Restore previous value of product_id, entrepot_id, qty if trigger fail } if (! $error) @@ -303,9 +310,10 @@ class MouvementStock extends CommonObject * @param int $type Type * @param int $price Price * @param string $label Label of movement + * @param string $inventorycode Inventory code * @return int <0 if KO, 0 if OK */ - function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price=0, $label='') + function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price=0, $label='', $inventorycode='') { $error = 0; $pids = array(); @@ -314,7 +322,9 @@ class MouvementStock extends CommonObject $sql = "SELECT fk_product_pere, fk_product_fils, qty"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " WHERE fk_product_pere = ".$idProduct; - + // TODO Select only subproduct with incdec tag + //$sql.= " AND incdec = 1"; + dol_syslog(get_class($this)."::_createSubProduct", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -336,7 +346,9 @@ class MouvementStock extends CommonObject // Create movement for each subproduct foreach($pids as $key => $value) { - $this->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label); + $tmpmove = dol_clone($this); + $tmpmove->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label, $inventorycode); // This will also call _createSubProduct making this recursive + unset($tmpmove); } return $error; @@ -357,7 +369,7 @@ class MouvementStock extends CommonObject */ function livraison($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', $datem='') { - return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, $datem,'','','',true); + return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem,'','','',true); } /** @@ -389,7 +401,7 @@ class MouvementStock extends CommonObject */ function reception($user, $fk_product, $entrepot_id, $qty, $price=0, $label='', $eatby='', $sellby='', $batch='') { - return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, '', $eatby, $sellby, $batch); + return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, '', '', $eatby, $sellby, $batch); } diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1bac6b9fef5..36c645d4e4a 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -50,6 +50,7 @@ $search_movement = GETPOST("search_movement"); $search_product_ref = trim(GETPOST("search_product_ref")); $search_product = trim(GETPOST("search_product")); $search_warehouse = trim(GETPOST("search_warehouse")); +$search_inventorycode = trim(GETPOST("search_inventorycode")); $search_user = trim(GETPOST("search_user")); $page = GETPOST("page",'int'); $sortfield = GETPOST("sortfield",'alpha'); @@ -120,7 +121,7 @@ $formproduct=new FormProduct($db); $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type,"; $sql.= " e.label as stock, e.rowid as entrepot_id,"; -$sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.fk_origin, m.origintype,"; +$sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product as p,"; @@ -149,6 +150,10 @@ if (! empty($search_movement)) { $sql.= " AND m.label LIKE '%".$db->escape($search_movement)."%'"; } +if (! empty($search_inventorycode)) +{ + $sql.= " AND m.inventorycode LIKE '%".$db->escape($search_inventorycode)."%'"; +} if (! empty($search_product_ref)) { $sql.= " AND p.ref LIKE '%".$db->escape($search_product_ref)."%'"; @@ -410,6 +415,7 @@ if ($resql) $param=''; if ($id) $param.='&id='.$id; if ($search_movement) $param.='&search_movement='.urlencode($search_movement); + if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product) $param.='&search_product='.urlencode($search_product); if ($search_warehouse) $param.='&search_warehouse='.urlencode($search_warehouse); @@ -425,7 +431,8 @@ if ($resql) //print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"], "m.rowid","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"], "m.datem","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LabelMovement"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("InventoryCode"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ProductRef"),$_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ProductLabel"),$_SERVER["PHP_SELF"], "p.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible @@ -448,6 +455,10 @@ if ($resql) print ''; + // Inventory code + print ''; // Origin of movement print ''; // Label of movement print ''; - // Origin of movement + // Inventory code + print ''; + // Origin of movement print ''; // Product ref print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; //eat-by date @@ -599,8 +598,18 @@ if ($id > 0 || $ref) print ''; print ''; } - print '
 
'; print ''; print ' '; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year?$year:-1,'year',1, 20, 5); + print ''; + $array=array(''=>'',0 => $langs->trans("PrivateProject"),1 => $langs->trans("SharedProject")); + print $form->selectarray('search_public',$array,$search_public); + print ''; + + print $form->selectarray('search_status', array(''=>'', '0'=>$langs->trans('Draft'),'1'=>$langs->trans('Opened'),'2'=>$langs->trans('Closed')),$search_status); + + print ''; print ''; print ''; @@ -207,6 +265,11 @@ if ($resql) } print ''; + print dol_print_date($db->jdate($objp->date_end),'day'); + print ''; if ($objp->public) print $langs->trans('SharedProject'); From 43702cf662c3178a0a6c85fd7cdf868ee48953e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Jan 2015 01:51:28 +0100 Subject: [PATCH 20/83] New: Enhance stock management: Introduce tag to define if a subproduct must have stock decreased and add inventory code on stock movements. --- .../fourn/class/fournisseur.product.class.php | 8 +-- .../install/mysql/migration/3.7.0-3.8.0.sql | 6 ++ .../mysql/tables/llx_product_association.sql | 3 +- .../mysql/tables/llx_stock_mouvement.sql | 3 +- htdocs/langs/en_US/stocks.lang | 4 +- htdocs/product/class/product.class.php | 10 +-- htdocs/product/composition/card.php | 3 +- .../stock/class/mouvementstock.class.php | 62 +++++++++++-------- htdocs/product/stock/mouvement.php | 19 +++++- htdocs/product/stock/product.php | 31 ++++++---- 10 files changed, 98 insertions(+), 51 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 52b9fc80c21..b43de81c653 100755 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -583,10 +583,10 @@ class ProductFournisseur extends Product */ function getSocNomUrl($withpicto=0,$option='supplier') { - $cust = new Fournisseur($this->db); - $cust->fetch($this->fourn_id); + $thirdparty = new Fournisseur($this->db); + $thirdparty->fetch($this->fourn_id); - return $cust->getNomUrl($withpicto,$option); + return $thirdparty->getNomUrl($withpicto,$option); } /** @@ -600,7 +600,7 @@ class ProductFournisseur extends Product { global $langs; $langs->load("suppliers"); - $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); + $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1, 'supplier').' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); return $out; } diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index cb70f85a32c..d096c222aee 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -70,3 +70,9 @@ create table llx_bank_account_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; + +ALTER TABLE llx_stock_mouvement MODIFY COLUMN label varchar(255); +ALTER TABLE llx_stock_mouvement ADD COLUMN inventorycode varchar(128); + +ALTER TABLE llx_product_association ADD COLUMN incdec integer DEFAULT 1; + diff --git a/htdocs/install/mysql/tables/llx_product_association.sql b/htdocs/install/mysql/tables/llx_product_association.sql index 731a9046609..6b248aef17f 100644 --- a/htdocs/install/mysql/tables/llx_product_association.sql +++ b/htdocs/install/mysql/tables/llx_product_association.sql @@ -22,6 +22,7 @@ create table llx_product_association rowid integer AUTO_INCREMENT PRIMARY KEY, fk_product_pere integer NOT NULL DEFAULT 0, -- id du produit maitre fk_product_fils integer NOT NULL DEFAULT 0, -- id du sous-produit - qty double NULL + qty double NULL, + incdec integer DEFAULT 1 -- when set to 1 changing stock of product will change stock of linked product too )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index c0fdd702074..85b0290681f 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -28,7 +28,8 @@ create table llx_stock_mouvement price float(13,4) DEFAULT 0, type_mouvement smallint, fk_user_author integer, - label varchar(128), + label varchar(255), + inventorycode varchar(128), fk_origin integer, origintype varchar(32) )ENGINE=innodb; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 492cbbd7464..ac85e36be07 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -122,4 +122,6 @@ RuleForStockAvailability=Rules on stock requirements StockMustBeEnoughForInvoice=Stock level must be enough to add product/service into invoice StockMustBeEnoughForOrder=Stock level must be enough to add product/service into order StockMustBeEnoughForShipment= Stock level must be enough to add product/service into shipment - +MovementLabel=Label of movement +InventoryCode=Inventory code +IsInPackage=Contained into package diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a889136de01..ed1de0ee571 100755 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2965,9 +2965,10 @@ class Product extends CommonObject * @param int $movement 0 = add, 1 = remove * @param string $label Label of stock movement * @param double $price Price to use for stock eval + * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0) + function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $inventorycode='') { if ($id_entrepot) { @@ -2979,7 +2980,7 @@ class Product extends CommonObject $op[1] = "-".trim($nbpiece); $movementstock=new MouvementStock($this->db); - $result=$movementstock->_create($user,$this->id,$id_entrepot,$op[$movement],$movement,$price,$label); + $result=$movementstock->_create($user,$this->id,$id_entrepot,$op[$movement],$movement,$price,$label,$inventorycode); if ($result >= 0) { @@ -3581,9 +3582,10 @@ class Product extends CommonObject * @param date $dlc eat-by date * @param date $dluo sell-by date * @param string $lot Lot number + * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='') + function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='', $inventorycode='') { if ($id_entrepot) { @@ -3595,7 +3597,7 @@ class Product extends CommonObject $op[1] = "-".trim($nbpiece); $movementstock=new MouvementStock($this->db); - $result=$movementstock->_create($user,$this->id,$id_entrepot,$op[$movement],$movement,$price,$label,'',$dlc,$dluo,$lot); + $result=$movementstock->_create($user,$this->id,$id_entrepot,$op[$movement],$movement,$price,$label,$inventorycode,'',$dlc,$dluo,$lot); if ($result >= 0) { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index ca139a87965..12553ada59a 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -34,6 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $langs->load("bills"); $langs->load("products"); +$langs->load("stocks"); $id=GETPOST('id','int'); $ref=GETPOST('ref','alpha'); @@ -456,7 +457,7 @@ if ($id > 0 || ! empty($ref)) print '
'.$langs->trans("Ref").''; print ''.$langs->trans("Label").''; - print ''.$langs->trans("AddDel").''; + print ''.$langs->trans("IsInPackage").''; print ''.$langs->trans("Qty").''; print '
'; print ''; print ''; + print ''; + print ''; print '  '; @@ -495,7 +506,9 @@ if ($resql) print ''.dol_print_date($db->jdate($objp->datem),'dayhour').''.$objp->label.''.$objp->inventorycode.''.$origin.''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 352750295af..a1a1b62820c 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -135,11 +135,12 @@ if ($action == "correct_stock" && ! $cancel) GETPOST("id_entrepot"), GETPOST("nbpiece"), GETPOST("mouvement"), - GETPOST("label"), + GETPOST("label"), // label movement $priceunit, $d_eatby, $d_sellby, - GETPOST('batch_number') + GETPOST('batch_number'), + GETPOST('inventorycode') ); // We do not change value of stock for a correction } else @@ -150,7 +151,8 @@ if ($action == "correct_stock" && ! $cancel) GETPOST("nbpiece"), GETPOST("mouvement"), GETPOST("label"), - $priceunit + $priceunit, + GETPOST('inventorycode') ); // We do not change value of stock for a correction } @@ -564,7 +566,7 @@ if ($id > 0 || $ref) print '
'.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot')),'id_entrepot','',1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOT("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')),'id_entrepot','',1); print ''; print '
'.$langs->trans("Label").''; - print ''; - print ''.$langs->trans("UnitPurchaseValue").''.$langs->trans("UnitPurchaseValue").'
'; + // Label of mouvement of id of inventory + print '
'.$langs->trans("MovementLabel").''; + print ''; + print ''.$langs->trans("InventoryCode").'
'; + print '
'; print ''; print '     '; @@ -649,7 +658,7 @@ if ($id > 0 || $ref) } else { - print $formproduct->selectWarehouses(($_GET["dwid"]?$_GET["dwid"]:GETPOST('id_entrepot_source')),'id_entrepot_source','',1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOT("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot_source','int'):'ifone')),'id_entrepot_source','',1); } print ''; print ''.$langs->trans("WarehouseTarget").''; From 0501153835cfaedf36023b1c86db13676769eaf6 Mon Sep 17 00:00:00 2001 From: cla Date: Fri, 30 Jan 2015 11:08:49 +0100 Subject: [PATCH 21/83] Update list project page: add sales rapresentatives and linked user. --- htdocs/projet/list.php | 92 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 89 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f822eefc0a7..5b1da5792f5 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -68,6 +68,8 @@ $search_year=GETPOST("search_year"); $search_all=GETPOST("search_all"); $search_status=GETPOST("search_status",'int'); $search_public=GETPOST("search_public",'int'); +$search_user=GETPOST('search_user','int'); +$search_sale=GETPOST('search_sale','int'); $day = GETPOST('day','int'); $month = GETPOST('month','int'); @@ -85,6 +87,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_all=0; $search_status=1; $search_public=""; + $search_sale=""; + $search_user=''; $day=""; $month=""; $year=""; @@ -109,6 +113,15 @@ $sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; + +// We'll need this table joined to the select in order to filter by sale +if ($search_sale || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if ($search_user > 0) +{ + $sql.=", ".MAIN_DB_PREFIX."element_contact as c"; + $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; +} + $sql.= " WHERE p.entity = ".$conf->entity; if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser @@ -149,6 +162,13 @@ if ($search_status!='') $sql .= " AND p.fk_statut = ".$db->escape($search_status if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; +if ($search_user > 0) +{ + $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='project' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user; +} + + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit+1, $offset); @@ -168,12 +188,19 @@ if ($resql) if ($search_societe != '') $param.='&search_societe='.$search_societe; if ($search_status != '') $param.='&search_status='.$search_status; if ($search_public != '') $param.='&search_public='.$search_public; + if ($search_user > 0) $param.='&search_user='.$search_user; + if ($search_sale > 0) $param.='&search_sale='.$search_sale; $text=$langs->trans("Projects"); if ($mine) $text=$langs->trans('MyProjects'); print_barre_liste($text, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num); + print ''; + + print ''; + + // Show description of content if ($mine) print $langs->trans("MyProjectsDesc").'

'; else @@ -181,14 +208,36 @@ if ($resql) if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'

'; else print $langs->trans("ProjectsPublicDesc").'

'; } + + // If the user can view prospects other than his' + if ($user->rights->societe->client->voir || $socid) + { + $langs->load("commercial"); + $moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); + $moreforfilter.='       '; + } + // If the user can view prospects other than his' + + if (($user->rights->societe->client->voir || $socid) && !$mine) + { + $moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': '; + $moreforfilter.=$form->select_dolusers($search_user,'search_user',1); + } + if (! empty($moreforfilter)) + { + print ''; + print ''; + } + - print ''; - - print '
'; + print $moreforfilter; + print '
'; print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"p.title","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"p.datee","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Visibility"),$_SERVER["PHP_SELF"],"p.public","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],'p.fk_statut',"",$param,'align="right"',$sortfield,$sortorder); @@ -205,6 +254,8 @@ if ($resql) print ''; + print ''; + print ''; + + // Sales Rapresentatives + print ''; + // Date end print ''; } diff --git a/htdocs/contrat/class/index.html b/htdocs/contrat/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 From 736bee565c92862ec35be000920f62356e411d0c Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sun, 25 Jan 2015 01:20:58 +0100 Subject: [PATCH 23/83] Tooltip everywhere --- htdocs/comm/action/class/actioncomm.class.php | 8 +- htdocs/comm/card.php | 54 ++++++--- htdocs/comm/index.php | 15 ++- htdocs/comm/propal/class/propal.class.php | 18 ++- htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 4 +- htdocs/compta/bank/class/account.class.php | 9 +- htdocs/compta/bank/releve.php | 7 +- htdocs/compta/facture/class/facture.class.php | 16 ++- htdocs/compta/index.php | 107 +++++++++++++----- htdocs/contact/class/contact.class.php | 3 +- htdocs/core/boxes/box_actions.php | 66 +++++------ htdocs/core/boxes/box_activity.php | 17 +-- htdocs/core/boxes/box_bookmarks.php | 1 + htdocs/core/boxes/box_clients.php | 33 +++--- htdocs/core/boxes/box_commandes.php | 63 ++++++----- htdocs/core/boxes/box_comptes.php | 32 ++---- htdocs/core/boxes/box_contacts.php | 31 ++--- htdocs/core/boxes/box_contracts.php | 1 + htdocs/core/boxes/box_external_rss.php | 1 + htdocs/core/boxes/box_factures.php | 87 +++++++------- htdocs/core/boxes/box_factures_fourn.php | 55 ++++----- htdocs/core/boxes/box_factures_fourn_imp.php | 1 + htdocs/core/boxes/box_factures_imp.php | 77 ++++++++----- htdocs/core/boxes/box_ficheinter.php | 27 ++--- htdocs/core/boxes/box_fournisseurs.php | 1 + htdocs/core/boxes/box_members.php | 1 + htdocs/core/boxes/box_produits.php | 1 + .../core/boxes/box_produits_alerte_stock.php | 1 + htdocs/core/boxes/box_project.php | 2 + htdocs/core/boxes/box_propales.php | 1 + htdocs/core/boxes/box_prospect.php | 1 + htdocs/core/boxes/box_supplier_orders.php | 1 + htdocs/core/boxes/box_task.php | 5 +- htdocs/core/boxes/modules_boxes.php | 5 +- htdocs/core/class/commonobject.class.php | 2 + htdocs/core/lib/company.lib.php | 59 ++++++---- htdocs/expedition/class/expedition.class.php | 4 +- htdocs/expedition/list.php | 25 ++-- htdocs/expedition/shipment.php | 9 +- htdocs/fichinter/class/fichinter.class.php | 4 +- htdocs/fourn/card.php | 15 ++- .../fourn/class/fournisseur.facture.class.php | 13 ++- htdocs/fourn/commande/list.php | 23 ++-- htdocs/main.inc.php | 7 +- htdocs/product/class/product.class.php | 11 +- htdocs/product/index.php | 3 + htdocs/product/reassort.php | 1 + htdocs/product/stock/card.php | 3 +- htdocs/product/stock/mouvement.php | 4 +- htdocs/product/stock/product.php | 3 +- htdocs/projet/class/project.class.php | 6 +- htdocs/societe/class/societe.class.php | 23 +++- htdocs/societe/index.php | 46 ++++++-- htdocs/user/class/user.class.php | 56 ++++++++- htdocs/user/home.php | 28 ++++- 56 files changed, 709 insertions(+), 390 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d7f63d31872..8b93610e85e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -897,9 +897,11 @@ class ActionComm extends CommonObject global $conf,$langs; $result=''; - $label=$this->label; + $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; + $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->label; + $label = $this->label; if (empty($label)) $label=$this->libelle; // For backward compatibility - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; + $linkclose = '" title="'.dol_escape_htmltag($tooltip, 1).'" class="classfortooltip">'; if ($option=='birthday') $lien = 'type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label; $libelleshort=dol_trunc($libelle,$maxlength); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 2ad30d3b4b9..d84e45692f5 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -500,8 +500,11 @@ if ($id > 0) { $propal_static = new Propal($db); - $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.ref_client, p.remise, "; - $sql.= " p.datep as dp, p.fin_validite as datelimite"; + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; + $sql.= ", p.tva as total_tva"; + $sql.= ", p.total as total_ttc"; + $sql.= ", p.ref, p.ref_client, p.remise"; + $sql.= ", p.datep as dp, p.fin_validite as datelimite"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " AND s.rowid = ".$object->id; @@ -532,9 +535,12 @@ if ($id > 0) $var=!$var; print "
"; print '"; print '\n"; print ''; @@ -751,15 +763,18 @@ if ($id > 0) { $facturestatic = new Facture($db); - $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; - $sql.= ' f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut,'; - $sql.= ' s.nom, s.rowid as socid,'; - $sql.= ' SUM(pf.amount) as am'; + $sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount'; + $sql.= ', f.total'; + $sql.= ', f.tva as total_tva'; + $sql.= ', f.total_ttc'; + $sql.= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut'; + $sql.= ', s.nom, s.rowid as socid'; + $sql.= ', SUM(pf.amount) as am'; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture'; $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id; $sql.= " AND f.entity = ".$conf->entity; - $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.total_ttc,'; + $sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.tva, f.total_ttc,'; $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,'; $sql.= ' s.nom, s.rowid'; $sql.= " ORDER BY f.datef DESC, f.datec DESC"; @@ -788,9 +803,12 @@ if ($id > 0) $var=!$var; print ""; print ''; if ($objp->df > 0) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 5e2cc35e796..666ce7e355c 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -142,7 +142,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) */ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { - $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -173,6 +173,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $propalstatic->id=$obj->rowid; $propalstatic->ref=$obj->ref; $propalstatic->ref_client=$obj->ref_client; + $propalstatic->total_ht = $obj->total_ht; + $propalstatic->total_tva = $obj->total_tva; + $propalstatic->total_ttc = $obj->total_ttc; print $propalstatic->getNomUrl(1); print ''; print ''; print '\n"; + //print $thirdparty_static->getNomUrl(1); + //print "\n"; // Type - print '\n"; + // Type + print '\n"; + // Type + print '\n"; + // Type + print '\n"; + print ''; // Last modified date diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 11eaa8afb45..70349b1db83 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1781,12 +1781,58 @@ class User extends CommonObject * @param string $option On what the link point to * @return string String with URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0, $option='', $infologin=0) { - global $langs; + global $langs, $conf, $db; + global $dolibarr_main_authentication, $dolibarr_main_demo; + + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("User") . ''; + $label.= '
'; print ''; print ' '; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; @@ -265,6 +316,41 @@ if ($resql) } print ''; + if($objp->socid) + { + $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); + $nbofsalesrepresentative=count($listsalesrepresentatives); + if ($nbofsalesrepresentative > 3) // We print only number + { + print ''; + print $nbofsalesrepresentative; + print ''; + } + else if ($nbofsalesrepresentative > 0) + { + $userstatic=new User($db); + $j=0; + foreach($listsalesrepresentatives as $val) + { + $userstatic->id=$val['id']; + $userstatic->lastname=$val['lastname']; + $userstatic->firstname=$val['firstname']; + print $userstatic->getNomUrl(1); + $j++; + if ($j < $nbofsalesrepresentative) print ', '; + } + } + else print $langs->trans("NoSalesRepresentativeAffected"); + } + else + { + print ' '; + } + print ''; print dol_print_date($db->jdate($objp->date_end),'day'); From 44a2bef29d919c70ce47258cdbae1a9458d840ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 30 Jan 2015 11:31:04 +0100 Subject: [PATCH 22/83] Better syntax in contract card --- htdocs/contrat/card.php | 2 +- htdocs/contrat/class/index.html | 0 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 htdocs/contrat/class/index.html diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e3f6c0efeb9..b2b99a9dde3 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1306,7 +1306,7 @@ else $productstatic->ref=$objp->label; print $productstatic->getNomUrl(0,'',16); } - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) and $objp->description) + if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($objp->description)) print '
'.dol_nl2br($objp->description); print '
'; - $propal_static->id=$objp->propalid; - $propal_static->ref=$objp->ref; - $propal_static->ref_client=$objp->ref_client; + $propal_static->id = $objp->propalid; + $propal_static->ref = $objp->ref; + $propal_static->ref_client = $objp->ref_client; + $propal_static->total_ht = $objp->total_ht; + $propal_static->total_tva = $objp->total_tva; + $propal_static->total_ttc = $objp->total_ttc; print $propal_static->getNomUrl(1); if ( ($db->jdate($objp->dp) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); @@ -561,9 +567,12 @@ if ($id > 0) { $commande_static=new Commande($db); - $sql = "SELECT s.nom, s.rowid,"; - $sql.= " c.rowid as cid, c.total_ht, c.ref, c.ref_client, c.fk_statut, c.facture,"; - $sql.= " c.date_commande as dc"; + $sql = "SELECT s.nom, s.rowid"; + $sql.= ", c.rowid as cid, c.total_ht"; + $sql.= ", c.tva as total_tva"; + $sql.= ", c.total_ttc"; + $sql.= ", c.ref, c.ref_client, c.fk_statut, c.facture"; + $sql.= ", c.date_commande as dc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " AND s.rowid = ".$object->id; @@ -610,9 +619,12 @@ if ($id > 0) $var=!$var; print "
'; - $commande_static->id=$objp->cid; - $commande_static->ref=$objp->ref; + $commande_static->id = $objp->cid; + $commande_static->ref = $objp->ref; $commande_static->ref_client=$objp->ref_client; + $commande_static->total_ht = $objp->total_ht; + $commande_static->total_tva = $objp->total_tva; + $commande_static->total_ttc = $objp->total_ttc; print $commande_static->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->dc),'day')."'.price($objp->total_ht).'
'; - $facturestatic->id=$objp->facid; - $facturestatic->ref=$objp->facnumber; - $facturestatic->type=$objp->type; + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->facnumber; + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; print $facturestatic->getNomUrl(1); print ''; @@ -210,7 +213,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $langs->load("orders"); - $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; + $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -241,6 +244,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; $orderstatic->ref_client=$obj->ref_client; + $orderstatic->total_ht = $obj->total_ht; + $orderstatic->total_tva = $obj->total_tva; + $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print ''; @@ -469,7 +475,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $langs->load("propal"); - $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; + $sql = "SELECT s.nom as name, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -506,6 +512,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $propalstatic->id=$obj->propalid; $propalstatic->ref=$obj->ref; $propalstatic->ref_client=$obj->ref_client; + $propalstatic->total_ht = $obj->total_ht; + $propalstatic->total_tva = $obj->total_tva; + $propalstatic->total_ttc = $obj->total_ttc; print ''; print ''; print ''; print ''; @@ -218,8 +227,10 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) */ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { - $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.type,"; - $sql.= " s.nom as name, s.rowid as socid"; + $sql = "SELECT f.ref, f.rowid, f.total_ht, f.tva as total_tva, f.total_ttc, f.type"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.rowid = f.fk_soc AND f.fk_statut = 0"; @@ -249,14 +260,19 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print ''; print ''; print ''; print ''; @@ -292,10 +308,12 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $langs->load("boxes"); $facstatic=new Facture($db); - $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.paye, f.tms,"; - $sql.= " f.date_lim_reglement as datelimite,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " sum(pf.amount) as am"; + $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms"; + $sql.= ", f.date_lim_reglement as datelimite"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -335,6 +353,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; @@ -353,9 +374,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->client=1; + $thirdpartystatic->code_client = $obj->code_client; + $thirdpartystatic->code_fournisseur = $obj->code_fournisseur; print $thirdpartystatic->getNomUrl(1,'customer',44); print ''; - if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -391,8 +414,10 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $langs->load("boxes"); $facstatic=new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye"; - $sql.= ", s.nom as name, s.rowid as socid"; + $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_fournisseur"; $sql.= ", SUM(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn"; @@ -401,7 +426,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= " AND ff.entity = ".$conf->entity; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; - $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; + $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.tms, ff.paye, s.nom, s.rowid"; $sql.= " ORDER BY ff.tms DESC "; $sql.= $db->plimit($max, 0); @@ -427,13 +452,18 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $obj = $db->fetch_object($resql); print ''; print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; @@ -612,9 +642,11 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $commandestatic=new Commande($db); $langs->load("orders"); - $sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.total_ttc"; + $sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva as total_tva, c.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; @@ -677,6 +709,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->client=1; + $societestatic->code_client = $obj->code_client; + $societestatic->code_fournisseur = $obj->code_fournisseur; print $societestatic->getNomUrl(1,'customer',44); print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; @@ -715,10 +749,12 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $facstatic=new Facture($db); - $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.total_ttc, f.paye, f.tms,"; - $sql.= " f.date_lim_reglement as datelimite,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " sum(pf.amount) as am"; + $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms"; + $sql.= ", f.date_lim_reglement as datelimite"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -758,6 +794,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; @@ -776,9 +815,11 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->client=1; + $societestatic->code_client = $obj->code_client; + $societestatic->code_fournisseur = $obj->code_fournisseur; print $societestatic->getNomUrl(1,'customer',44); print ''; - if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; + if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; print ''; @@ -820,9 +861,12 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $facstatic=new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; - $sql.= " s.nom as name, s.rowid as socid,"; - $sql.= " sum(pf.amount) as am"; + $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.code_fournisseur"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -832,7 +876,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $sql.= " AND ff.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; - $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,"; + $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_ttc, ff.paye,"; $sql.= " s.nom, s.rowid"; $resql=$db->query($sql); @@ -859,12 +903,17 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print ''; $societestatic->id=$obj->socid; $societestatic->name=$obj->name; $societestatic->client=0; + $societestatic->code_client = $obj->code_client; + $societestatic->code_fournisseur = $obj->code_fournisseur; print ''; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index f3cbeccd586..baa46bc0356 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -887,7 +887,8 @@ class Contact extends CommonObject global $langs; $result=''; - $label = $langs->trans("ShowContact").': '.$this->getFullName($langs); + $label = '' . $langs->trans("ShowContact") . ''; + $label.= '
' . $langs->trans("Name") . ': '.$this->getFullName($langs); $lien = ''; $lienfin=''; diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 06d70d65db0..8ccf34b0f6b 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2014 Charles-Fr BENKE + * Copyright (C) 2015 Frederic 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 @@ -55,15 +56,20 @@ class box_actions extends ModeleBoxes $this->max=$max; - include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - $actionstatic=new ActionComm($db); + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + $societestatic = new Societe($db); + $actionstatic = new ActionComm($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max)); if ($user->rights->agenda->myactions->read) { - $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage,"; - $sql.= " ta.code, ta.libelle as type_label,"; - $sql.= " s.nom as name, s.rowid as socid"; + $sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage"; + $sql.= ", ta.code"; + $sql.= ", ta.libelle as type_label"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, "; $sql.= MAIN_DB_PREFIX."actioncomm AS a)"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; @@ -81,62 +87,52 @@ class box_actions extends ModeleBoxes $result = $db->query($sql); if ($result) { $now=dol_now(); - $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + $delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; $num = $db->num_rows($result); $i = 0; while ($i < $num) { $late = ''; $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->dp); + $datelimite = $db->jdate($objp->dp); + $actionstatic->label = $objp->label; + $actionstatic->type_label = $objp->type_label; + $actionstatic->code = $objp->code; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; - if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late")); + if ($objp->percentage >= 0 && $objp->percentage < 100 && $datelimite < ($now - $delay_warning)) + $late=img_warning($langs->trans("Late")); //($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label) - $label=empty($objp->label)?$objp->type_label:$objp->label; + $label = empty($objp->label)?$objp->type_label:$objp->label; $tooltip = $langs->trans('Action'.$objp->code).': '.$label; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => ("action"), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($label,32), + 'text' => $actionstatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/comm/action/card.php?id=".$objp->id, + 'asis' => 1, ); - $tooltip = $langs->trans('Customer').': '.$objp->name; - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->socid?'company':''), - 'tooltip' => $tooltip, - 'url' => ($objp->socid?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid:''), - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($objp->name,24), - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left" class="nowrap"', 'text' => dol_print_date($datelimite, "dayhour"), ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => ($objp->percentage>= 0?$objp->percentage.'%':''), ); - $this->info_box_contents[$i][6] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $actionstatic->LibStatut($objp->percentage,3), ); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index dcc2b99c887..882ac65ef11 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -1,7 +1,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2014 Frederic France + * Copyright (C) 2014-2015 Frederic 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 @@ -75,7 +75,6 @@ class box_activity extends ModeleBoxes $totalnb = 0; $i = 0; $cachetime = 3600; - $cachedir = DOL_DATA_ROOT.'/cache/boxes'; $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'-r'.($user->rights->societe->client->voir?'1':'0').'.cache'; $now = dol_now(); $nbofyears=2; @@ -95,6 +94,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $facturestatic=new Facture($db); + $cachedir = DOL_DATA_ROOT.'/facture/temp'; $filename = '/boxactivity-invoice'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); @@ -177,6 +177,7 @@ class box_activity extends ModeleBoxes ); } + $cachedir = DOL_DATA_ROOT.'/facture/temp'; $filename = '/boxactivity-invoice2'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); @@ -262,6 +263,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $commandestatic=new Commande($db); + $cachedir = DOL_DATA_ROOT.'/commande/temp'; $filename = '/boxactivity-order'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); @@ -344,6 +346,7 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propalstatic=new Propal($db); + $cachedir = DOL_DATA_ROOT.'/propale/temp'; $filename = '/boxactivity-propal'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); $data = array(); @@ -383,7 +386,7 @@ class box_activity extends ModeleBoxes if (! empty($data)) { $j=0; while ($i < count($data)) { - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left" width="16"', 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), @@ -391,12 +394,12 @@ class box_activity extends ModeleBoxes ); $objp = $db->fetch_object($result); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', 'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), @@ -404,12 +407,12 @@ class box_activity extends ModeleBoxes ); $totalnb += $data[$j]->nb; - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), ); $totalMnt += $data[$j]->Mnttot; - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3), ); diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 5250108f76c..cc65536ce3f 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 01e0dc92635..bd331faadae 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 @@ -79,7 +80,13 @@ class box_clients extends ModeleBoxes if ($user->rights->societe->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status"; + $sql = "SELECT s.nom as name, s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.client"; + $sql.= ", s.code_fournisseur"; + $sql.= ", s.fournisseur"; + $sql.= ", s.logo"; + $sql.= ", s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 3)"; @@ -103,26 +110,26 @@ class box_clients extends ModeleBoxes $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); $datem=$db->jdate($objp->tms); + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->logo = $objp->logo; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => $url.$objp->socid - ); - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => $url.$objp->socid + 'text' => $thirdpartystatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day") ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $thirdpartystatic->LibStatut($objp->status,3) ); diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 670a5358d20..796cdc53f15 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 @@ -53,20 +54,33 @@ class box_commandes extends ModeleBoxes { global $user, $langs, $db, $conf; - $this->max=$max; + $this->max = $max; - include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - $commandestatic=new Commande($db); + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $commandestatic = new Commande($db); + $societestatic = new Societe($db); $userstatic = new User($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerOrders",$max)); if ($user->rights->commande->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " c.ref, c.tms, c.rowid, c.date_commande,"; - $sql.= " c.fk_statut, c.fk_user_valid, c.facture, c.total_ht"; + $sql = "SELECT s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; + $sql.= ", s.logo"; + $sql.= ", c.ref, c.tms"; + $sql.= ", c.rowid"; + $sql.= ", c.date_commande"; + $sql.= ", c.ref_client"; + $sql.= ", c.fk_statut"; + $sql.= ", c.fk_user_valid"; + $sql.= ", c.facture"; + $sql.= ", c.total_ht"; + $sql.= ", c.tva as total_tva"; + $sql.= ", c.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -89,32 +103,27 @@ class box_commandes extends ModeleBoxes $objp = $db->fetch_object($result); $date=$db->jdate($objp->date_commande); $datem=$db->jdate($objp->tms); + $commandestatic->id = $objp->rowid; + $commandestatic->ref = $objp->ref; + $commandestatic->ref_client = $objp->ref_client; + $commandestatic->total_ht = $objp->total_ht; + $commandestatic->total_tva = $objp->total_tva; + $commandestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; + $societestatic->logo = $objp->logo; $this->info_box_contents[$i][] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Order').': '.$objp->ref, - 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid, + 'td' => 'align="left"', + 'text' => $commandestatic->getNomUrl(1), + 'asis' => 1, ); $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->ref, - 'tooltip' => $langs->trans('Order').': '.$objp->ref, - 'url' => DOL_URL_ROOT."/commande/card.php?id=".$objp->rowid, - ); - $this->info_box_contents[$i][] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][] = array( - 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, ); $this->info_box_contents[$i][] = array( @@ -127,7 +136,7 @@ class box_commandes extends ModeleBoxes $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), - 'url' => (($objp->fk_user_valid > 0)?DOL_URL_ROOT.'/user/card.php?id='.$objp->fk_user_valid:''), + 'asis' => 1, ); } diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index da585f7ea71..752ddfafe1f 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Frederic 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 @@ -102,31 +103,24 @@ class box_comptes extends ModeleBoxes $objp = $db->fetch_object($result); $account_static->id = $objp->rowid; + $account_static->label = $objp->label; + $account_static->number = $objp->number; $solde=$account_static->solde(0); $solde_total[$objp->currency_code] += $solde; - $tooltip = $langs->trans('Account').': '.$objp->label . '
' . $langs->trans('AccountNumber').': '.$objp->number; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->label, - 'tooltip' => $tooltip, - 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, + 'text' => $account_static->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', 'text' => $objp->number, ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); @@ -136,21 +130,17 @@ class box_comptes extends ModeleBoxes // Total foreach ($solde_total as $key=>$solde) { - $this->info_box_contents[$i][0] = array( + $this->info_box_contents[$i][] = array( 'tr' => 'class="liste_total"', - 'td' => 'align="right" class="liste_total"', - 'text' => ' ', - ); - $this->info_box_contents[$i][1] = array( 'td' => 'align="left" class="liste_total"', 'text' => $langs->trans('Total').' '.$key, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" class="liste_total"', 'text' => ' ' ); - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" class="liste_total"', 'text' => price($solde, 0, $langs, 0, -1, -1, $key) ); diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 8ec8bf77b9c..a7abde7494b 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 @@ -92,35 +93,19 @@ class box_contacts extends ModeleBoxes $societestatic->id=$objp->fk_soc; $societestatic->name=$objp->socname; - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0), - 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $contactstatic->getFullName($langs,0), - 'tooltip' => $langs->trans('Contact').': '.$contactstatic->getFullName($langs,0), - 'url' => DOL_URL_ROOT."/contact/card.php?id=".$objp->rowid, + 'text' => $contactstatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => ($objp->fk_soc > 0?'company':''), - 'tooltip' => $societestatic->name, - 'url' => ($objp->fk_soc > 0?DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc:''), - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $societestatic->name, - 'tooltip' => $societestatic->name, - 'url' => DOL_URL_ROOT."/societe/soc.php?socid=".$objp->fk_soc, + 'text' => $societestatic->getNomUrl(1), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($datem, "day"), ); diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index c980be624da..c72916e9f51 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 689efc751c6..773f98fff70 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -3,6 +3,7 @@ * Copyright (C) 2003 Eric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 84f7e61b315..dd1059cf9d2 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 @@ -53,8 +54,11 @@ class box_factures extends ModeleBoxes $this->max=$max; - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($db); + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $facturestatic=new Facture($db); + $societestatic = new Societe($db); $text = $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."CustomerBills",$max); $this->info_box_head = array( @@ -62,11 +66,16 @@ class box_factures extends ModeleBoxes 'limit'=> dol_strlen($text) ); - if ($user->rights->facture->lire) - { - $sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.total as total_ht, f.datef as df"; + if ($user->rights->facture->lire) { + $sql = "SELECT f.rowid as facid"; + $sql.= ", f.facnumber, f.type, f.total as total_ht"; + $sql.= ", f.tva as total_tva"; + $sql.= ", f.total_ttc"; + $sql.= ", f.datef as df"; $sql.= ", f.paye, f.fk_statut, f.datec, f.tms"; - $sql.= ", s.nom as name, s.rowid as socid"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ", s.code_client"; $sql.= ", f.date_lim_reglement as datelimite"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -88,60 +97,48 @@ class box_factures extends ModeleBoxes $i = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $datelimite=$db->jdate($objp->datelimite); - $date=$db->jdate($objp->df); - $datem=$db->jdate($objp->tms); + while ($i < $num) { + $objp = $db->fetch_object($result); + $datelimite = $db->jdate($objp->datelimite); + $date = $db->jdate($objp->df); + $datem = $db->jdate($objp->tms); + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->facnumber; + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->code_client = $objp->code_client; - $picto='bill'; - if ($objp->type == 1) $picto.='r'; - if ($objp->type == 2) $picto.='a'; $late = ''; if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));} - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $picto, - 'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->facnumber, + 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $langs->trans('CustomerInvoice').': '.$objp->facnumber, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid, + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][3] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'maxlength'=>40, - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1, '', 40), + 'asis' => 1, ); - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => price($objp->total_ht), ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($date,'day'), ); - $this->info_box_contents[$i][6] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right" width="18"', 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3), ); @@ -173,11 +170,11 @@ class box_factures extends ModeleBoxes } /** - * Method to show box + * Method to show box * - * @param array $head Array with properties of box title - * @param array $contents Array with properties of box lines - * @return void + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @return void */ function showBox($head = null, $contents = null) { diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 4e222369949..f48d2ab43d3 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 @@ -55,7 +56,10 @@ class box_factures_fourn extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $facturestatic=new FactureFournisseur($db); + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $facturestatic = new FactureFournisseur($db); + $societestatic = new Societe($db); $this->info_box_head = array( 'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills",$max) @@ -64,7 +68,12 @@ class box_factures_fourn extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.total_ht,"; + $sql.= " s.code_fournisseur,"; + $sql.= " s.logo,"; + $sql.= " f.rowid as facid, f.ref, f.ref_supplier,"; + $sql.= " f.total_ht,"; + $sql.= " f.total_tva,"; + $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut,"; $sql.= ' f.datef as df,'; $sql.= ' f.datec as datec,'; @@ -94,47 +103,41 @@ class box_factures_fourn extends ModeleBoxes $datelimite=$db->jdate($objp->datelimite); $date=$db->jdate($objp->df); $datem=$db->jdate($objp->tms); + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->ref; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->fournisseur = 1; + $societestatic->code_fournisseur = $objp->code_fournisseur; + $societestatic->logo = $objp->logo; $late = ''; if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, - ); - - $this->info_box_contents[$i][1] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->facid), + 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, - 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, - 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, + 'asis' => 1, ); - $this->info_box_contents[$i][2] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', 'text' => $objp->ref_supplier, 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
'.$langs->trans('RefSupplier').': '.$objp->ref_supplier, 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, ); - $this->info_box_contents[$i][3] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $langs->trans('Supplier').': '.$objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, - ); - - $this->info_box_contents[$i][4] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="left"', - 'text' => $objp->name, - 'tooltip' => $langs->trans('Supplier').': '.$objp->name, - 'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid, + 'text' => $societestatic->getNomUrl(1, 'supplier'), + 'asis' => 1, ); - $this->info_box_contents[$i][5] = array( + $this->info_box_contents[$i][] = array( 'td' => 'align="right"', 'text' => dol_print_date($date,'day'), ); diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 37b42f70cfa..a82af75332a 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index e6df1530f8d..d7817d134d3 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 @@ -57,15 +58,24 @@ class box_factures_imp extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($db); + include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + + $facturestatic = new Facture($db); + $societestatic = new Societe($db); $this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidCustomerBills",$max)); if ($user->rights->facture->lire) { $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql.= " s.code_client,"; + $sql.= " s.logo,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; + $sql.= " f.type,"; $sql.= " f.amount, f.datef as df,"; + $sql.= " f.total as total_ht,"; + $sql.= " f.tva as total_tva,"; + $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -92,34 +102,43 @@ class box_factures_imp extends ModeleBoxes { $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->datelimite); + $facturestatic->id = $objp->facid; + $facturestatic->ref = $objp->facnumber; + $facturestatic->type = $objp->type; + $facturestatic->total_ht = $objp->total_ht; + $facturestatic->total_tva = $objp->total_tva; + $facturestatic->total_ttc = $objp->total_ttc; + $societestatic->id = $objp->socid; + $societestatic->name = $objp->name; + $societestatic->client = 1; + $societestatic->code_client = $objp->code_client; + $societestatic->logo = $objp->logo; $late=''; if ($datelimite < ($now - $conf->facture->client->warning_delay)) $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day'))); - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="left"', + 'text' => $facturestatic->getNomUrl(1), + 'text2'=> $late, + 'asis' => 1, + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->facnumber, - 'text2'=> $late, - 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="left"', + 'text' => $societestatic->getNomUrl(1, '', 44), + 'asis' => 1, + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); + $this->info_box_contents[$i][] = array( + 'td' => 'align="right"', + 'text' => dol_print_date($datelimite,'day'), + ); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->name, - 'maxlength'=>44, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - - $this->info_box_contents[$i][4] = array('td' => 'align="right"', - 'text' => dol_print_date($datelimite,'day'), - ); - - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); + $this->info_box_contents[$i][] = array( + 'td' => 'align="right" width="18"', + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3), + ); $i++; } @@ -130,14 +149,18 @@ class box_factures_imp extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', - 'maxlength'=>500, - 'text' => ($db->error().' sql='.$sql)); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql), + ); } } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', - 'text' => $langs->trans("ReadPermissionNotAllowed")); + $this->info_box_contents[0][0] = array( + 'td' => 'align="left"', + 'text' => $langs->trans("ReadPermissionNotAllowed"), + ); } } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 9cce737eb9a..decf5e564f0 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -1,20 +1,21 @@ * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2015 Frederic 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 -* (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 . -*/ + * 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/boxes/box_ficheinter.php diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 19850598505..e9c21da739f 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -1,6 +1,7 @@ * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index 1e87995203a..46de6175354 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index ac1d3d9ec19..3c379687291 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 5a1b898fc1f..843207f883a 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -3,6 +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 * * 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 diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index b765c99c836..703d35b408b 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -1,6 +1,8 @@ * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 07bf074665f..7bec6849ac7 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 73d5cf0f70e..ef9585202b0 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 7fb66608840..d435e5ca3dc 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -3,6 +3,7 @@ /* Copyright (C) 2004-2006 Destailleur Laurent * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2012 Raphaël Doursenaud + * Copyright (C) 2015 Frederic 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 diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index d20ee2017d6..eb9c26b416a 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,5 +1,6 @@ + * Copyright (C) 2015 Frederic 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 @@ -99,13 +100,13 @@ class box_task extends ModeleBoxes $objp = $db->fetch_object($result); $this->info_box_contents[$i][1] = array( 'td' => 'align="left"', - 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0) + 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0), ); $this->info_box_contents[$i][2] = array( 'td' => 'align="right"', 'text' => $objp->nb." ".$langs->trans("Tasks"), - 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut + 'url' => DOL_URL_ROOT."/projet/tasks/index.php?leftmenu=projects&viewstatut=".$objp->fk_statut, ); $totalnb += $objp->nb; $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index faaaaff2ec6..dfe83012acf 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2015 Frederic 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 @@ -183,13 +184,13 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; $MAXLENGTHBOX=60; // Mettre 0 pour pas de limite - $bcx=array(); + $bcx = array(); $bcx[0] = 'class="box_pair"'; $bcx[1] = 'class="box_impair"'; $var = false; $cachetime = 900; // 900 : 15mn - $cachedir = DOL_DATA_ROOT.'/cache/boxes'; + $cachedir = DOL_DATA_ROOT.'/boxes/temp'; $fileid = get_class($this).'id-'.$this->box_id.'-e'.$conf->entity.'-u'.$user->id.'-s'.$user->societe_id.'.cache'; $filename = '/box-'.$fileid; $refresh = dol_cache_refresh($cachedir, $filename, $cachetime); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dc39692f08e..f3deab3eb04 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2691,6 +2691,8 @@ abstract class CommonObject $product_static->type=$line->fk_product_type; $product_static->id=$line->fk_product; $product_static->ref=$line->ref; + if (! empty($line->entity)) + $product_static->entity=$line->entity; $text=$product_static->getNomUrl(1); // Define output language and label diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index e78ea2ae7cd..9d3a236fb11 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2,11 +2,12 @@ /* Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin - * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Juanjo Menent * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2015 Frederic 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 @@ -988,9 +989,11 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0) } $out.='
'; // Statut @@ -1235,22 +1238,36 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) { if ($histo[$key]['elementtype'] == 'propal' && ! empty($conf->propal->enabled)) { - $propalstatic->ref=$langs->trans("ProposalShort"); - $propalstatic->id=$histo[$key]['fk_element']; - $out.=$propalstatic->getNomUrl(1); - } + //$propalstatic->ref=$langs->trans("ProposalShort"); + //$propalstatic->id=$histo[$key]['fk_element']; + if ($propalstatic->fetch($histo[$key]['fk_element'])>0) { + $propalstatic->type=$histo[$key]['ftype']; + $out.=$propalstatic->getNomUrl(1); + } else { + $out.= $langs->trans("ProposalDeleted"); + } + } elseif (($histo[$key]['elementtype'] == 'order' || $histo[$key]['elementtype'] == 'commande') && ! empty($conf->commande->enabled)) { - $orderstatic->ref=$langs->trans("Order"); - $orderstatic->id=$histo[$key]['fk_element']; - $out.=$orderstatic->getNomUrl(1); - } + //$orderstatic->ref=$langs->trans("Order"); + //$orderstatic->id=$histo[$key]['fk_element']; + if ($orderstatic->fetch($histo[$key]['fk_element'])>0) { + $orderstatic->type=$histo[$key]['ftype']; + $out.=$orderstatic->getNomUrl(1); + } else { + $out.= $langs->trans("OrderDeleted"); + } + } elseif (($histo[$key]['elementtype'] == 'invoice' || $histo[$key]['elementtype'] == 'facture') && ! empty($conf->facture->enabled)) { - $facturestatic->ref=$langs->trans("Invoice"); - $facturestatic->id=$histo[$key]['fk_element']; - $facturestatic->type=$histo[$key]['ftype']; - $out.=$facturestatic->getNomUrl(1,'compta'); + //$facturestatic->ref=$langs->trans("Invoice"); + //$facturestatic->id=$histo[$key]['fk_element']; + if ($facturestatic->fetch($histo[$key]['fk_element'])>0) { + $facturestatic->type=$histo[$key]['ftype']; + $out.=$facturestatic->getNomUrl(1,'compta'); + } else { + $out.= $langs->trans("InvoiceDeleted"); + } } else $out.=' '; } @@ -1272,9 +1289,11 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0) // Auteur $out.=''; // Statut diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 00105cf967a..4dc14ea37b5 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1217,7 +1217,9 @@ class Expedition extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowSending").': '.$this->ref; + $label = '' . $langs->trans("ShowSending") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2468c9084d2..d9e26368a74 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -69,7 +69,7 @@ $shipment=new Expedition($db); $helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('',$langs->trans('ListOfSendings'),$helpurl); -$sql = "SELECT e.rowid, e.ref, e.date_delivery as date_expedition, l.date_delivery as date_livraison, e.fk_statut"; +$sql = "SELECT e.rowid, e.ref, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut"; $sql.= ", s.nom as socname, s.rowid as socid"; $sql.= " FROM (".MAIN_DB_PREFIX."expedition as e"; if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all @@ -120,8 +120,10 @@ if ($resql) print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateDeliveryPlanned"), $_SERVER["PHP_SELF"],"e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); - if($conf->livraison_bon->enabled) { + if($conf->expedition_bon->enabled) { print_liste_field_titre($langs->trans("DeliveryOrder"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, '',$sortfield,$sortorder); + } + if($conf->livraison_bon->enabled) { print_liste_field_titre($langs->trans("DateReceived"), $_SERVER["PHP_SELF"],"e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); @@ -137,10 +139,12 @@ if ($resql) print ''; print ''; print ''; - if($conf->livraison_bon->enabled) { + if($conf->expedition_bon->enabled) { print ''; } print '\n"; - if($conf->livraison_bon->enabled) { + if($conf->expedition_bon->enabled) { // Date real - print "\n"; + print ''."\n"; + } + if($conf->livraison_bon->enabled) { + print ''."\n"; } print ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index bce365447e1..a4e4e57fe94 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -380,7 +380,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " cd.qty,"; $sql.= ' cd.date_start,'; $sql.= ' cd.date_end,'; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; + $sql.= ' p.label as product_label, p.entity, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc, p.fk_product_type as product_type'; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; @@ -436,7 +436,8 @@ if ($id > 0 || ! empty($ref)) $commande->fetch_thirdparty(); $prod = new Product($db); - $prod->id=$objp->fk_product; + $prod->id = $objp->fk_product; + $prod->entity = $objp->entity; $prod->getMultiLangs(); $outputlangs = $langs; @@ -461,9 +462,11 @@ if ($id > 0 || ! empty($ref)) $product_static->type=$objp->fk_product_type; $product_static->id=$objp->fk_product; $product_static->ref=$objp->ref; + $product_static->entity = $objp->entity; $text=$product_static->getNomUrl(1); $text.= ' - '.$label; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'
'; + $description.= $product_static->show_photos($conf->product->multidir_output[$product_static->entity],1,1,0,0,0,80); print $form->textwithtooltip($text,$description,3,'','',$i); // Show range diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 58c0efdda9a..10a50947bba 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -547,7 +547,9 @@ class Fichinter extends CommonObject global $langs; $result=''; - $label=$langs->trans("Show").': '.$this->ref; + $label = '' . $langs->trans("ShowIntervention") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; $lien = ''; $lienfin=''; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 0fefa8d4555..af379d633e7 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -336,7 +336,7 @@ if ($object->id > 0) } // TODO move to DAO class - $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut"; + $sql = "SELECT p.rowid,p.ref, p.date_commande as dc, p.fk_statut, p.total_ht, p.tva as total_tva, p.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as p "; $sql.= " WHERE p.fk_soc =".$object->id; $sql.= " AND p.entity =".$conf->entity; @@ -368,8 +368,11 @@ if ($object->id > 0) print ""; print ''; print ''; } - // Author - $userstatic->id=$obj->fk_user_author; - $userstatic->login=$obj->login; + // Author + $userstatic->id = $obj->fk_user_author; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->login = $obj->login; + $userstatic->photo = $obj->photo; print ""; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b6244802318..a5eecd998e3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1401,6 +1401,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $form=new Form($db); // Define link to login card + /* $loginhtmltext=''; $logintext=''; if ($user->societe_id) { @@ -1421,9 +1422,9 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $loginhtmltext.='
'.$langs->trans("Administrator").': '.yn($user->admin); $type=($user->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); $loginhtmltext.='
'.$langs->trans("Type").': '.$type; - $loginhtmltext.='
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; $loginhtmltext.='
'; $loginhtmltext.='
'.$langs->trans("Connection").''; + $loginhtmltext.='
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $loginhtmltext.='
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; $loginhtmltext.='
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); $loginhtmltext.='
'.$langs->trans("ConnectedSince").': '.dol_print_date($user->datelastlogin,"dayhour"); @@ -1435,6 +1436,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $loginhtmltext.='
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; if (! empty($conf->browser->phone)) $loginhtmltext.='
'.$langs->trans("Phone").': '.$conf->browser->phone; if (! empty($_SESSION["disablemodules"])) $loginhtmltext.='
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); + */ $appli='Dolibarr'; if (! empty($conf->global->MAIN_APPLICATION_TITLE)) @@ -1468,7 +1470,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu.=''; $toprightmenu.='\n"; print ''; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index c8480d6e65a..ab184cdf943 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -306,6 +306,7 @@ if ($resql) print '"; print "'; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 1bac6b9fef5..f525457e1c5 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -119,7 +119,7 @@ $formother=new FormOther($db); $formproduct=new FormProduct($db); $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type,"; -$sql.= " e.label as stock, e.rowid as entrepot_id,"; +$sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,"; $sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.fk_origin, m.origintype,"; $sql.= " u.login"; $sql.= " FROM (".MAIN_DB_PREFIX."entrepot as e,"; @@ -501,6 +501,7 @@ if ($resql) print '\n"; @@ -515,6 +516,7 @@ if ($resql) print '\n"; // Author diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 352750295af..435fca794de 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -751,7 +751,7 @@ if ( (! empty($conf->productbatch->enabled)) && $product->hasbatch()) { print ''; } -$sql = "SELECT e.rowid, e.label, ps.reel, ps.pmp, ps.rowid as product_stock_id"; +$sql = "SELECT e.rowid, e.label, e.lieu, ps.reel, ps.pmp, ps.rowid as product_stock_id"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= " WHERE ps.reel != 0"; @@ -775,6 +775,7 @@ if ($resql) $obj = $db->fetch_object($resql); $entrepotstatic->id=$obj->rowid; $entrepotstatic->libelle=$obj->label; + $entrepotstatic->lieu=$obj->lieu; print ''; print ''; print ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1d24076df27..93c0e6cf7f0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -789,7 +789,11 @@ class Project extends CommonObject $result = ''; $lien = ''; $lienfin = ''; - $label = $langs->trans("ShowProject") . ': ' . $this->ref . ($this->title ? ' - ' . $this->title : ''); + $label = '' . $langs->trans("ShowProject") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->title)) + $label .= '
' . $langs->trans('Name') . ': ' . $this->title; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option != 'nolink') { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e1f2e424dee..35450a206ef 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1720,35 +1720,56 @@ class Societe extends CommonObject $result=''; $lien=$lienfin=''; + $label = '
'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e8ace86cf73..f18f02b60d8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2605,9 +2605,17 @@ class Propal extends CommonObject global $langs; $result=''; - $label=$langs->trans("ShowPropal").': '.$this->ref; + $label = '' . $langs->trans("ShowPropal") . ''; + if (! empty($this->ref)) + $label.= '
'.$langs->trans('Ref').': '.$this->ref; if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == '') { $lien = ''; + $label = '' . $langs->trans("ShowAccount") . ''; + if (! empty($this->label)) + $label .= '
' . $langs->trans('Account') . ': ' . $this->label; + if (! empty($this->number)) + $label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number; + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if (empty($mode)) { @@ -948,7 +953,7 @@ class Account extends CommonObject $lienfin='
'; } - if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAccount").': '.$this->label, 'account', 'class="classfortooltip"').$lienfin.' '); + if ($withpicto) $result.=($lien.img_object($label, 'account', 'class="classfortooltip"').$lienfin.' '); $result.=$lien.$this->label.$lienfin; return $result; } diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index e4afe6f2b25..902495bc6aa 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -391,10 +391,9 @@ else } } elseif ($links[$key]['type']=='company') { - print ''; - print img_object($langs->trans('ShowCustomer'),'company').' '; - print dol_trunc($links[$key]['label'],24); - print ''; + $societestatic->id = $links[$key]['url_id']; + $societestatic->name = $links[$key]['label']; + print $societestatic->getNomUrl(1, 'company', 24); $newline=0; } elseif ($links[$key]['type']=='member') { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d30a19cd040..d8357b15d14 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -858,9 +858,17 @@ class Facture extends CommonInvoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_DEPOSIT) $picto.='d'; // Deposit invoice - $label=$langs->trans("ShowInvoice").': '.$this->ref; + $label = '' . $langs->trans("ShowInvoice") . ''; + if (! empty($this->ref)) + $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->ref_client)) - $label.= '
' . $langs->trans('RefCustomer') . $this->ref_client; + $label .= '
' . $langs->trans('RefCustomer') . ': ' . $this->ref_client; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($this->type == self::TYPE_REPLACEMENT) $label=$langs->transnoentitiesnoconv("ShowInvoiceReplace").': '.$this->ref; if ($this->type == self::TYPE_CREDIT_NOTE) $label=$langs->transnoentitiesnoconv("ShowInvoiceAvoir").': '.$this->ref; if ($this->type == self::TYPE_DEPOSIT) $label=$langs->transnoentitiesnoconv("ShowInvoiceDeposit").': '.$this->ref; @@ -3330,7 +3338,8 @@ class Facture extends CommonInvoice $sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,'; $sql.= ' l.date_start, l.date_end,'; $sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,'; - $sql.= ' p.description as product_desc'; + $sql.= ' p.description as product_desc,'; + $sql.= ' p.entity'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid'; $sql.= ' WHERE l.fk_facture = '.$this->id; @@ -3353,6 +3362,7 @@ class Facture extends CommonInvoice $this->lines[$i]->description = $obj->description; $this->lines[$i]->fk_product = $obj->fk_product; $this->lines[$i]->ref = $obj->product_ref; + $this->lines[$i]->entity = $obj->entity; // Product entity $this->lines[$i]->product_label = $obj->product_label; $this->lines[$i]->product_desc = $obj->product_desc; $this->lines[$i]->fk_product_type = $obj->fk_product_type; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9265c9ee463..b1d32083a8a 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -144,8 +144,12 @@ if (! empty($conf->don->enabled) && $user->rights->don->lire) */ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.type,"; - $sql.= " s.nom as name, s.rowid as socid"; + $sql = "SELECT f.facnumber"; + $sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc"; + $sql.= ", f.type"; + $sql.= ", s.nom as name"; + $sql.= ", s.rowid as socid"; + $sql.= ",s.code_client"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -180,13 +184,18 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; + $facturestatic->total_ht=$obj->total_ht; + $facturestatic->total_tva=$obj->total_tva; + $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; - $companystatic->client=1; + $companystatic->client = 1; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; print $companystatic->getNomUrl(1,'',16); print ''.price($obj->total_ttc).'
'; $facturesupplierstatic->ref=$obj->ref; $facturesupplierstatic->id=$obj->rowid; + $facturesupplierstatic->total_ht=$obj->total_ht; + $facturesupplierstatic->total_tva=$obj->total_tva; + $facturesupplierstatic->total_ttc=$obj->total_ttc; $facturesupplierstatic->type=$obj->type; print $facturesupplierstatic->getNomUrl(1,'',16); print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; - $companystatic->client=1; - print $companystatic->getNomUrl(1,'',16); + $companystatic->fournisseur = 1; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; + print $companystatic->getNomUrl(1,'supplier',16); print ''.price($obj->total_ttc).'
'; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; + $facturestatic->total_ht=$obj->total_ht; + $facturestatic->total_tva=$obj->total_tva; + $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); print ''.price($obj->total).''.price($obj->total_ht).''.price($obj->total_ttc).''.dol_print_date($db->jdate($obj->tms),'day').''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'
'; $facstatic->ref=$obj->ref; - $facstatic->id=$obj->rowid; + $facstatic->id = $obj->rowid; + $facstatic->total_ht = $obj->total_ht; + $facstatic->total_tva = $obj->total_tva; + $facstatic->total_ttc = $obj->total_ttc; print $facstatic->getNomUrl(1,''); print ''; $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; $thirdpartystatic->fournisseur=1; + $thirdpartystatic->code_client = $obj->code_client; + $thirdpartystatic->code_fournisseur = $obj->code_fournisseur; print $thirdpartystatic->getNomUrl(1,'supplier',44); print ''.price($obj->total_ht).''.price($obj->total_ht).''; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; + $facturestatic->total_ht=$obj->total_ht; + $facturestatic->total_tva=$obj->total_tva; + $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->type=$obj->type; print $facturestatic->getNomUrl(1,''); print ''.price($obj->total).''.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->am).''.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'
'; $facstatic->ref=$obj->ref; - $facstatic->id=$obj->rowid; + $facstatic->id = $obj->rowid; + $facstatic->total_ht = $obj->total_ht; + $facstatic->total_tva = $obj->total_tva; + $facstatic->total_ttc = $obj->total_ttc; print $facstatic->getNomUrl(1,''); print ''.$societestatic->getNomUrl(1, 'supplier', 44).''.price($obj->total_ht).''.price($obj->total_ttc).''; - $userstatic->id=$obj->fk_user_author; - $userstatic->login=$obj->login; - $out.=$userstatic->getLoginUrl(1); + //$userstatic->id=$obj->fk_user_author; + //$userstatic->login=$obj->login; + //$out.=$userstatic->getLoginUrl(1); + $userstatic->fetch($obj->fk_user_author); + $out.=$userstatic->getNomUrl(1); $out.=''; - $userstatic->id=$histo[$key]['userid']; - $userstatic->login=$histo[$key]['login']; - $out.=$userstatic->getLoginUrl(1); + //$userstatic->id=$histo[$key]['userid']; + //$userstatic->login=$histo[$key]['login']; + //$out.=$userstatic->getLoginUrl(1); + $userstatic->fetch($histo[$key]['userid']); + $out.=$userstatic->getNomUrl(1); $out.=' '; print ''; + } + if($conf->livraison_bon->enabled) { print ' '; @@ -178,17 +182,22 @@ if ($resql) // Date delivery planed print ""; - print dol_print_date($db->jdate($objp->date_expedition),"day"); + print dol_print_date($db->jdate($objp->date_livraison),"day"); /*$now = time(); if ( ($now - $db->jdate($objp->date_expedition)) > $conf->warnings->lim && $objp->statutid == 1 ) { }*/ print ""; - print dol_print_date($db->jdate($objp->date_livraison),"day"); - print "'; + print dol_print_date($db->jdate($objp->date_expedition),"day"); + print ''; + print dol_print_date($db->jdate($objp->date_reception),"day"); + print ''.$expedition->LibStatut($objp->fk_statut,5).'
'; - $orderstatic->id=$obj->rowid; - $orderstatic->ref=$obj->ref; + $orderstatic->id = $obj->rowid; + $orderstatic->ref = $obj->ref; + $orderstatic->total_ht = $obj->total_ht; + $orderstatic->total_tva = $obj->total_tva; + $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print ''; @@ -407,7 +410,7 @@ if ($object->id > 0) if ($user->rights->fournisseur->facture->lire) { // TODO move to DAO class - $sql = 'SELECT f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef as df,f.total_ttc as amount,f.paye,'; + $sql = 'SELECT f.rowid,f.libelle,f.ref,f.ref_supplier,f.fk_statut,f.datef as df, f.total_ht, f.total_tva, f.total_ttc as amount,f.paye,'; $sql.= ' SUM(pf.amount) as am'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON f.rowid=pf.fk_facturefourn'; @@ -440,6 +443,10 @@ if ($object->id > 0) print ''; $facturestatic->id=$obj->rowid; $facturestatic->ref=($obj->ref?$obj->ref:$obj->rowid).($obj->ref_supplier?' - '.$obj->ref_supplier:''); + $facturestatic->ref_supplier = $obj->ref_supplier; + $facturestatic->total_ht = $obj->total_ht; + $facturestatic->total_tva = $obj->total_tva; + $facturestatic->total_ttc = $obj->total_ttc; //$facturestatic->ref_supplier=$obj->ref_supplier; print $facturestatic->getNomUrl(1); //print img_object($langs->trans('ShowBill'),'bill').' '.($obj->ref?$obj->ref:$obj->rowid).' - '.$obj->ref_supplier.''; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 842fe9fcf0b..8ba3a8d53e9 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1472,8 +1472,17 @@ class FactureFournisseur extends CommonInvoice global $langs; $result=''; - $label=$langs->trans("ShowInvoice").': '.$this->ref; - if ($this->ref_supplier) $label.=' / '.$this->ref_supplier; + $label = '' . $langs->trans("ShowSupplierInvoice") . ''; + if (! empty($this->ref)) + $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->ref_supplier)) + $label.= '
' . $langs->trans('RefSupplier') . ': ' . $this->ref_supplier; + if (! empty($this->total_ht)) + $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_tva)) + $label.= '
' . $langs->trans('TVA') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + if (! empty($this->total_ttc)) + $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); if ($option == 'document') { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b94a746a7b9..548e9b674c2 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -98,10 +98,14 @@ $offset = $conf->liste_limit * $page ; * Mode Liste */ -$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc,"; -$sql.= " cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison,"; -$sql.= " p.rowid as project_id, p.ref as project_ref,"; -$sql.= " u.login"; +$sql = "SELECT s.rowid as socid, s.nom as name, cf.date_commande as dc"; +$sql.= ", cf.rowid,cf.ref, cf.ref_supplier, cf.fk_statut, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author,cf.date_livraison"; +$sql.= ", p.rowid as project_id"; +$sql.= ", p.ref as project_ref"; +$sql.= ", u.firstname"; +$sql.= ", u.lastname"; +$sql.= ", u.photo"; +$sql.= ", u.login"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid"; @@ -257,11 +261,14 @@ if ($resql) print '
"; - if ($userstatic->id) print $userstatic->getLoginUrl(1); + if ($userstatic->id) print $userstatic->getNomUrl(1); else print " "; print "'; $product_static->id=$objp->rowid; $product_static->ref=$objp->ref; + $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; + $product_static->entity = $objp->entity; print $product_static->getNomUrl(1,'',16); print "'.dol_trunc($objp->label,32).'
'; $product_static->ref=$objp->ref; $product_static->id=$objp->rowid; + $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; print $product_static->getNomUrl(1,'',16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index b31305b448b..0d21b91d109 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -435,7 +435,8 @@ else print "
"; $productstatic->id=$objp->rowid; - $productstatic->ref=$objp->ref; + $productstatic->ref = $objp->ref; + $productstatic->label = $objp->produit; $productstatic->type=$objp->type; print $productstatic->getNomUrl(1,'stock',16); print ''; $productstatic->id=$objp->rowid; $productstatic->ref=$objp->product_ref; + $productstatic->label=$objp->produit; $productstatic->type=$objp->type; print $productstatic->getNomUrl(1,'',16); print "'; $warehousestatic->id=$objp->entrepot_id; $warehousestatic->libelle=$objp->stock; + $warehousestatic->lieu=$objp->lieu; print $warehousestatic->getNomUrl(1); print "
'.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').'
'; + $label.= ''; + $label.= ''; + if (! empty($this->logo)) { + $form = new Form($db); + $label .= ''; + } + $label.= '
'; if ($option == 'customer' || $option == 'compta') { + $label.= '' . $langs->trans("ShowCustomer") . ''; $lien = ''; $lien = ''; $lien = ''; $lien = ''; $lien = ''; $lien = 'name)) + $label.= '
' . $langs->trans('Name') . ': '. $this->name; + if (! empty($this->code_client)) + $label.= '
' . $langs->trans('CustomerCode') . ': '. $this->code_client; + if (! empty($this->code_fournisseur)) + $label.= '
' . $langs->trans('SupplierCode') . ': '. $this->code_fournisseur; + + $label.= '
  ' . $form->showphoto('societe', $this, 80) . '
'; // Add type of canvas $lien.=(!empty($this->canvas)?'&canvas='.$this->canvas:'').'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a6a00bb0046..d92a28a08f1 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -245,7 +245,9 @@ print '
'; * Last third parties modified */ $max=15; -$sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur, s.canvas, s.tms as datem, s.status as status"; +$sql = "SELECT s.rowid, s.nom as name, s.client, s.fournisseur"; +$sql.= ", s.logo"; +$sql.= ", s.canvas, s.tms as datem, s.status as status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ' WHERE s.entity IN ('.getEntity('societe', 1).')'; @@ -289,29 +291,49 @@ if ($result) $thirdparty_static->name=$objp->name; $thirdparty_static->client=$objp->client; $thirdparty_static->fournisseur=$objp->fournisseur; + $thirdparty_static->logo = $objp->logo; $thirdparty_static->datem=$db->jdate($objp->datem); $thirdparty_static->status=$objp->status; $thirdparty_static->canvas=$objp->canvas; - print $thirdparty_static->getNomUrl(1); - print "
'; + //print ''; if ($thirdparty_static->client==1 || $thirdparty_static->client==3) { - $thirdparty_static->name=$langs->trans("Customer"); - print $thirdparty_static->getNomUrl(0,'customer'); + print $thirdparty_static->getNomUrl(1, 'customer'); + print "'; + print $langs->trans("Customer"); + } + if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + print $thirdparty_static->getNomUrl(1); + print "'; + print " / "; } - if ($thirdparty_static->client == 3 && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) print " / "; if (($thirdparty_static->client==2 || $thirdparty_static->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $thirdparty_static->name=$langs->trans("Prospect"); - print $thirdparty_static->getNomUrl(0,'prospect'); + print $thirdparty_static->getNomUrl(1, 'prospect'); + print "'; + print $langs->trans("Prospect"); } if (! empty($conf->fournisseur->enabled) && $thirdparty_static->fournisseur) { - if ($thirdparty_static->client) print " / "; - $thirdparty_static->name=$langs->trans("Supplier"); - print $thirdparty_static->getNomUrl(0,'supplier'); + if (! $thirdparty_static->client) { + print $thirdparty_static->getNomUrl(1, 'supplier'); + print "'; + print $langs->trans("Supplier"); + } else { + // Type + print " / "; + print $langs->trans("Supplier"); + } } print '
'; + $label.= ''; + $label.= ''; + } + $label.= ''; + + // Info Login + if ($infologin) { + $label.= '
'; + $label.= '
'.$langs->trans("Connection").''; + $label.= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; + if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $label.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; + $label.= '
'.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); + $label.= '
'.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin,"dayhour"); + $label.= '
'.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin,"dayhour"); + $label.= '
'.$langs->trans("CurrentTheme").': '.$conf->theme; + $label.= '
'.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $s=picto_from_langcode($langs->getDefaultLang()); + $label.= '
'.$langs->trans("CurrentUserLanguage").': '.($s?$s.' ':'').$langs->getDefaultLang(); + $label.= '
'.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; + if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; + if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); + } - $result=''; - $label = $langs->trans("ShowUser").': '.$this->getFullName($langs,'','',24); $lien = '
'; $lienfin=''; @@ -1795,7 +1841,7 @@ class User extends CommonObject $result.=($lien.img_object($label, 'user', 'class="classfortooltip"').$lienfin); if ($withpicto != 2) $result.=' '; } - $result.=$lien.$this->getFullName($langs,'','',24).$lienfin; + $result.= $lien . $this->getFullName($langs,'','',24) . $companylink . $lienfin; return $result; } diff --git a/htdocs/user/home.php b/htdocs/user/home.php index c9b3693f1ac..72e9b124ae0 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -98,8 +98,16 @@ print '
'; */ $max=10; -$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_societe, u.datec, u.statut, u.entity, u.ldap_sid,"; -$sql.= " s.nom as name, s.canvas"; +$sql = "SELECT u.rowid, u.lastname, u.firstname, u.admin, u.login, u.fk_societe, u.datec, u.statut"; +$sql.= ", u.entity"; +$sql.= ", u.ldap_sid"; +$sql.= ", u.photo"; +$sql.= ", u.admin"; +$sql.= ", u.email"; +$sql.= ", u.skype"; +$sql.= ", s.nom as name"; +$sql.= ", s.code_client"; +$sql.= ", s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_societe = s.rowid"; if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->multicompany->transverse_mode || ($user->admin && ! $user->entity))) @@ -129,7 +137,18 @@ if ($resql) $var=!$var; print ""; - print ''.img_object($langs->trans("ShowUser"),"user").' '.dolGetFirstLastname($obj->firstname,$obj->lastname).''; + print ''; + $fuserstatic->id = $obj->rowid; + $fuserstatic->statut = $obj->statut; + $fuserstatic->lastname = $obj->lastname; + $fuserstatic->firstname = $obj->firstname; + $fuserstatic->login = $obj->login; + $fuserstatic->photo = $obj->photo; + $fuserstatic->admin = $obj->admin; + $fuserstatic->email = $obj->email; + $fuserstatic->skype = $obj->skype; + $fuserstatic->societe_id = $obj->fk_societe; + print $fuserstatic->getNomUrl(1); if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { print img_picto($langs->trans("SuperAdministrator"),'redstar'); @@ -145,6 +164,7 @@ if ($resql) { $companystatic->id=$obj->fk_societe; $companystatic->name=$obj->name; + $companystatic->code_client = $obj->code_client; $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } @@ -175,8 +195,6 @@ if ($resql) print ''; print ''.dol_print_date($db->jdate($obj->datec),'dayhour').''; print ''; - $fuserstatic->id=$obj->rowid; - $fuserstatic->statut=$obj->statut; print $fuserstatic->getLibStatut(3); print ''; From a35bd9a3e45dcad59bb17dea904377ff13a43e58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 00:27:11 +0100 Subject: [PATCH 24/83] Fixed bad sql request --- htdocs/fourn/commande/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4f0974abd10..54cc7b1964a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -123,7 +123,7 @@ if ($search_user) } if ($search_ttc) { - $sql .= " AND total_ttc = '".$db->escape(price2num($search_ttc))."'"; + $sql .= " AND cf.total_ttc = '".$db->escape(price2num($search_ttc))."'"; } if ($sall) { @@ -134,7 +134,7 @@ if ($socid) $sql.= " AND s.rowid = ".$socid; //Required triple check because statut=0 means draft filter if (GETPOST('statut', 'int') !== '') { - $sql .= " AND fk_statut IN (".GETPOST('statut').")"; + $sql .= " AND cf.fk_statut IN (".GETPOST('statut').")"; } if ($search_refsupp) { @@ -142,8 +142,8 @@ if ($search_refsupp) } if ($search_status >= 0) { - if ($search_status == 6 || $search_status == 7) $sql.=" AND fk_statut IN (6,7)"; - else $sql.=" AND fk_statut = ".$search_status; + if ($search_status == 6 || $search_status == 7) $sql.=" AND cf.fk_statut IN (6,7)"; + else $sql.=" AND cf.fk_statut = ".$search_status; } $sql.= $db->order($sortfield,$sortorder); @@ -172,7 +172,7 @@ if ($resql) if ($search_refsupp) $param.="&search_refsupp=".$search_refsupp; if ($socid) $param.="&socid=".$socid; if ($search_status >= 0) $param.="&search_status=".$search_status; - + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); print ''; print ''; @@ -268,7 +268,7 @@ if ($resql) } print "
\n"; print "\n"; - + print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; $db->free($resql); From c1943f989bfbaf1132a1d79f76aed042521c7a83 Mon Sep 17 00:00:00 2001 From: frederic34 Date: Sat, 31 Jan 2015 10:58:03 +0100 Subject: [PATCH 25/83] Tooltip --- htdocs/commande/list.php | 4 +++- htdocs/user/class/user.class.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index a0a38d50800..5a4f3b5fa14 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Frederic 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 @@ -109,7 +110,7 @@ $companystatic = new Societe($db); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; llxHeader('',$langs->trans("Orders"),$help_url); -$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; +$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; $sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison, c.fk_statut, c.facture as facturee'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql.= ', '.MAIN_DB_PREFIX.'commande as c'; @@ -425,6 +426,7 @@ if ($resql) // Company $companystatic->id=$objp->socid; + $companystatic->code_client = $objp->code_client; $companystatic->name=$objp->name; $companystatic->client=$objp->client; print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 4a9e1f8514a..ee43d8c48af 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1777,6 +1777,7 @@ class User extends CommonObject * * @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) * @param string $option On what the link point to + * @param boolean $infologin Add connection info to the tooltip * @return string String with URL */ function getNomUrl($withpicto=0, $option='', $infologin=0) From 720caf8e31a3cf87282f35631426b8af65eb8842 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 12:19:06 +0100 Subject: [PATCH 26/83] Missing XPF currency --- htdocs/install/mysql/data/llx_c_currencies.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index 70a3486f959..90785b52fc3 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -150,6 +150,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VEF' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'VND', '[8363]', 1, 'Viet Nam Dong'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XAF', NULL, 1, 'Communaute Financiere Africaine (BEAC) CFA Franc'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XOF', NULL, 1, 'Communaute Financiere Africaine (BCEAO) Franc'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XPF', NULL, 1, 'Franc pacifique (XPF)'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'YER', '[65020]', 1, 'Yemen Rial'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ZWD', '[90,36]', 1, 'Zimbabwe Dollar'); From ce8ad39a8e59302ef7f01c9899229e137c873967 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 13:00:51 +0100 Subject: [PATCH 27/83] Remove test code and restore prod code. --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 129d32fc7d9..794ba7ac2af 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -520,7 +520,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default // Get format of bank account according to its country $usedetailedbban=$account->useDetailedBBAN(); - $onlynumber=0; $usedetailedbban=1; // For tests + //$onlynumber=0; $usedetailedbban=1; // For tests if ($usedetailedbban) { $savcurx=$curx; From 8d45d3cd59b8ab1c60628d884e09f7db9f00907f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 31 Jan 2015 15:51:55 +0100 Subject: [PATCH 28/83] Update 3.7.0-3.8.0.sql --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 8729a775af6..0839e2ac08e 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -47,7 +47,7 @@ CREATE TABLE llx_printing userid integer )ENGINE=innodb; -ALTER TABLE llx_product_fournisseur_price ADD fk_price_expression integer DEFAULT NULL; +ALTER TABLE llx_product_fournisseur_price ADD COLUMN fk_price_expression integer DEFAULT NULL; -- Taiwan VAT Rates insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 2131, 213, '5', '0', 'VAT 5%', 1); From d32f52cc506341766c81b5dc191253f749312091 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 16:23:23 +0100 Subject: [PATCH 29/83] Fix date of delivery, and avoid duplicate tracking number. --- .../modules/expedition/doc/pdf_merou.modules.php | 16 ++++++++++++---- .../expedition/doc/pdf_rouget.modules.php | 15 +++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index fefe2f591fe..e861bff6169 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -560,7 +560,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->SetXY($blSocX-80,$blSocY+17); $pdf->SetFont('','B', $default_font_size - 2); $pdf->SetTextColor(0,0,0); - $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L'); + $pdf->MultiCell(50, 8, $outputlangs->transnoentities("DateDelivery")." : " . dol_print_date($object->date_delivery,'day',false,$outputlangs,true), '', 'L'); $pdf->SetXY($blSocX-80,$blSocY+20); $pdf->SetFont('','B', $default_font_size - 2); @@ -568,7 +568,7 @@ class pdf_merou extends ModelePdfExpedition $pdf->MultiCell(50, 8, $outputlangs->transnoentities("TrackingNumber")." : " . $object->tracking_number, '', 'L'); // Deliverer - $pdf->SetXY($blSocX-80,$blSocY+24); + $pdf->SetXY($blSocX-80,$blSocY+23); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetTextColor(0,0,0); @@ -581,8 +581,16 @@ class pdf_merou extends ModelePdfExpedition { // Get code using getLabelFromKey $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code'); - $label=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; - $pdf->writeHTMLCell(50, 8, '', '', $label." ".$object->tracking_url, '', 'L'); + $label=''; + $label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); + //var_dump($object->tracking_url != $object->tracking_number);exit; + if ($object->tracking_url != $object->tracking_number) + { + $label.=" : "; + $label.=$object->tracking_url; + } + $pdf->SetFont('','B', $default_font_size - 2); + $pdf->writeHTMLCell(50, 8, '', '', $label, '', 'L'); } } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index ef9db41254b..9c5dada3a72 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -212,10 +212,17 @@ class pdf_rouget extends ModelePdfExpedition { // Get code using getLabelFromKey $code=$outputlangs->getLabelFromKey($this->db,$object->shipping_method_id,'c_shipment_mode','rowid','code'); - $label=$outputlangs->trans("LinkToTrackYourPackage")."
"; - $label.=$outputlangs->trans("SendingMethod".strtoupper($code))." :"; + $label=''; + if ($object->tracking_url != $object->tracking_number) $label.=$outputlangs->trans("LinkToTrackYourPackage")."
"; + $label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); + //var_dump($object->tracking_url != $object->tracking_number);exit; + if ($object->tracking_url != $object->tracking_number) + { + $label.=" : "; + $label.=$object->tracking_url; + } $pdf->SetFont('','B', $default_font_size - 2); - $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top+6, $label." ".$object->tracking_url, 0, 1, false, true, 'L'); + $pdf->writeHTMLCell(60, 4, $this->posxdesc-1, $tab_top_alt, $label, 0, 1, false, true, 'L'); $tab_top_alt = $pdf->GetY(); } @@ -537,7 +544,7 @@ class pdf_rouget extends ModelePdfExpedition $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_creation,"daytext",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true), '', 'R'); if (! empty($object->client->code_client)) { From 13019f1f3371e3d96bba1612ffc839d0e373e814 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 17:02:36 +0100 Subject: [PATCH 30/83] Clean code introduced by last PR. --- htdocs/core/lib/functions.lib.php | 101 ---------------- htdocs/core/lib/functionsnumtoword.lib.php | 131 +++++++++++++++++++++ htdocs/product/class/priceparser.class.php | 3 +- 3 files changed, 132 insertions(+), 103 deletions(-) create mode 100644 htdocs/core/lib/functionsnumtoword.lib.php diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dd061dd6c43..daed685ce63 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4965,104 +4965,3 @@ function natural_search($fields, $value) return " AND " . ($end > 1? '(' : '') . $res; } -/** - * Function to return text in currency mexican of a - * number less than 1 million and more than zero. - * - * @param float $numero Number to convert - * @return string $entexto Text of the number - * - * Víctor Ortiz Pérez 23 Enero 2015 victor@accett.com.mx - */ -function float2text_moneda($numero){ - $veintis = array("VEINTE","VEINTIUN","VEINTIDÓS","VEINTITRÉS","VEINTICUATRO","VEINTICINCO","VEINTISÉIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); - $unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); - $decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); - $centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); - $number = $numero; - $parte_decimal = $numero - (int)$numero; - $parte_decimal = (int)round($parte_decimal*100); - if ($parte_decimal < 10) - $parte_decimal = "0".$parte_decimal; - $entexto =""; - if ($numero>=1 && $numero<2) { - $entexto .= " UN PESO ".$parte_decimal." / 100 M.N."; - } - elseif ($numero>=0 && $numero<1){ - $entexto .= " CERO PESOS ".$parte_decimal." / 100 M.N."; - } - elseif ($numero>=100 && $numero<101){ - $entexto .= " CIEN PESOS ".$parte_decimal." / 100 M.N."; - } - else { - $cdm = (int)($numero / 100000); - $numero = $numero - $cdm * 100000; - $ddm = (int)($numero / 10000); - $numero = $numero - $ddm * 10000; - $udm = (int)($numero / 1000); - $numero = $numero - $udm * 1000; - $c = (int)($numero / 100); - $numero = $numero - $c * 100; - $d = (int)($numero / 10); - $u = (int)$numero - $d * 10; - $completo=FALSE; - if ($cdm==1 && $ddm==0 && $udm==0){ - $entexto .= "CIEN"; - $completo = TRUE; - } - if ($cdm!=0 && !$completo){ - $entexto .= $centenas[$cdm-1]." "; - } - $completo=FALSE; - if ($ddm>2){ - $entexto .= " ".$decenas[$ddm-1]; - if ($udm!=0){ - $entexto .= " Y "; - } - } - elseif ($ddm!=0){ - $completo=TRUE; - if ($ddm==1){ - $entexto .= " ".$diecis[$udm]; - } - else{ - $entexto .= " ".$veintis[$udm]; - } - } - if ($udm!=0 && !$completo){ - $entexto .= $unidades[$udm-1]; - } - $completo=FALSE; - if ($number>=1000){ - $entexto .= " MIL "; - } - - if ($c==1 && $d==0 && $u==0){ - $entexto .= "CIEN"; - $completo = TRUE; - } - if ($c!=0 && !$completo){ - $entexto .= $centenas[$c-1]." "; - } - if ($d>2){ - $entexto .= " ".$decenas[$d-1]; - if ($u!=0){ - $entexto .= " Y "; - } - } - elseif ($d!=0){ - $completo=TRUE; - if ($d==1){ - $entexto .= " ".$diecis[$u]; - } - else{ - $entexto .= " ".$veintis[$u]; - } - } - if ($u!=0 && !$completo){ - $entexto .= $unidades[$u-1]; - } - $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; - } - return $entexto; -} diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php new file mode 100644 index 00000000000..ff9b46668b9 --- /dev/null +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -0,0 +1,131 @@ + + * Copyright (C) 2015 Víctor Ortiz Pérez + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/lib/functionsnumbertoword.lib.php + * \brief A set of functions for Dolibarr + * This file contains all frequently used functions. + */ + +/** + * Function to return number or amount in text. + * + * @param float $numero Number to convert + * @param Lang $lang Language + * @return string $entexto Text of the number + */ +function dolNumberToWord($numero, $langs, $numorcurrency='number') +{ + $entexto=$numero; + + if ($langs->default == 'es_MX' && $numorcurrency == 'currency') + { + $veintis = array("VEINTE","VEINTIUN","VEINTIDÓS","VEINTITRÉS","VEINTICUATRO","VEINTICINCO","VEINTISÉIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); + $unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); + $decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); + $centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); + $number = $numero; + $parte_decimal = $numero - (int) $numero; + $parte_decimal = (int) round($parte_decimal*100); + if ($parte_decimal < 10) + $parte_decimal = "0".$parte_decimal; + $entexto =""; + if ($numero>=1 && $numero<2) { + $entexto .= " UN PESO ".$parte_decimal." / 100 M.N."; + } + elseif ($numero>=0 && $numero<1){ + $entexto .= " CERO PESOS ".$parte_decimal." / 100 M.N."; + } + elseif ($numero>=100 && $numero<101){ + $entexto .= " CIEN PESOS ".$parte_decimal." / 100 M.N."; + } + else { + $cdm = (int) ($numero / 100000); + $numero = $numero - $cdm * 100000; + $ddm = (int) ($numero / 10000); + $numero = $numero - $ddm * 10000; + $udm = (int) ($numero / 1000); + $numero = $numero - $udm * 1000; + $c = (int) ($numero / 100); + $numero = $numero - $c * 100; + $d = (int) ($numero / 10); + $u = (int) $numero - $d * 10; + $completo=FALSE; + if ($cdm==1 && $ddm==0 && $udm==0){ + $entexto .= "CIEN"; + $completo = TRUE; + } + if ($cdm!=0 && !$completo){ + $entexto .= $centenas[$cdm-1]." "; + } + $completo=FALSE; + if ($ddm>2){ + $entexto .= " ".$decenas[$ddm-1]; + if ($udm!=0){ + $entexto .= " Y "; + } + } + elseif ($ddm!=0){ + $completo=TRUE; + if ($ddm==1){ + $entexto .= " ".$diecis[$udm]; + } + else{ + $entexto .= " ".$veintis[$udm]; + } + } + if ($udm!=0 && !$completo){ + $entexto .= $unidades[$udm-1]; + } + $completo=FALSE; + if ($number>=1000){ + $entexto .= " MIL "; + } + + if ($c==1 && $d==0 && $u==0){ + $entexto .= "CIEN"; + $completo = TRUE; + } + if ($c!=0 && !$completo){ + $entexto .= $centenas[$c-1]." "; + } + if ($d>2){ + $entexto .= " ".$decenas[$d-1]; + if ($u!=0){ + $entexto .= " Y "; + } + } + elseif ($d!=0){ + $completo=TRUE; + if ($d==1){ + $entexto .= " ".$diecis[$u]; + } + else{ + $entexto .= " ".$veintis[$u]; + } + } + if ($u!=0 && !$completo){ + $entexto .= $unidades[$u-1]; + } + $entexto .= " PESOS ".$parte_decimal." / 100 M.N."; + } + } + + return $entexto; +} diff --git a/htdocs/product/class/priceparser.class.php b/htdocs/product/class/priceparser.class.php index 4907f015f8a..f7d0bea2217 100755 --- a/htdocs/product/class/priceparser.class.php +++ b/htdocs/product/class/priceparser.class.php @@ -237,9 +237,8 @@ class PriceParser * Calculates product price based on product id and expression id * * @param Product $product The Product object to get information - * @param int $expression_id The expression to parse * @param array $extra_values Any aditional values for expression - * @return int > 0 if OK, < 1 if KO + * @return int > 0 if OK, < 1 if KO */ public function parseProduct($product, $extra_values = array()) { From 21f72c75949d9b53a253db20200b61efd1a9b6a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 17:10:19 +0100 Subject: [PATCH 31/83] Fix regression --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1fc977ce807..5c645783cc1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1691,8 +1691,8 @@ class Facture extends CommonInvoice return 0; } - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate))) + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate))) { $this->error='Permission denied'; dol_syslog(get_class($this)."::validate ".$this->error, LOG_ERR); From 2788a352cfdfa7b3bf2309e82e0b0324001228fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 19:00:00 +0100 Subject: [PATCH 32/83] Missing lang loading --- htdocs/core/lib/agenda.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 72c3214610a..174b1c79092 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -50,6 +50,8 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh global $conf, $user, $langs, $db, $hookmanager; global $begin_h, $end_h, $begin_d, $end_d; + $langs->load("companies"); + // Filters print '
'; print ''; From 9188be57ce963ecc95a11a108f244271e2e5ba31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jan 2015 19:25:26 +0100 Subject: [PATCH 33/83] Select2 component creates problem of sizing with jmobile. --- htdocs/core/class/html.form.class.php | 22 ++++++++++++--------- htdocs/core/class/html.formother.class.php | 10 ++++++---- htdocs/core/class/html.formprojet.class.php | 5 +++-- htdocs/core/lib/agenda.lib.php | 2 +- htdocs/core/lib/ajax.lib.php | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 51a893832b1..38a2eee7555 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -832,8 +832,9 @@ class Form if ($conf->use_javascript_ajax && ! $forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out.= ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); - $nodatarole=' data-role="none"'; + $comboenhancement =ajax_combobox($htmlname, $events, $conf->global->COMPANY_USE_SEARCH_TO_SELECT); + $out.= $comboenhancement; + $nodatarole=($comboenhancement?' data-role="none"':''); } // Construct $out and $outarray @@ -1037,8 +1038,9 @@ class Form if ($conf->use_javascript_ajax && ! $forcecombo && ! $options_only) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out.= ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); - $nodatarole=' data-role="none"'; + $comboenhancement = ajax_combobox($htmlname, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); + $out.= $comboenhancement; + $nodatarole=($comboenhancement?' data-role="none"':''); } if ($htmlname != 'none' || $options_only) $out.= ''; @@ -4288,7 +4291,7 @@ class Form // Try also magic suggest - // Add data-role="none" to diable jmobile decoration + // Add data-role="none" to disable jmobile decoration $out = ''; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 68a7b677667..5bb491adf89 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -324,8 +324,9 @@ class FormOther if ($conf->use_javascript_ajax) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $moreforfilter.= ajax_combobox('select_categ_'.$htmlname); - $nodatarole=' data-role="none"'; + $comboenhancement = ajax_combobox('select_categ_'.$htmlname); + $moreforfilter.=$comboenhancement; + $nodatarole=($comboenhancement?' data-role="none"':''); } // Print a select with each of them @@ -373,8 +374,9 @@ class FormOther if ($conf->use_javascript_ajax) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $out.= ajax_combobox($htmlname); - $nodatarole=' data-role="none"'; + $comboenhancement = ajax_combobox($htmlname); + $out.=$comboenhancement; + $nodatarole=($comboenhancement?' data-role="none"':''); } // Select each sales and print them in a select input $out.=''; -print ''; -print ''; -print ""; print ""; print ""; @@ -143,6 +147,7 @@ if ($num) { print ''; print '' . $langs->trans('OtherOptions') . ''; print "\n"; + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '' . $langs->trans('OptionsDeactivatedForThisExportModel') . ''; } foreach ( $list as $key ) { @@ -152,7 +157,7 @@ foreach ( $list as $key ) { // Param $label = $langs->trans($key); - print '' . $label . ''; + print '' . $label . ''; // Value print ''; @@ -163,7 +168,7 @@ foreach ( $list as $key ) { print ''; print "\n"; -print '
'; +print '
'; llxFooter(); $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f1dc892c10f..6c06c2ba3d7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -75,7 +75,7 @@ if ($action == 'delbookkeeping') { setEventMessage($object->errors, 'errors'); } } -} // export csv +} // Export else if ($action == 'export_csv') { header('Content-Type: text/csv'); @@ -160,7 +160,7 @@ else { print '
'; print ''; print ''; - print ''; + print ''; print '
'; print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 95a00eaf950..5fc98690933 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * @@ -99,10 +99,10 @@ $idpays = $p[0]; $sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,"; $sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop"; -$sql .= " FROM " . MAIN_DB_PREFIX . "bank b"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account ba on b.fk_account=ba.rowid"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe soc on bu1.url_id=soc.rowid"; +$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; // To isolate the cash of the other accounts $sql .= " WHERE ba.courant <> 2"; $sql .= " AND ba.rowid=".$id_accountancy_journal; @@ -169,10 +169,12 @@ if ($result) { } $links = $object->get_url($obj->rowid); + foreach ( $links as $key => $val ) { $tabtype[$obj->rowid] = $links[$key]['type']; + if ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; @@ -401,18 +403,21 @@ if ($action == 'writeBookKeeping') setEventMessage($langs->trans('Success'), 'mesgs'); } } -// export csv +// Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $bank_journal = $conf->global->ACCOUNTING_BANK_JOURNAL; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_banque.csv'); $companystatic = new Client($db); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export { + $sep = ";"; + foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); @@ -420,23 +425,23 @@ if ($action == 'export_csv') $companystatic->name = $tabcompany[$key]['name']; // Bank - print $date . $sep; - print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep; foreach ( $tabbq[$key] as $k => $mt ) { + print $date . $sep; + print $bank_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print $val["type_payment"] . $sep; - print $sep; + print $val["ref"] . $sep; + print "\n"; } - print "\n"; // Third party foreach ( $tabtp[$key] as $k => $mt ) { if ($mt) { print $date . $sep; - print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep; + print $bank_journal . $sep; if ($val["lib"] == '(SupplierInvoicePayment)') { print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; } else { @@ -446,12 +451,12 @@ if ($action == 'export_csv') print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print $val["type_payment"] . $sep; - print $sep; + print $val["ref"] . $sep; print "\n"; } } } - } else // Modèle Export Classique + } else // Model Classic Export { foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -459,24 +464,22 @@ if ($action == 'export_csv') $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - print '"' . $date . '"' . $sep; - print '"' . $val["type_payment"] . '"' . $sep; - // Bank foreach ( $tabbq[$key] as $k => $mt ) { + print '"' . $date . '"' . $sep; + print '"' . $val["type_payment"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Bank") . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; } - print "\n"; // Third party foreach ( $tabtp[$key] as $k => $mt ) { if ($mt) { print '"' . $date . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $companystatic->name . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; @@ -503,7 +506,7 @@ else $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - print ''; + print ''; print ''; @@ -586,5 +589,4 @@ else // End of page llxFooter(); } - $db->close(); diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index 51b8625f9b3..bbd74a8c29c 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * @@ -91,10 +91,10 @@ $idpays = $p[0]; $sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,"; $sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop"; -$sql .= " FROM " . MAIN_DB_PREFIX . "bank b"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account ba on b.fk_account=ba.rowid"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe soc on bu1.url_id=soc.rowid"; +$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; // Code opération type caisse $sql .= " WHERE ba.courant = 2"; @@ -365,67 +365,69 @@ if ($action == 'writeBookKeeping') { setEventMessage($langs->trans('Success'), 'mesgs'); } } -// export csv +// Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $cash_journal = $conf->global->ACCOUNTING_CASH_JOURNAL; header('Content-Type: text/csv'); header('Content-Disposition:attachment;filename=journal_caisse.csv'); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export { + $sep = ";"; + foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); // Cash - print $date . $sep; - print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep; - foreach ( $tabbq[$key] as $k => $mt ) { + print $date . $sep; + print $cash_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'C' : 'D') . $sep; - print price($mt) . $sep; + print ($mt <= 0 ? price(- $mt) : $mt) . $sep; + print $val["type_payment"] . $sep; + print $val["ref"] . $sep; + print "\n"; } - print utf8_decode($langs->trans("CashPayment")) . $sep; - print $val["ref"] . $sep; - print "\n"; // Third party foreach ( $tabtp[$key] as $k => $mt ) { if ($mt) { print $date . $sep; - print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep; - if ($obj->label == '(SupplierInvoicePayment)') { + print $cash_journal . $sep; + if ($val["lib"] == '(SupplierInvoicePayment)') { print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; } else { print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; } print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; - print price($mt) . $sep; - print $langs->trans("ThirdParty") . $sep; + print ($mt <= 0 ? price(- $mt) : $mt) . $sep; + print $val["type_payment"] . $sep; print $val["ref"] . $sep; print "\n"; } } } - } else // Modèle Export Classique + } else // Model Classic Export { foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; // Cash foreach ( $tabbq[$key] as $k => $mt ) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . $langs->trans("Cash") . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; } - print "\n"; - + // Third party foreach ( $tabtp[$key] as $k => $mt ) { if ($mt) { @@ -455,7 +457,7 @@ if ($action == 'export_csv') { $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - print ''; + print ''; print ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 68bcdaa394f..8b9b7929db8 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -242,16 +242,19 @@ if ($action == 'writebookkeeping') { $companystatic = new Societe($db); -// export csv +// Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_achats.csv'); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export { + $sep = ";"; + foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); @@ -263,7 +266,7 @@ if ($action == 'export_csv') if ($mt) { print $date . $sep; - print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; + print $purchase_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'C' : 'D') . $sep; @@ -275,11 +278,10 @@ if ($action == 'export_csv') } // VAT - // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print $date . $sep; - print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; + print $purchase_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'C' : 'D') . $sep; @@ -289,20 +291,20 @@ if ($action == 'export_csv') print "\n"; } } - print $date . $sep; - print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; foreach ( $tabttc[$key] as $k => $mt ) { + print $date . $sep; + print $purchase_journal . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print utf8_decode($companystatic->name) . $sep; print $val["ref"]; + print "\n"; } - print "\n"; } - } else // Modèle Export Classique + } else // Model Classic Export { foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -326,7 +328,6 @@ if ($action == 'export_csv') } } // VAT - // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print '"' . $date . '"' . $sep; @@ -340,9 +341,9 @@ if ($action == 'export_csv') } // Third party - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; foreach ( $tabttc[$key] as $k => $mt ) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; @@ -370,7 +371,7 @@ if ($action == 'export_csv') $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - print ''; + print ''; print ''; @@ -434,7 +435,6 @@ if ($action == 'export_csv') } } // VAT - // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print ""; @@ -449,13 +449,11 @@ if ($action == 'export_csv') print ""; // Third party - print ""; - print ""; - foreach ( $tabttc[$key] as $k => $mt ) { + print ""; + print ""; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - print ""; - // Third party - print ""; - print ""; foreach ( $tabttc[$key] as $k => $mt ) { + print ""; + print ""; + print ""; $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; @@ -455,7 +458,6 @@ if ($action == 'export_csv') { } // VAT - // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print ""; @@ -473,8 +475,8 @@ if ($action == 'export_csv') { } print "
" . $date . "" . $invoicestatic->getNomUrl(1) . "" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accounta($k); print "" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')'; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 892272d6a5a..4c260f9fa99 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * @@ -93,7 +93,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_produc $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; $sql .= " WHERE fd.fk_code_ventilation > 0 "; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = " . $conf->entity; @@ -245,17 +245,20 @@ if ($action == 'writebookkeeping') { } } } -// export csv +// Export if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_ventes.csv'); $companystatic = new Client($db); - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) // Modèle Export Cegid Expert + if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export { + $sep = ";"; + foreach ( $tabfac as $key => $val ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; @@ -263,23 +266,23 @@ if ($action == 'export_csv') { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); - print $date . $sep; - print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep; - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; foreach ( $tabttc[$key] as $k => $mt ) { + print $date . $sep; + print $sell_journal . $sep; + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print utf8_decode($companystatic->name) . $sep; + print $val["ref"]; + print "\n"; } - print $val["ref"]; - print "\n"; // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { print $date . $sep; - print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep; + print $sell_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; @@ -289,11 +292,12 @@ if ($action == 'export_csv') { print "\n"; } } + // TVA foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print $date . $sep; - print $conf->global->ACCOUNTING_SELL_JOURNAL . $sep; + print $sell_journal . $sep; print length_accountg(html_entity_decode($k)) . $sep; print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; @@ -304,7 +308,7 @@ if ($action == 'export_csv') { } } } - } else // Modèle Export Classique + } else // Model Classic Export { foreach ( $tabfac as $key => $val ) { $companystatic->id = $tabcompany[$key]['id']; @@ -312,15 +316,16 @@ if ($action == 'export_csv') { $companystatic->client = $tabcompany[$key]['code_client']; $date = dol_print_date($db->jdate($val["date"]), 'day'); - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; + foreach ( $tabttc[$key] as $k => $mt ) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; } - print "\n"; // Product / Service foreach ( $tabht[$key] as $k => $mt ) { @@ -339,7 +344,6 @@ if ($action == 'export_csv') { } // VAT - // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { print '"' . $date . '"' . $sep; @@ -372,7 +376,7 @@ if ($action == 'export_csv') { $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - print ''; + print ''; print ''; @@ -420,12 +424,11 @@ if ($action == 'export_csv') { $date = dol_print_date($db->jdate($val["date"]), 'day'); - print "
" . $date . "" . $invoicestatic->getNomUrl(1) . "
" . $date . "" . $invoicestatic->getNomUrl(1) . "
"; + + // End of page + llxFooter(); } -// End of page -llxFooter(); - $db->close(); \ No newline at end of file diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index d683d4bb271..70a52dc90e1 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -129,7 +129,7 @@ class modAccounting extends DolibarrModules $this->const[9] = array( "ACCOUNTING_EXPORT_MODELCSV", "chaine", - "0" + "1" ); $this->const[10] = array( "ACCOUNTING_LENGTH_GACCOUNT", diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index e1713acd57c..b09dab7f764 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -13,7 +13,9 @@ ConfigAccountingExpert=Configuration of the module accounting expert Journaux=Journals JournalFinancial=Financial journals Exports=Exports +Export=Export Modelcsv=Model of export +OptionsDeactivatedForThisExportModel=For this export model, options are deactivated Selectmodelcsv=Select a model of export Modelcsv_normal=Classic export Modelcsv_CEGID=Export towards CEGID Expert @@ -66,7 +68,7 @@ Lineofinvoice=Line of invoice VentilatedinAccount=Ventilated successfully in the accounting account NotVentilatedinAccount=Not ventilated in the accounting account -ACCOUNTING_SEPARATORCSV=Separator CSV +ACCOUNTING_SEPARATORCSV=Column separator in export file ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to be breakdown shown by page (maximum recommended : 50) ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the breakdown pages "Has to breakdown" by the most recent elements From 75f451ccc7765dbbcc29d92c87d699e1457bda6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 08:59:57 +0100 Subject: [PATCH 59/83] Fix class not found --- htdocs/comm/action/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index e9fc2d62f39..0a4b255884a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -538,6 +539,7 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); $form = new Form($db); +$formfile = new FormFile($db); $formactions = new FormActions($db); if ($action == 'create') @@ -1285,7 +1287,7 @@ if ($id > 0) if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) { - print '
 
'; + print '
 

'; print ''; // ancre /* From 493732bdc3d4ad0c30c067f8f6711ed782514db5 Mon Sep 17 00:00:00 2001 From: Sof Date: Tue, 3 Feb 2015 10:45:00 +0100 Subject: [PATCH 60/83] Update action returnb PHP Fatal error: Using $this when not in object context --- htdocs/user/group/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 5f79c939432..8821b6add42 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -178,7 +178,7 @@ if ($action == 'update') $object->oldcopy=dol_clone($object); $object->name = trim($_POST["group"]); - $object->nom = $this->name; // For backward compatibility + $object->nom = $object->name; // For backward compatibility $object->note = dol_htmlcleanlastbr($_POST["note"]); // Fill array 'array_options' with data from add form From 8fcf0de5d17e92841887eff06051962c1b5b8810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 3 Feb 2015 10:50:39 +0100 Subject: [PATCH 61/83] Added branches information to contributing guidelines --- CONTRIBUTING.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f88d1de9a10..1c443fb0f53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,10 +13,25 @@ Issues are tracked at [Doliforge](https://doliforge.org/projects/dolibarr) Code ---- + +### Basic workflow + 1. Fork the [GitHub repository](https://github.com/Dolibarr/dolibarr). 2. Clone your fork. -3. Commit and push your changes. -4. Make a pull request. +3. Choose a branch(See the Branches section below). +4. Commit and push your changes. +5. Make a pull request. + +### Branches + +Unless you're fixing a bug, all pull request should be made against the *develop* branch. + +If you're fixing a bug, it is preferred that you cook your fix and pull request it +against the oldest version affected that's still supported. + +We officially support versions N, N − 1 and N − 2 for N the latest version available. + +Choose your base branch accordingly. ### General rules Please don't edit the ChangeLog file. A project manager will update it from your commit messages. From 20121c2fbed99a0475a17ab0269633b7d9cd2d20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 11:25:51 +0100 Subject: [PATCH 62/83] Fix pb into date management. Added phpunit to avoid this in future. --- htdocs/comm/action/peruser.php | 13 +++++++++--- htdocs/core/datepicker.php | 33 ++++++++++++++++++++----------- htdocs/core/lib/date.lib.php | 14 +++++++------ htdocs/core/lib/functions.lib.php | 9 +++++---- test/phpunit/DateLibTest.php | 20 +++++++++++++++++++ test/phpunit/FunctionsLibTest.php | 28 ++++++++++++++++++++++++++ 6 files changed, 92 insertions(+), 25 deletions(-) diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 04353190adb..831a019d04e 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -205,6 +205,8 @@ if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' | $param.="&maxprint=".$maxprint; $prev = dol_get_first_day_week($day, $month, $year); +//print "day=".$day." month=".$month." year=".$year; +//var_dump($prev); exit; $prev_year = $prev['prev_year']; $prev_month = $prev['prev_month']; $prev_day = $prev['prev_day']; @@ -223,6 +225,7 @@ $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); +//print $firstday.'-'.$first_month.'-'.$first_year; //print dol_print_date($firstdaytoshow,'dayhour'); //print dol_print_date($lastdaytoshow,'dayhour'); @@ -534,12 +537,16 @@ echo '' ; echo ''; -// Table : +// Line header with list of days + +//print "begin_d=".$begin_d." end_d=".$end_d; + + echo ''; echo ''; echo ''; -$i=0; +$i=0; // 0 = sunday, while ($i < 7) { if (($i + 1) < $begin_d || ($i + 1) > $end_d) @@ -679,7 +686,7 @@ foreach ($usernames as $username) // Lopp on each day of week $i = 0; - for ($iter_day = 0; $iter_day < 7; $iter_day++) + for ($iter_day = 0; $iter_day < 8; $iter_day++) { if (($i + 1) < $begin_d || ($i + 1) > $end_d) { diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 7c5c4898fce..03264601624 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -26,17 +26,18 @@ * \brief File to manage popup date selector */ -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language -if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language -if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); -if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); require_once '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php $langs->load("main"); @@ -195,9 +196,9 @@ function displayBox($selectedDate,$month,$year) - + + }else {?> @@ -209,28 +210,36 @@ function displayBox($selectedDate,$month,$year) }?> "; + //echo $conf->global->MAIN_START_WEEK.' '.$firstdate["wday"].' '.$startday; $cols=0; - for($i=0;$i< $mydate["wday"];$i++) + for ($i = 0; $i < 7; $i++) { + $w = ($i + $startday) % 7; + if ($w == $firstdate["wday"]) + { + $mydate = $firstdate; + break; + } echo ""; $cols++; } } else { - if ($mydate["wday"]==0) + if ($mydate["wday"] == $startday) { echo ""; $cols=0; @@ -254,7 +263,7 @@ function displayBox($selectedDate,$month,$year) echo ">".sprintf("%02s",$mydate["mday"]).""; $cols++; - if ($mydate["wday"]==6) echo "\n"; + if (($mydate["wday"] + 1) % 7 == $startday) echo "\n"; //$thedate=strtotime("tomorrow",$thedate); $day++; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d2c6ce4bd4f..072db988dc1 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -479,34 +479,36 @@ function dol_get_last_day($year,$month=12,$gm=false) return $datelim; } -/** Return first day of week for a date +/** Return first day of week for a date. First day of week may be monday if option MAIN_START_WEEK is 1. * * @param int $day Day * @param int $month Month * @param int $year Year * @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. - * @return array year,month,week,first_day,prev_year,prev_month,prev_day + * @return array year,month,week,first_day,first_month,first_year,prev_day,prev_month,prev_year */ function dol_get_first_day_week($day,$month,$year,$gm=false) { global $conf; + //$day=2; $month=2; $year=2015; $date = dol_mktime(0,0,0,$month,$day,$year,$gm); //Checking conf of start week $start_week = (isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1); - $tmparray = dol_getdate($date,true); + $tmparray = dol_getdate($date,true); // detail of current day - //Calculate days to count + //Calculate days = offset from current day $days = $start_week - $tmparray['wday']; if ($days>=1) $days=7-$days; $days = abs($days); $seconds = $days*24*60*60; + //print 'start_week='.$start_week.' tmparray[wday]='.$tmparray['wday'].' day offset='.$days.' seconds offset='.$seconds.'
'; //Get first day of week - $tmpday = date($tmparray[0])-$seconds; - $tmpday = date("d",$tmpday); + $tmpdaytms = date($tmparray[0])-$seconds; // $tmparray[0] is day of parameters + $tmpday = date("d",$tmpdaytms); //Check first day of week is in same month than current day or not if ($tmpday>$day) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 372d2f67373..c3446eb7b15 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -999,8 +999,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e /** * Return an array with locale date info. * PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows - * WARNING: This function always use PHP server timezone to return locale informations. + * WARNING: This function always use PHP server timezone to return locale informations !!! * Usage must be avoid. + * FIXME: Replace this with PHP date function and a parameter $gm * * @param int $timestamp Timestamp * @param boolean $fast Fast mode @@ -1010,7 +1011,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e * 'minutes' => $min, * 'hours' => $hour, * 'mday' => $day, - * 'wday' => $dow, + * 'wday' => $dow, 0=sunday, 6=saturday * 'mon' => $month, * 'year' => $year, * 'yday' => floor($secsInYear/$_day_power), @@ -1044,7 +1045,7 @@ function dol_getdate($timestamp,$fast=false) { $arrayinfo=getdate($timestamp); - $startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; + /*$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; if($startday==1) { if ($arrayinfo["wday"]==0) @@ -1055,7 +1056,7 @@ function dol_getdate($timestamp,$fast=false) { $arrayinfo["wday"]=$arrayinfo["wday"]-1; } - } + }*/ } return $arrayinfo; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index f5d9e7d0cc4..f6f94e8b201 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -341,4 +341,24 @@ class DateLibTest extends PHPUnit_Framework_TestCase return $result; } + /** + * testDolGetFirstDayWeek + * + * @return int + */ + public function testDolGetFirstDayWeek() + { + global $conf; + + $day=3; $month=2; $year=2015; + $conf->global->MAIN_START_WEEK = 1; // start on monday + $prev = dol_get_first_day_week($day, $month, $year); + $this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2 + + $day=3; $month=2; $year=2015; + $conf->global->MAIN_START_WEEK = 0; // start on sunday + $prev = dol_get_first_day_week($day, $month, $year); + $this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st + } + } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index f1b06bbbf4c..001ac0b1dec 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -888,4 +888,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase return true; } + /** + * testDolGetDate + * + * @return boolean + */ + public function testDolGetDate() + { + global $conf; + + $conf->global->MAIN_START_WEEK = 0; + + $tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday + $this->assertEquals(4, $tmp['wday']); + + $tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday + $this->assertEquals(5, $tmp['wday']); + + $conf->global->MAIN_START_WEEK = 1; + + $tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday + $this->assertEquals(4, $tmp['wday']); + + $tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday + $this->assertEquals(5, $tmp['wday']); + + return true; + } + } From 077fafdb7da5a93fb391f3f98b00ab2c7294bf34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 12:20:36 +0100 Subject: [PATCH 63/83] Remove log --- htdocs/core/datepicker.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index d8b32788add..893b3929e2e 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -188,7 +188,6 @@ function displayBox($selectedDate,$month,$year) global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; - print 'xx'.$startday; $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday'); for( $i=0; $i < 7; $i++ ) { From fe674f8fd58c9d9bd39c469bb0c4417585ecb5f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 12:21:30 +0100 Subject: [PATCH 64/83] Fix pb into date management. Added phpunit to avoid this in future. --- htdocs/core/datepicker.php | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 03264601624..893b3929e2e 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -26,13 +26,13 @@ * \brief File to manage popup date selector */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load global conf for START_WEEK if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); -if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language +if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); @@ -188,26 +188,12 @@ function displayBox($selectedDate,$month,$year) global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; - if($startday==1) - {?> - - - - - - - - - - - - - - - - + $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday'); + for( $i=0; $i < 7; $i++ ) + { + echo '', "\n"; + } + ?> Date: Tue, 3 Feb 2015 12:40:49 +0100 Subject: [PATCH 65/83] Fix pb into date management. Added phpunit to avoid this in future. --- htdocs/core/datepicker.php | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 893b3929e2e..03264601624 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -26,13 +26,13 @@ * \brief File to manage popup date selector */ -if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load global conf for START_WEEK +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); -if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled +if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); @@ -188,12 +188,26 @@ function displayBox($selectedDate,$month,$year) global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; - $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday'); - for( $i=0; $i < 7; $i++ ) - { - echo '', "\n"; - } - ?> + if($startday==1) + {?> + + + + + + + + + + + + + + + + Date: Tue, 3 Feb 2015 13:05:28 +0100 Subject: [PATCH 66/83] Fix bad operator for and --- htdocs/admin/tools/export.php | 4 ++-- htdocs/core/class/rssparser.class.php | 2 +- htdocs/core/filemanagerdol/connectors/php/commands.php | 2 +- htdocs/core/modules/member/doc/pdf_standard.class.php | 2 +- .../core/modules/printsheet/doc/pdf_standardlabel.class.php | 2 +- htdocs/expedition/card.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 0831571ace1..721692145a1 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -480,10 +480,10 @@ function backup_tables($outputfile, $tables='*') if ($row[$j] == null and !is_string($row[$j])) { // IMPORTANT: if the field is NULL we set it NULL $row[$j] = 'NULL'; - } elseif(is_string($row[$j]) and $row[$j] == '') { + } elseif(is_string($row[$j]) && $row[$j] == '') { // if it's an empty string, we set it as an empty string $row[$j] = "''"; - } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) + } elseif(is_numeric($row[$j]) && !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) // if it's a number, we return it as-is // $row[$j] = $row[$j]; } else { // else for all other cases we escape the value and put quotes around diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 5a156b1eda7..349b32d5104 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -550,7 +550,7 @@ class RssParser // elseif ($this->_format == 'atom' and $el == 'link' ) { - if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' ) + if ( isset($attrs['rel']) && $attrs['rel'] == 'alternate' ) { $link_el = 'link'; } diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 6369ac9d3ae..333717d810d 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -174,7 +174,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') if ( isset( $_FILES['NewFile'] ) && !is_null($_FILES['NewFile']['tmp_name']) // This is for the QuickUpload tab box - or (isset($_FILES['upload']) and !is_null($_FILES['upload']['tmp_name']))) + or (isset($_FILES['upload']) && !is_null($_FILES['upload']['tmp_name']))) { global $Config ; diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index cef4155c607..9268a10f3c4 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -137,7 +137,7 @@ class pdf_standard $imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker) // We are in a new page, then we must add a page - if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) { + if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) { $pdf->AddPage(); } $this->_First=0; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 8ae45bdc681..193de960bb8 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -135,7 +135,7 @@ class pdf_standardlabel $imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker) // We are in a new page, then we must add a page - if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) { + if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) { $pdf->AddPage(); } $this->_First=0; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f4a270cca00..d9539f17eb4 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -882,7 +882,7 @@ if ($action == 'create') if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; } - if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_object($product->stock_warehouse[$warehouse_id]))) + if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() && is_object($product->stock_warehouse[$warehouse_id]))) { // Quantity to send print 'global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1; - if($startday==1) - {?> - - - - - - - - - - - - - - - - + $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday'); + for( $i=0; $i < 7; $i++ ) + { + echo '', "\n"; + } + ?> + Date: Thu, 5 Feb 2015 11:58:40 +0100 Subject: [PATCH 70/83] New: Add option SUPPLIER_ORDER_HIDE_VALIDATED. So a module can remove this step. Useless when all users have permission to approve supplier orers. --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3a58479d2e0..e893c9ac0ee 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -685,7 +685,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); - if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + if ((empty($leftmenu) || $leftmenu=="orders_suppliers") && empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusOrderOnProcess"), 2, $user->rights->fournisseur->commande->lire); if (empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusOrderReceivedPartially"), 2, $user->rights->fournisseur->commande->lire); From 4c5fa7510cdba182c9b4352ad99c0aed50ac4393 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Feb 2015 12:06:20 +0100 Subject: [PATCH 71/83] Fix bad translation key --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e9ede162fb9..44408ad9a93 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -192,7 +192,7 @@ if ($resql) print ''; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder); if (empty($conf->global->SUPPLIER_ORDER_HIDE_REF_SUPPLIER)) print_liste_field_titre($langs->trans("RefSupplier"),$_SERVER["PHP_SELF"],"cf.ref_supplier","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Thirdparty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); if (! empty($conf->global->PROJECT_SHOW_REF_INTO_LISTS)) print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.login","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"cf.total_ht","",$param,'align="right"',$sortfield,$sortorder); From 35129f2192dff3f47d740c6ab80a7b8905dd0ffe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Feb 2015 16:33:33 +0100 Subject: [PATCH 72/83] Fix PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS option not correctly supported. Fix: No limit on ldap search on dolibarr side. --- htdocs/core/class/ldap.class.php | 3 +++ htdocs/fourn/facture/card.php | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 95436a51e29..dc844ee3f02 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -176,7 +176,10 @@ class Ldap if (is_resource($this->connection)) { + // Execute the ldap_set_option here (after connect and before bind) $this->setVersion(); + ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true. + if ($this->serverType == "activedirectory") { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f3e752ed9d4..26aeffad655 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1270,14 +1270,14 @@ if ($action == 'create') print ''; print ''; @@ -1392,12 +1392,13 @@ if ($action == 'create') print ''; // Project - if (! empty($conf->projet->enabled)) { + if (! empty($conf->projet->enabled)) + { $formproject = new FormProjets($db); $langs->load('projects'); print ''; } From 553181a5d92a52bd3b2d22ddaac8525fc8290540 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Feb 2015 21:26:41 +0100 Subject: [PATCH 73/83] Fixed: Location for file storage from tab attached files was not at same place than from tab images. --- htdocs/core/lib/product.lib.php | 14 +++++++------- htdocs/product/class/product.class.php | 25 ++++++++++++++++++++----- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 741dd98de6d..1aea8f9e37b 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -57,11 +57,6 @@ function product_prepare_head($object, $user) $h++; } - $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id; - $head[$h][1] = $langs->trans("Photos"); - $head[$h][2] = 'photos'; - $h++; - // Show category tab if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { @@ -116,14 +111,19 @@ function product_prepare_head($object, $user) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'product'); - // Attachments + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$object->id; + $head[$h][1] = $langs->trans("Photos"); + $head[$h][2] = 'photos'; + $h++; + + // Attachments require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); - if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; + if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; $head[$h][2] = 'documents'; $h++; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ba179aef616..0778046c431 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3101,10 +3101,14 @@ class Product extends CommonObject */ function add_photo($sdir, $file, $maxWidth = 160, $maxHeight = 120) { + global $conf; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $result = 0; - $dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/photos"; + + $dir = $sdir; + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos"; dol_mkdir($dir); @@ -3156,8 +3160,8 @@ class Product extends CommonObject { include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; - $pdir = get_exdir($this->id,2) . $this->id ."/photos/"; - $dir = $sdir . '/'. $pdir; + $dir = $sdir; + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos"; $nbphoto=0; @@ -3199,8 +3203,19 @@ class Product extends CommonObject include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; - $pdir = get_exdir($this->id,2) . $this->id ."/photos/"; - $dir = $sdir . '/'. $pdir; + $dir = $sdir . '/'; + $pdir = '/'; + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $dir .= get_exdir($this->id,2) . $this->id ."/photos/"; + $pdir .= get_exdir($this->id,2) . $this->id ."/photos/"; + } + else + { + $dir .= $this->ref.'/'; + $pdir .= $this->ref.'/'; + } + $dirthumb = $dir.'thumbs/'; $pdirthumb = $pdir.'thumbs/'; From 9d57f5b957086e5788fd6af18b2ff570a14daceb Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 6 Feb 2015 22:55:43 +0100 Subject: [PATCH 74/83] Trad: update es_ES from Transifex --- htdocs/langs/es_ES/admin.lang | 20 +++++++++++++------- htdocs/langs/es_ES/agenda.lang | 6 +++--- htdocs/langs/es_ES/banks.lang | 1 + htdocs/langs/es_ES/bills.lang | 22 ++++++++++++++++++++-- htdocs/langs/es_ES/ecm.lang | 2 ++ htdocs/langs/es_ES/errors.lang | 2 ++ htdocs/langs/es_ES/install.lang | 2 ++ htdocs/langs/es_ES/languages.lang | 1 + htdocs/langs/es_ES/main.lang | 4 ++++ htdocs/langs/es_ES/margins.lang | 1 + 10 files changed, 49 insertions(+), 12 deletions(-) diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index e2c2f124b2e..77d1e695132 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -294,7 +294,7 @@ DoNotUseInProduction=No usar en producción ThisIsProcessToFollow=He aquí el procedimiento a seguir: StepNb=Paso %s FindPackageFromWebSite=Buscar el paquete que responde a su necesidad (por ejemplo en el sitio web %s) -DownloadPackageFromWebSite=Descargar el paquete desde el sitio %s. +DownloadPackageFromWebSite=Descargar paquete %s. UnpackPackageInDolibarrRoot=Descomprimir el paquete en el directorio raíz de Dolibarr %s sobre los archivos existentes (sin desplazar o borrar los existentes, so pena de perder su configuración o los módulos no oficiales instalados) SetupIsReadyForUse=La instalación ha finalizado y Dolibarr está disponible con el nuevo componente. NotExistsDirect=No existe el directorio alternativo.
@@ -304,6 +304,7 @@ YouCanSubmitFile=Seleccione paquete: CurrentVersion=Versión actual de Dolibarr CallUpdatePage=Llamar a la página de actualización de la estructura y datos de la base de datos %s. LastStableVersion=Última versión estable disponible +UpdateServerOffline=Actualizar servidor offline GenericMaskCodes=Puede introducir cualquier máscara numérica. En esta máscara, puede utilizar las siguientes etiquetas:
{000000} corresponde a un número que se incrementa en cada uno de %s. Introduzca tantos ceros como longitud desee mostrar. El contador se completará a partir de ceros por la izquierda con el fin de tener tantos ceros como la máscara.
{000000+000} Igual que el anterior, con una compensación correspondiente al número a la derecha del signo + se aplica a partir del primer %s.
{000000@x} igual que el anterior, pero el contador se restablece a cero cuando se llega a x meses (x entre 1 y 12). Si esta opción se utiliza y x es de 2 o superior, entonces la secuencia {yy}{mm} o {yyyy}{mm} también es necesaria.
{dd} días (01 a 31).
{mm} mes (01 a 12).
{yy}, {yyyy} ou {y} año en 2, 4 ó 1 cifra.
GenericMaskCodes2={cccc} código de cliente con n caracteres
{cccc000} código de cliente con n caracteres es seguido por un contador dedicado a clientes. Este contador dedicado a clientes se reseteará al mismo tiempo que el contador global.
{tttt} El código del tipo de empresa con n caracteres (vea diccionarios->tipos de empresa).
GenericMaskCodes3=Cualquier otro carácter en la máscara se quedará sin cambios.
No se permiten espacios
@@ -382,10 +383,12 @@ ExtrafieldSelectList = Lista desde una tabla ExtrafieldSeparator=Separador ExtrafieldCheckBox=Casilla de verificación ExtrafieldRadio=Botón de selección excluyente +ExtrafieldCheckBoxFromList= Casilla de selección de tabla ExtrafieldParamHelpselect=El listado de parámetros tiene que ser key,valor

por ejemplo:\n
1,value1
2,value2
3,value3
...

Para tener la lista en función de otra:
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=El listado de parámetros tiene que ser key,valor

por ejemplo:\n
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=El listado de parámetros tiene que ser key,valor

por ejemplo:\n
1,value1
2,value2
3,value3
... ExtrafieldParamHelpsellist=Lista Parámetros viene de una tabla
Sintaxis: nombre_tabla: etiqueta_campo: identificador_campo :: filtro
Ejemplo: c_typent: libelle: id :: filtro
filtro puede ser una prueba simple (por ejemplo, activo = 1) para mostrar el valor sólo se activa
si desea filtrar un campo extra utilizar la sintáxis extra.fieldcode = ... (donde el código de campo es el código del campo extra)
para tener la lista en función de otra:
c_typent: libelle: id: parent_list_code | parent_column: filtro +ExtrafieldParamHelpchkbxlst=Lista de parámetros viene de una tabla
Sintaxis: nombre_tabla: etiqueta_campo: identificador_campo :: filtro
Ejemplo: c_typent: libelle: id :: filtro
filtro puede ser una prueba simple (por ejemplo, activo = 1) para mostrar el valor sólo se activa
si desea filtrar un campo extra utilizar la sintáxis extra.fieldcode = ... (donde el código de campo es el código del campo extra)
para tener la lista en función de otra:
c_typent: libelle: id: parent_list_code | parent_column: filtro LibraryToBuildPDF=Librería usada para la creación de archivos PDF WarningUsingFPDF=Atención: Su archivo conf.php contiene la directiva dolibarr_pdf_force_fpdf=1. Esto hace que se use la librería FPDF para generar sus archivos PDF. Esta librería es antigua y no cubre algunas funcionalidades (Unicode, transparencia de imágenes, idiomas cirílicos, árabes o asiáticos, etc.), por lo que puede tener problemas en la generación de los PDF.
Para resolverlo, y disponer de un soporte completo de PDF, puede descargar la librería TCPDF , y a continuación comentar o eliminar la línea $dolibarr_pdf_force_fpdf=1, y añadir en su lugar $dolibarr_lib_TCPDF_PATH='ruta_a_TCPDF' LocalTaxDesc=Algunos países aplican 2 o 3 tasas a cada línea de factura. Si es el caso, escoja el tipo de la segunda y tercera tasa y su valor. Los posibles tipos son:
1 : tasa local aplicable a productos y servicios sin IVA (IVA no se aplica en la tasa local)
2 : tasa local se aplica a productos y servicios antes del IVA (IVA se calcula sobre importe+tasa local)
3 : tasa local se aplica a productos sin IVA (IVA no se aplica en la tasa local)
4 : tasa local se aplica a productos antes del IVA (IVA se calcula sobre el importe+tasa local)
5 : tasa local se aplica a servicios sin IVA (IVA no se aplica a la tasa local)
6 : tasa local se aplica a servicios antes del IVA (IVA se calcula sobre importe + tasa local) @@ -572,7 +575,7 @@ Permission67=Exportar intervenciones Permission71=Consultar miembros Permission72=Crear/modificar miembros Permission74=Eliminar miembros -Permission75=Configurar tipos y atributos de los miembros +Permission75=Configurar tipos de los miembros Permission76=Exportar miembros Permission78=Consultar cotizaciones Permission79=Crear/modificar cotizaciones @@ -596,7 +599,7 @@ Permission109=Eliminar expediciones Permission111=Consultar cuentas financieras (cuentas bancarias, cajas) Permission112=Crear/modificar cantidad/eliminar registros bancarios Permission113=Configurar cuentas financieras (crear, controlar las categorías) -Permission114=Exportar transacciones y registros bancarios +Permission114=Reconciliar transacciones Permission115=Exportar transacciones y extractos Permission116=Captar transferencias entre cuentas Permission117=Gestionar envío de cheques @@ -761,6 +764,7 @@ Permission55001=Leer encuestas Permission55002=Crear/modificar encuestas Permission59001=Leer márgenes comerciales Permission59002=Definir márgenes comerciales +Permission59003=Leer cualquier margen de usuario DictionaryCompanyType=Tipos de terceros DictionaryCompanyJuridicalType=Tipos jurídicos de terceros DictionaryProspectLevel=Perspectiva nivel cliente potencial @@ -1038,7 +1042,7 @@ SendingMailSetup=Configuración del envío por mail SendmailOptionNotComplete=Atención, en algunos sistemas Linux, con este método de envio, para poder enviar mails en su nombre, la configuración de sendmail debe contener la opción -ba (parámetro mail.force_extra_parameters en el archivo php.ini). Si algunos de sus destinatarios no reciben sus mensajes, pruebe a modificar este parámetro PHP con mail.force_extra_parameters=-ba. PathToDocuments=Rutas de acceso a documentos PathDirectory=Directorio -SendmailOptionMayHurtBuggedMTA=La funcionalidad de enviar correo electrónico a través del "correo directo PHP" genera una solicitud que puede ser mal interpretado por algunos servidores de correo. Esto se traduce en mensajes de correo electrónico ilegibles para las personas alojadas en estas plataformas. Este es el caso de clientes en ciertos proveedores de servicios de Internet (Ej: Orange). Esto no es un problema ni de Dolibarr ni de PHP, pero sí del servidor de correo. Sin embargo, puede agregar la opción MAIN_FIX_FOR_BUGGED_MTA con valor 1 en configuración-varios para tratar que Dolibarr evite el error. Otra solución (recomendada) es utilizar el método de envío por SMTP que no tiene este inconveniente. +SendmailOptionMayHurtBuggedMTA=La funcionalidad de enviar correo electrónico a través del "correo directo PHP" genera una solicitud que puede ser mal interpretado por algunos servidores de correo. Esto se traduce en mensajes de correo electrónico ilegibles para las personas alojadas en estas plataformas. Este es el caso de clientes en ciertos proveedores de servicios de Internet (Ej: Orange). Esto no es un problema ni de Dolibarr ni de PHP, pero sí del servidor de correo. Sin embargo, puede agregar la opción MAIN_FIX_FOR_BUGGED_MTA con valor 1 en configuración-varios para tratar que Dolibarr evite el error. Otra solución (recomendada) es utilizar el método de envío por SMTP que no tiene este inconveniente. TranslationSetup=Configuración traducción TranslationDesc=La elección del idioma mostrado en pantalla se modifica:
* A nivel global desde el menú Inicio - Configuración - Entorno
* De manera específica al usuario desde la pestaña Interfaz usuario de su ficha de usuario (hacer clic en su login en la parte superior izquierda de la pantalla). TotalNumberOfActivatedModules=Número total de módulos activados: %s @@ -1057,7 +1061,7 @@ BrowserIsOK=Usa el navegador web %s. Este navegador está optimizado para la seg BrowserIsKO=Usa el navegador web %s. Este navegador es una mala opción para la seguridad, rendimiento y fiabilidad. Aconsejamos utilizar Firefox, Chrome, Opera o Safari. XDebugInstalled=XDebug está cargado. XCacheInstalled=XCache está cargado -AddRefInList=Mostrar el código de cliente/proveedor en los listados (lista desplegable o autoselección) en la mayoría de enlaces +AddRefInList=Mostrar código de cliente/proveedor en los listados (y selectores) y enlaces. Los terceros aparecerán con el nombre "CC12345 - SC45678 - The big company coorp", en lugar de "The big company coorp". FieldEdition=Edición del campo %s FixTZ=Corrección de zona horaria FillThisOnlyIfRequired=Ejemplo: +2 (Complete sólo si se registra una desviación del tiempo en la exportación) @@ -1157,6 +1161,7 @@ ValidOrderAfterPropalClosed=Validar el pedido después del cierre del presupuest FreeLegalTextOnOrders=Texto libre en pedidos WatermarkOnDraftOrders=Marca de agua en pedidos borrador (en caso de estar vacío) ShippableOrderIconInList=Añadir un icono en el listado de pedidos que indica si el pedido es enviable +BANK_ASK_PAYMENT_BANK_DURING_ORDER=Preguntar por cuenta bancaria a usar en el pedido ##### Clicktodial ##### ClickToDialSetup=Configuración del módulo Click To Dial ClickToDialUrlDesc=URL de llamada haciendo click en el icono teléfono.
La URL completa de llamada será: URL?login=...&password=...&caller=...&called=telellamada @@ -1392,6 +1397,7 @@ RSSUrlExample=Un flujo RSS interesante MailingSetup=Configuración del módulo E-Mailing MailingEMailFrom=E-Mail emisor (From) de los correos enviados por E-Mailing MailingEMailError=E-Mail de respuesta (Errors-to) para las respuestas acerca de envíos por e-mailing con error. +MailingDelay=Segundos de espera después de enviar el mensaje siguiente ##### Notification ##### NotificationSetup=Configuración del módulo notificaciones NotificationEMailFrom=E-Mail emisor (From) de los correos enviados a través de notificaciones @@ -1403,7 +1409,7 @@ SendingsReceiptModel=Modelo de notas de entrega SendingsNumberingModules=Módulos de numeración de notas de entrega SendingsAbility=Uso de notas de entrega para los envíos a clientes NoNeedForDeliveryReceipts=En la mayoría de los casos, las notas de entrega (lista de productos enviados) también actúan como notas de recepción y son firmadas por el cliente. La gestión de las notas de recepción es por lo tanto redundante y rara vez se activará. -FreeLegalTextOnShippings=Mención complementaria en las notas de entrega +FreeLegalTextOnShippings=Texto libre en envíos ##### Deliveries ##### DeliveryOrderNumberingModules=Módulos de numeración de las notas de recepción DeliveryOrderModel=Modelo de notas de recepción @@ -1414,7 +1420,7 @@ AdvancedEditor=Editor avanzado ActivateFCKeditor=Activar editor avanzado para : FCKeditorForCompany=Creación/edición WYSIWIG de la descripción y notas de los terceros FCKeditorForProduct=Creación/edición WYSIWIG de la descripción y notas de los productos/servicios -FCKeditorForProductDetails=Creación/edición WYSIWIG de las líneas de detalle de los productos (en pedidos, presupuestos, facturas, etc.) +FCKeditorForProductDetails=Creación/edición WYSIWIG de las líneas de detalle de los productos (pedidos, presupuestos, facturas, etc.). Atención: El uso de esta opción no es recomendable ya que puede crear problemas con los caracteres especiales y el formateo de página al generar archivos PDF. FCKeditorForMailing= Creación/edición WYSIWIG de los E-Mails (Utilidades->E-Mailings) FCKeditorForUserSignature=Creación/edición WYSIWIG de la firma de usuarios FCKeditorForMail=Creación/edición WYSIWIG de todos los E-Mails (excepto Utilidades->E-Mailings) diff --git a/htdocs/langs/es_ES/agenda.lang b/htdocs/langs/es_ES/agenda.lang index 078045f4c14..60cdf0fb530 100644 --- a/htdocs/langs/es_ES/agenda.lang +++ b/htdocs/langs/es_ES/agenda.lang @@ -58,8 +58,8 @@ OrderSentByEMail=Pedido de cliente %s enviado por e-mail InvoiceSentByEMail=Factura a cliente %s enviada por e-mail SupplierOrderSentByEMail=Pedido a proveedor %s enviada por e-mail SupplierInvoiceSentByEMail=Factura de proveedor %s enviada por e-mail -ShippingSentByEMail=Expedición %s enviada por e-mail -ShippingValidated= Envío %s validado +ShippingSentByEMail=Expedición %s enviada por email +ShippingValidated= Expedición %s validada NewCompanyToDolibarr= Tercero creado DateActionPlannedStart= Fecha de inicio prevista DateActionPlannedEnd= Fecha de fin prevista @@ -68,7 +68,7 @@ DateActionDoneEnd= Fecha real de finalización DateActionStart= Fecha de inicio DateActionEnd= Fecha finalización AgendaUrlOptions1=Puede también añadir estos parámetros al filtro de salida: -AgendaUrlOptions2=login=%s para restringir inserciones a acciones creadas , que afecten o realizadas por el usuario %s. +AgendaUrlOptions2=login=%s para restringir inserciones a acciones creadas o asignadas al usuario %s. AgendaUrlOptions3=logina=%s para restringir inserciones a acciones creadas por el usuario %s. AgendaUrlOptions4=logint=%s para restringir inserciones a acciones que afecten al usuario %s. AgendaUrlOptionsProject=project=PROJECT_ID para restringir inserciones a acciones asociadas al proyecto PROJECT_ID. diff --git a/htdocs/langs/es_ES/banks.lang b/htdocs/langs/es_ES/banks.lang index 2c7516b555b..647e7987293 100644 --- a/htdocs/langs/es_ES/banks.lang +++ b/htdocs/langs/es_ES/banks.lang @@ -8,6 +8,7 @@ FinancialAccount=Cuenta FinancialAccounts=Cuentas BankAccount=Cuenta bancaria BankAccounts=Cuentas Bancarias +ShowAccount=Mostrar cuenta AccountRef=Ref. cuenta financiera AccountLabel=Etiqueta cuenta financiera CashAccount=Cuenta caja/efectivo diff --git a/htdocs/langs/es_ES/bills.lang b/htdocs/langs/es_ES/bills.lang index 7e4a1e1376d..782efdf26e2 100644 --- a/htdocs/langs/es_ES/bills.lang +++ b/htdocs/langs/es_ES/bills.lang @@ -2,7 +2,7 @@ Bill=Factura Bills=Facturas BillsCustomers=Facturas a clientes -BillsCustomer=Facturas al cliente +BillsCustomer=Facturas a clientes BillsSuppliers=Facturas de proveedores BillsCustomersUnpaid=Facturas a clientes pendientes de cobro BillsCustomersUnpaidForCompany=Facturas a clientes pendientes de cobro de %s @@ -348,6 +348,7 @@ ChequeNumber=Cheque nº ChequeOrTransferNumber=Cheque/Transferencia nº ChequeMaker=Emisor del cheque ChequeBank=Banco del cheque +CheckBank=Verificar NetToBePaid=Neto a pagar PhoneNumber=Tel. FullPhoneNumber=Teléfono @@ -388,7 +389,7 @@ DisabledBecausePayments=No disponible ya que existen pagos CantRemovePaymentWithOneInvoicePaid=Eliminación imposible cuando existe al menos una factura clasificada como pagada. ExpectedToPay=Esperando el pago PayedByThisPayment=Pagada por este pago -ClosePaidInvoicesAutomatically=Clasificar como "Pagadas" las facturas y facturas rectificativas completamente pagadas. +ClosePaidInvoicesAutomatically=Clasificar como "Pagadas" las facturas, facturas de situación y facturas rectificativas completamente pagadas. ClosePaidCreditNotesAutomatically=Clasificar automáticamente como "Pagados" los abonos completamente reembolsados AllCompletelyPayedInvoiceWillBeClosed=Todas las facturas con un resto a pagar 0 serán automáticamente cerradas al estado "Pagada". ToMakePayment=Pagar @@ -410,3 +411,20 @@ TypeContact_invoice_supplier_internal_SALESREPFOLL=Responsable seguimiento factu TypeContact_invoice_supplier_external_BILLING=Contacto proveedor facturación TypeContact_invoice_supplier_external_SHIPPING=Contacto proveedor entregas TypeContact_invoice_supplier_external_SERVICE=Contacto proveedor servicios +# Situation invoices +InvoiceFirstSituationAsk=Factura de primera situación +InvoiceFirstSituationDesc=Las facturas de situación están ligadas a situaciones relacionadas con una progresión, por ejemplo, la progresión de una construcción. Cada situación está ligada a una factura. +InvoiceSituation=Factura de situación +InvoiceSituationAsk=Factura de seguimiento de situación +InvoiceSituationDesc=Creación de una nueva situación que seguirá a una posición ya abierta. +SituationAmount=Importe Factura situación (Sin IVA) +SituationDeduction=Deducción situación +Progress=Progreso +ModifyAllLines=Modificar todas las líneas +CreateNextSituationInvoice=Crear próxima situación +NotLastInCycle=Esta factura no la última en el ciclo y no debe ser modificada. +DisabledBecauseNotLastInCycle=La próxima situación ya existe. +DisabledBecauseFinal=Esta situación es la última. +CantBeLessThanMinPercent=El progreso de una línea no puede ser inferior a su valor a la situación anterior. +NoSituations=Sin situaciones abiertas +InvoiceSituationLast=Factura final y general diff --git a/htdocs/langs/es_ES/ecm.lang b/htdocs/langs/es_ES/ecm.lang index 6f2cf618ff9..ea37f35c3ef 100644 --- a/htdocs/langs/es_ES/ecm.lang +++ b/htdocs/langs/es_ES/ecm.lang @@ -43,6 +43,8 @@ ECMDocsByContracts=Documentos asociados a contratos ECMDocsByInvoices=Documentos asociados a facturas ECMDocsByProducts=Documentos enlazados a productos ECMDocsByProjects=Documentos enlazados a proyectos +ECMDocsByUsers=Documentos enlazados a usuarios +ECMDocsByInterventions=Documentos enlazados a intervenciones ECMNoDirectoryYet=No se ha creado el directorio ShowECMSection=Mostrar directorio DeleteSection=Eliminación directorio diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 71715c703db..dc59e37fd03 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -91,6 +91,8 @@ ErrorModuleSetupNotComplete=La configuración del módulo parece incompleta. Vay ErrorBadMask=Error en la máscara ErrorBadMaskFailedToLocatePosOfSequence=Error, sin número de secuencia en la máscara ErrorBadMaskBadRazMonth=Error, valor de vuelta a 0 incorrecto +ErrorMaxNumberReachForThisMask=Número máximo alcanzado para esta máscara +ErrorCounterMustHaveMoreThan3Digits=El contador debe contener más de 3 dígitos ErrorSelectAtLeastOne=Error. Seleccione al menos una entrada. ErrorProductWithRefNotExist=La referencia de producto '%s' no existe ErrorDeleteNotPossibleLineIsConsolidated=Eliminación imposible ya que el registro está enlazado a una transacción bancaria conciliada diff --git a/htdocs/langs/es_ES/install.lang b/htdocs/langs/es_ES/install.lang index 2cb12467d66..a93ded0ce8e 100644 --- a/htdocs/langs/es_ES/install.lang +++ b/htdocs/langs/es_ES/install.lang @@ -155,6 +155,7 @@ MigrationFinished=Actualización terminada LastStepDesc=Último paso: Indique aquí la cuenta y la contraseña del primer usuario que usted utilizará para conectarse a la aplicación. No pierda estos identificadores, es la cuenta que permite administrar el resto. ActivateModule=Activación del módulo %s ShowEditTechnicalParameters=Pulse aquí para ver/editar los parámetros técnicos (modo experto) +WarningUpgrade=Atención:\nHa pensado en hacer una copia de seguridad de la base de datos?\nEs muy recomendable: por ejemplo, debido a algunos fallos en los sistemas de bases de datos (por ejemplo MySQL versión 5.5.40), algunos datos o tablas se pueden perder durante este proceso, por lo que es muy recomendable tener una copia completa de su base de datos antes de iniciar la migración.\n\nHaga clic en OK para iniciar el proceso de migración... ######### # upgrade @@ -206,6 +207,7 @@ MigrationProjectTaskTime=Actualización de tiempo dedicado en segundos MigrationActioncommElement=Actualización de los datos de acciones sobre elementos MigrationPaymentMode=Actualización de los modos de pago MigrationCategorieAssociation=Actualización de las categorías +MigrationEvents=Migración de eventos para agregar propietario de evento en la tabla de asignacion ShowNotAvailableOptions=Mostrar opciones no disponibles HideNotAvailableOptions=Ocultar opciones no disponibles diff --git a/htdocs/langs/es_ES/languages.lang b/htdocs/langs/es_ES/languages.lang index 88fba3e586f..db80bec8869 100644 --- a/htdocs/langs/es_ES/languages.lang +++ b/htdocs/langs/es_ES/languages.lang @@ -13,6 +13,7 @@ Language_de_AT=Alemán (Austria) Language_de_CH=Alemán (Suiza) Language_el_GR=Griego Language_en_AU=Inglés (Australia) +Language_en_CA=Inglés (Canadá) Language_en_GB=Inglés (Reino Unido) Language_en_IN=Inglés (India) Language_en_NZ=Inglés (Nueva Zelanda) diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 0f13a2540a2..67d542d8881 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -61,6 +61,7 @@ ErrorFailedToSaveFile=Error, el registro del archivo falló. SetDate=Fijar fecha SelectDate=Seleccione una fecha SeeAlso=Ver también %s +SeeHere=Vea aquí BackgroundColorByDefault=Color de fondo FileNotUploaded=No se ha subido el archivo FileUploaded=El archivo se ha subido correctamente @@ -169,6 +170,7 @@ User=Usuario Users=Usuarios Group=Grupo Groups=Grupos +NoUserGroupDefined=No hay definido grupo de usuarios Password=Contraseña PasswordRetype=Repetir contraseña NoteSomeFeaturesAreDisabled=Atención, sólo unos pocos módulos/funcionalidades han sido activados en esta demo. @@ -258,6 +260,7 @@ days=días Hours=Horas Minutes=Minutos Seconds=Segundos +Weeks=Semanas Today=Hoy Yesterday=Ayer Tomorrow=Mañana @@ -683,6 +686,7 @@ XMoreLines=%s línea(s) ocultas PublicUrl=URL pública AddBox=Añadir caja SelectElementAndClickRefresh=Seleccione un elemento y haga clic en Refrescar +PrintFile=Imprimir Archivo %s # Week day Monday=Lunes Tuesday=Martes diff --git a/htdocs/langs/es_ES/margins.lang b/htdocs/langs/es_ES/margins.lang index 2094ff8761a..7b585ad9630 100644 --- a/htdocs/langs/es_ES/margins.lang +++ b/htdocs/langs/es_ES/margins.lang @@ -16,6 +16,7 @@ MarginDetails=Detalles de márgenes realizados ProductMargins=Márgenes por producto CustomerMargins=Márgenes por cliente SalesRepresentativeMargins=Margenes por comercial +UserMargins=Márgenes del usuario ProductService=Producto o servicio AllProducts=Todos los productos y servicios ChooseProduct/Service=Elija el producto o servicio From 79ac620ab59b6956947dfe5ec7eff1ffed61ea12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 01:32:21 +0100 Subject: [PATCH 75/83] Fix label of status --- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index d738256e7d4..796aa1fa89d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -768,7 +768,7 @@ class Project extends CommonObject if ($statut == 0) return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0'); if ($statut == 1) - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut1'); + return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4'); if ($statut == 2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b4260e8ea91..d52ba362532 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -198,7 +198,7 @@ if ($resql) // Status $projectstatic->statut = $objp->fk_statut; - print '
'; + print ''; print "\n"; From 53453a63f535ac1b7ea4b676f44aeb91bb2a0602 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 01:45:09 +0100 Subject: [PATCH 76/83] Fix: pb when posting page due to apache limit --- htdocs/admin/const.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index a64e3856dbc..fc7fbc74f4d 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -230,7 +230,7 @@ $sql.= ", entity"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; if (empty($user->entity) && $debug) {} // to force for superadmin -elseif ($user->entity || empty($conf->multicompany->enabled)) $sql.= " AND visible = 1"; +else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits $sql.= " ORDER BY entity, name ASC"; dol_syslog("Const::listConstant", LOG_DEBUG); @@ -280,7 +280,6 @@ if ($result) if ($conf->use_javascript_ajax) { print ''; - print '   '; } else { From ba5d355eb3b499f5b1a66e31bf5331a0d55c2ad7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 02:14:45 +0100 Subject: [PATCH 77/83] Fix bad property --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 2fa69959e33..27f0a5fe63f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -498,7 +498,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Ref print ''; From 2f388949f63d92550dcda7421356e56a79c1ddc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Feb 2015 03:11:35 +0100 Subject: [PATCH 78/83] Make a test with jsganttimproved --- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/ganttchart.inc.php | 106 +++++++++++++++++++++---------- htdocs/projet/ganttview.php | 3 +- 3 files changed, 76 insertions(+), 34 deletions(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0f41a43c90f..1bc5b2a8c36 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -14,6 +14,7 @@ FormatDateShortJava=MM/dd/yyyy FormatDateShortJavaInput=MM/dd/yyyy FormatDateShortJQuery=mm/dd/yy FormatDateShortJQueryInput=mm/dd/yy +FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M FormatDateTextShort=%b %d, %Y diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php index 7b4249a0128..849e89ba16c 100644 --- a/htdocs/projet/ganttchart.inc.php +++ b/htdocs/projet/ganttchart.inc.php @@ -24,8 +24,7 @@ ?>
-
+
trans("ShortThursday") ?> trans("ShortFriday") ?> trans("ShortSaturday") ?>trans("ShortSunday") ?>trans("ShortSunday") ?> trans("ShortSunday") ?> trans("ShortMonday") ?> trans("ShortTuesday") ?>
 
trans("ShortMonday") ?>trans("ShortTuesday") ?>trans("ShortWednesday") ?>trans("ShortThursday") ?>trans("ShortFriday") ?>trans("ShortSaturday") ?>trans("ShortSunday") ?>trans("ShortSunday") ?>trans("ShortMonday") ?>trans("ShortTuesday") ?>trans("ShortWednesday") ?>trans("ShortThursday") ?>trans("ShortFriday") ?>trans("ShortSaturday") ?>', $langs->trans($day_names[($i + $startday) % 7]), '
', $langs->trans($day_names[($i + $startday) % 7]), 'trans("ShortMonday") ?>trans("ShortTuesday") ?>trans("ShortWednesday") ?>trans("ShortThursday") ?>trans("ShortFriday") ?>trans("ShortSaturday") ?>trans("ShortSunday") ?>trans("ShortSunday") ?>trans("ShortMonday") ?>trans("ShortTuesday") ?>trans("ShortWednesday") ?>trans("ShortThursday") ?>trans("ShortFriday") ?>trans("ShortSaturday") ?>
'; From f865534b4cdda41282891a2735a720b061474ae8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 13:43:37 +0100 Subject: [PATCH 67/83] Fix some pdf differences --- .../commande/doc/pdf_einstein.modules.php | 14 ++-- .../fichinter/doc/pdf_soleil.modules.php | 66 +++++++++++++------ htdocs/fichinter/class/fichinter.class.php | 2 +- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 510a1bd88a1..f6d28a4f135 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -154,6 +154,8 @@ class pdf_einstein extends ModelePDFCommandes $outputlangs->load("orders"); $outputlangs->load("deliveries"); + $nblignes = count($object->lines); + if ($conf->commande->dir_output) { $object->fetch_thirdparty(); @@ -195,8 +197,6 @@ class pdf_einstein extends ModelePDFCommandes global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - $nblignes = count($object->lines); - // Create pdf instance $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance @@ -328,6 +328,7 @@ class pdf_einstein extends ModelePDFCommandes //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { @@ -511,11 +512,6 @@ class pdf_einstein extends ModelePDFCommandes $pdf->Output($file,'F'); // Add pdfgeneration hook - if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; @@ -797,7 +793,7 @@ class pdf_einstein extends ModelePDFCommandes //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; + if (in_array((string) $localtax_type, array('1','3','5'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey!=0) // On affiche pas taux 0 @@ -828,7 +824,7 @@ class pdf_einstein extends ModelePDFCommandes //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; + if (in_array((string) $localtax_type, array('1','3','5'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey!=0) // On affiche pas taux 0 diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index bd6ec1b60e9..9f2bf42c98d 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -96,7 +96,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Function to build pdf onto disk * - * @param CommonObject $object Id of object to generate + * @param Object $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -106,7 +106,7 @@ class pdf_soleil extends ModelePDFFicheinter */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { - global $user,$langs,$conf,$mysoc; + global $user,$langs,$conf,$mysoc,$db,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO @@ -121,16 +121,24 @@ class pdf_soleil extends ModelePDFFicheinter { $object->fetch_thirdparty(); - $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->ficheinter->dir_output; - if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; - $file = $dir . "/" . $objectref . ".pdf"; - + // Definition of $dir and $file + if ($object->specimen) + { + $dir = $conf->ficheinter->dir_output; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->ficheinter->dir_output . "/" . $objectref; + $file = $dir . "/" . $objectref . ".pdf"; + } + if (! file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$outputlangs->trans("ErrorCanNotCreateDir",$dir); + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); return 0; } } @@ -149,6 +157,9 @@ class pdf_soleil extends ModelePDFFicheinter global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + $nblignes = count($object->lines); + + // Create pdf instance $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $heightforinfotot = 50; // Height reserved to output the info and total part @@ -196,12 +207,13 @@ class pdf_soleil extends ModelePDFFicheinter $tab_height_newpage = 150; // Affiche notes - if (! empty($object->note_public)) + $notetoshow=empty($object->note_public)?'':$object->note_public; + if ($notetoshow) { $tab_top = 88; $pdf->SetFont('','', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -252,15 +264,17 @@ class pdf_soleil extends ModelePDFFicheinter $valide = empty($objectligne->id) ? 0 : $objectligne->fetch($objectligne->id); if ($valide > 0 || $object->specimen) { - $curX = $this->posxdesc-1; $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext/*+$heightforinfotot*/); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); + // Description of product line + $curX = $this->posxdesc-1; + // Description of product line $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); if ($objectligne->duration > 0) @@ -288,6 +302,8 @@ class pdf_soleil extends ModelePDFFicheinter if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page { $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPage($pageposafter+1); } } @@ -316,33 +332,34 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; $pdf->setPage($pagenb); - $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page $pdf->AddPage(); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } } } @@ -350,13 +367,13 @@ class pdf_soleil extends ModelePDFFicheinter // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfreetext - $heightforfooter - 50, 0, $outputlangs, 0, 0); - $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfreetext - $heightforfooter - 50, 0, $outputlangs, 1, 0); - $bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforfooter + 1; + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } $this->_pagefoot($pdf,$object,$outputlangs); @@ -364,6 +381,13 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->Close(); $pdf->Output($file,'F'); + + // Add pdfgeneration hook + $hookmanager->initHooks(array('pdfgeneration')); + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + global $action; + $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 1209debde92..9748f9a4fc8 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -960,7 +960,7 @@ class Fichinter extends CommonObject $this->note_private='Private note'; $this->note_public='SPECIMEN'; $this->duree = 0; - $nbp = 20; + $nbp = 25; $xnbp = 0; while ($xnbp < $nbp) { From 6fca75c977f5ea599ffedd89179c92ff6796c2ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 13:57:05 +0100 Subject: [PATCH 68/83] Sync doc files --- INSTALL | 4 ++-- README-FR.md | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/INSTALL b/INSTALL index 56866a05d4e..584c3f04713 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ INSTALL ------- -English: See README file. +English: See README.md file. -French: Voir fichier README-FR. +French: Voir fichier README-FR.md. diff --git a/README-FR.md b/README-FR.md index aa8c3c1f5da..8d3d7f36aa9 100644 --- a/README-FR.md +++ b/README-FR.md @@ -1,21 +1,16 @@ # DOLIBARR ERP & CRM -## INTRODUCTION - Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans). Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...). ![ScreenShot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png) --------------------------------- -Documentation démarrage rapide --------------------------------- -1) Installer Dolibarr -2) Mettre à jour Dolibarr depuis une ancienne version -3) Ce qui est nouveau dans cette version -4) Ce que peux faire Dolibarr -5) Ce que ne peux pas faire Dolibarr (pas encore) + +## LICENCE + +Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure. + ## INSTALLER DOLIBARR From 4477a712d646910a082d3e019db65eb5c8b35a64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Feb 2015 14:02:36 +0100 Subject: [PATCH 69/83] Fix: calendar was not using option START_WEEK. --- htdocs/core/datepicker.php | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index 03264601624..c8ffd4bef7d 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -26,13 +26,13 @@ * \brief File to manage popup date selector */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // disabled //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); -if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language +if (! defined('NOLOGIN')) define('NOLOGIN',1); // disabled if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); @@ -188,26 +188,13 @@ function displayBox($selectedDate,$month,$year)
trans("ShortMonday") ?>trans("ShortTuesday") ?>trans("ShortWednesday") ?>trans("ShortThursday") ?>trans("ShortFriday") ?>trans("ShortSaturday") ?>trans("ShortSunday") ?>trans("ShortSunday") ?>trans("ShortMonday") ?>trans("ShortTuesday") ?>trans("ShortWednesday") ?>trans("ShortThursday") ?>trans("ShortFriday") ?>trans("ShortSaturday") ?>', $langs->trans($day_names[($i + $startday) % 7]), '
'.$langs->trans('Supplier').''; - if ($_REQUEST['socid'] > 0) + if (GETPOST('socid') > 0) { print $societe->getNomUrl(1); - print ''; + print ''; } else { - print $form->select_company((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1); + print $form->select_company(GETPOST('socid','int'),'socid','s.fournisseur = 1',1); } print '
' . $langs->trans('Project') . ''; - $formproject->select_projects($soc->id, $projectid, 'projectid'); + $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$soc->id:-1), $projectid, 'projectid'); print '
'.$projectstatic->getLibStatut(3).''.$projectstatic->getLibStatut(5).'
'; $taskstatic->id=$lines[$i]->id; - $taskstatic->ref=$lines[$i]->id; + $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); print $taskstatic->getNomUrl(1); print '