diff --git a/dev/skeletons/README.md b/dev/skeletons/README.md index 68fe9c093fb..f7346350ac0 100644 --- a/dev/skeletons/README.md +++ b/dev/skeletons/README.md @@ -1 +1 @@ -Files and tools were moved into htdocs/modulebuilder/skeletons \ No newline at end of file +Files and tools were moved into htdocs/modulebuilder/template \ No newline at end of file diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 7528fb09115..03b29abc109 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -187,9 +187,11 @@ if ($result) print ''; - print ''.img_object('',$picto).' '.$objMod->getName(); + print '' + print img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName(); print ' '; - + print ''; + $perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle)); print ''.$perm_libelle. ''; diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index a4857c94e87..e8deb15a8d2 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2006-2016 Laurent Destailleur + * Copyright (C) 2006-2017 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -145,7 +145,7 @@ if ($action == 'builddoc') // Load barcode class for generating barcode image $classname = "mod".ucfirst($generator); $module = new $classname($db); - if ($generator != 'tcpdfbarcode') + if ($generator != 'tcpdfbarcode') { // May be phpbarcode $template = 'standardlabel'; @@ -374,19 +374,25 @@ jQuery(document).ready(function() { print ' '.$langs->trans("FillBarCodeTypeAndValueManually").'   '; print '
'; -print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'   '; -print '
'; -print '
'; -$form->select_produits(GETPOST('productid'), 'productid', ''); -print '   '; -print '
'; +if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)) +{ + print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'   '; + print '
'; + print '
'; + $form->select_produits(GETPOST('productid'), 'productid', ''); + print '   '; + print '
'; +} -print ' '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'   '; -print '
'; -print '
'; -print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); -print '   '; -print '
'; +if (! empty($user->rights->societe->lire)) +{ + print ' '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'   '; + print '
'; + print '
'; + print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); + print '   '; + print '
'; +} print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2b0dd2f2924..608f5614cd8 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2917,7 +2917,7 @@ class ContratLigne extends CommonObjectLine // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet"; - $sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx,"; + $sql.= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,"; $sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice,"; $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc,"; $sql.= " info_bits,"; diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index e606e6570f3..761fb6013b8 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -53,7 +53,7 @@ class box_produits extends ModeleBoxes */ function loadBox($max=5) { - global $user, $langs, $db, $conf; + global $user, $langs, $db, $conf, $hookmanager; $this->max=$max; @@ -69,6 +69,13 @@ class box_produits extends ModeleBoxes $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; + // Add where from hooks + if (is_object($hookmanager)) + { + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; + } $sql.= $db->order('p.datec', 'DESC'); $sql.= $db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 55e70f62f96..69652fde11e 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -55,7 +55,7 @@ class box_produits_alerte_stock extends ModeleBoxes */ function loadBox($max=5) { - global $user, $langs, $db, $conf; + global $user, $langs, $db, $conf, $hookmanager; $this->max=$max; @@ -74,7 +74,14 @@ class box_produits_alerte_stock extends ModeleBoxes $sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0"; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; - $sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity"; + // Add where from hooks + if (is_object($hookmanager)) + { + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; + } + $sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity"; $sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte"; $sql.= $db->order('p.seuil_stock_alerte', 'DESC'); $sql.= $db->plimit($max, 0); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b65ab35527e..3ac7cb6ffb3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1292,7 +1292,7 @@ abstract class CommonObject /** * Load properties id_previous and id_next * - * @param string $filter Optional filter + * @param string $filter Optional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')" * @param int $fieldid Name of field to use for the select MAX and MIN * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK @@ -1318,11 +1318,15 @@ abstract class CommonObject if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; - if (! empty($filter)) $sql.=" AND ".$filter; + if (! empty($filter)) + { + if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility + $sql.=$filter; + } if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')'; - //print $sql."
"; + //print $filter.' '.$sql."
"; $result = $this->db->query($sql); if (! $result) { @@ -1339,7 +1343,11 @@ abstract class CommonObject if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id; - if (! empty($filter)) $sql.=" AND ".$filter; + if (! empty($filter)) + { + if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility + $sql.=$filter; + } if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')'; // Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 8faea875ab5..31833c113b4 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -122,7 +122,7 @@ class HookManager * All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller. * $this->error or this->errors are also defined by class called by this function if error. */ - function executeHooks($method, $parameters=false, &$object='', &$action='') + function executeHooks($method, $parameters=array(), &$object='', &$action='') { if (! is_array($this->hooks) || empty($this->hooks)) return ''; @@ -238,7 +238,7 @@ class HookManager // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) else { - // TODO. this should be done into the method of hook by returning nothing + // TODO. this test should be done into the method of hook by returning nothing if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; //dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG); @@ -246,7 +246,7 @@ class HookManager if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; - // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string + // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string if (! is_array($resaction) && ! is_numeric($resaction)) { dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7a69172889e..ac17e1d9e17 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5829,7 +5829,7 @@ class Form /** * Return a HTML area with the reference of object and a navigation bar for a business object - * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. + * Note: To add a particular filter on select, you can have $object->next_prev_filter set to add SQL criterias. * * @param object $object Object to show. * @param string $paramid Name of parameter to use to name the id into the URL next/previous link. @@ -5847,12 +5847,20 @@ class Form */ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') { - global $langs,$conf; + global $langs,$conf,$hookmanager; $ret=''; if (empty($fieldid)) $fieldid='rowid'; if (empty($fieldref)) $fieldref='ref'; + // Add where from hooks + if (is_object($hookmanager)) + { + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters, $object); // Note that $action and $object may have been modified by hook + $object->next_prev_filter.=$hookmanager->resPrint; + } + //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 92cb35e02f5..7d3cfac1c41 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1117,7 +1117,8 @@ function dol_get_fiche_end($notab=0) } /** - * Show tab footer of a card + * Show tab footer of a card. + * Note: $object->next_prev_filter can be set to restrict select to find next or previous record by $form->showrefnav. * * @param object $object Object to show * @param string $paramid Name of parameter to use to name the id into the URL next/previous link diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 606274cd30e..dfb02142280 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria * Copyright (C) 2016-2017 Ferran Marcet - * Copyright (C) 2017 Gustavo Novaro + * Copyright (C) 2017 Gustavo Novaro * * 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 @@ -67,7 +67,7 @@ class Product extends CommonObject * @var string */ public $label; - + /** * Product descripion * @var string @@ -79,37 +79,37 @@ class Product extends CommonObject * @var int */ public $type = self::TYPE_PRODUCT; - + /** * Selling price * @var float */ public $price; // Price net - + /** * Price with tax * @var float */ public $price_ttc; - + /** * Minimum price net * @var float */ public $price_min; - + /** * Minimum price with tax * @var float */ public $price_min_ttc; - + /* * Base price ('TTC' for price including tax or 'HT' for net price) * @var float */ public $price_base_type; - + //! Arrays for multiprices public $multiprices=array(); public $multiprices_ttc=array(); @@ -118,88 +118,88 @@ class Product extends CommonObject public $multiprices_min_ttc=array(); public $multiprices_tva_tx=array(); public $multiprices_recuperableonly=array(); - + //! Price by quantity arrays public $price_by_qty; public $prices_by_qty=array(); public $prices_by_qty_id=array(); public $prices_by_qty_list=array(); - + //! Default VAT code for product (link to code into llx_c_tva but without foreign keys) public $default_vat_code; - + //! Default VAT rate of product public $tva_tx; - + //! French VAT NPR (0 or 1) public $tva_npr=0; - + //! Other local taxes public $localtax1_tx; public $localtax2_tx; public $localtax1_type; public $localtax2_type; - + /** * Stock real * @var int */ public $stock_reel = 0; - + /** * Stock virtual * @var int */ public $stock_theorique; - + /** * Cost price * @var float */ public $cost_price; - + //! Average price value for product entry into stock (PMP) public $pmp; - + /** * Stock alert * @var int */ public $seuil_stock_alerte; - + /** * Ask for replenishment when $desiredstock < $stock_reel */ public $desiredstock; - + /* * Service expiration */ public $duration_value; - + /** * Exoiration unit */ public $duration_unit; - + /** * Status indicates whether the product is on sale '1' or not '0' * @var int */ public $status; - + /** * Status indicate whether the product is available for purchase '1' or not '0' * @var int */ public $status_buy; - + /** * Status indicates whether the product is a finished product '1' or a raw material '0' * @var int */ public $finished; - + /** * We must manage lot/batch number, sell-by date and so on : '1':yes '0':no * @var int @@ -234,10 +234,10 @@ class Product extends CommonObject /** * Main barcode * barcode value - * @var + * @var */ public $barcode; - + /** * Additional barcodes (Some products have different barcodes according to the country of origin of manufacture) * @var array @@ -282,7 +282,7 @@ class Product extends CommonObject public $fourn_pu; public $fourn_price_base_type; - + /** * @deprecated * @see ref_supplier @@ -302,7 +302,7 @@ class Product extends CommonObject */ public $price_autogen = 0; - + /** * Regular product */ @@ -320,7 +320,7 @@ class Product extends CommonObject */ const TYPE_STOCKKIT = 3; - + /** * Constructor * @@ -394,7 +394,7 @@ class Product extends CommonObject if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; if (empty($this->localtax1_type)) $this->localtax1_type = '0'; if (empty($this->localtax2_type)) $this->localtax2_type = '0'; - + if (empty($this->price)) $this->price = 0; if (empty($this->price_min)) $this->price_min = 0; @@ -408,28 +408,28 @@ class Product extends CommonObject $price_ttc=0; $price_min_ht=0; $price_min_ttc=0; - + // if ($this->price_base_type == 'TTC' && $this->price_ttc > 0) { $price_ttc = price2num($this->price_ttc,'MU'); $price_ht = price2num($this->price_ttc / (1 + ($this->tva_tx / 100)),'MU'); } - + // if ($this->price_base_type != 'TTC' && $this->price > 0) { $price_ht = price2num($this->price,'MU'); $price_ttc = price2num($this->price * (1 + ($this->tva_tx / 100)),'MU'); } - + // if (($this->price_min_ttc > 0) && ($this->price_base_type == 'TTC')) { $price_min_ttc = price2num($this->price_min_ttc,'MU'); $price_min_ht = price2num($this->price_min_ttc / (1 + ($this->tva_tx / 100)),'MU'); } - + // if (($this->price_min > 0) && ($this->price_base_type != 'TTC')) { @@ -449,7 +449,7 @@ class Product extends CommonObject $this->error='ErrorMandatoryParametersNotProvided'; return -1; } - + if (empty($this->ref)) { // Load object modCodeProduct @@ -468,7 +468,7 @@ class Product extends CommonObject } unset($modCodeProduct); } - + if (empty($this->ref)) { $this->error='ProductModuleNotSetupForAutoRef'; @@ -752,7 +752,7 @@ class Product extends CommonObject $this->volume = $this->surface * $this->height; $this->volume_units = $this->surface_units + $this->height_units; } - + $this->surface = price2num($this->surface); $this->surface_units = trim($this->surface_units); $this->volume = price2num($this->volume); @@ -792,7 +792,7 @@ class Product extends CommonObject $org->fetch($this->id); $this->oldcopy=$org; } - + // Test if batch management is activated on existing product // If yes, we create missing entries into product_batch if ($this->hasbatch() && !$this->oldcopy->hasbatch()) @@ -808,7 +808,7 @@ class Product extends CommonObject $qty_batch = 0; foreach ($ObjW->detail_batch as $detail) // Each lines of detail in product_batch of the current $ObjW = product_stock { - if ($detail->batch == $valueforundefinedlot || $detail->batch == 'Undefined') + if ($detail->batch == $valueforundefinedlot || $detail->batch == 'Undefined') { // We discard this line, we will create it later $sqlclean="DELETE FROM ".MAIN_DB_PREFIX."product_batch WHERE batch in('Undefined', '".$valueforundefinedlot."') AND fk_product_stock = ".$ObjW->id; @@ -820,7 +820,7 @@ class Product extends CommonObject } continue; } - + $qty_batch += $detail->qty; } // Quantities in batch details are not same as stock quantity, @@ -828,7 +828,7 @@ class Product extends CommonObject if ($ObjW->real <> $qty_batch) { $ObjBatch = new Productbatch($this->db); - $ObjBatch->batch = $valueforundefinedlot; + $ObjBatch->batch = $valueforundefinedlot; $ObjBatch->qty = ($ObjW->real - $qty_batch); $ObjBatch->fk_product_stock = $ObjW->id; @@ -855,7 +855,7 @@ class Product extends CommonObject $sql.= ", localtax2_tx = " . $this->localtax2_tx; $sql.= ", localtax1_type = " . ($this->localtax1_type!=''?"'".$this->localtax1_type."'":"'0'"); $sql.= ", localtax2_type = " . ($this->localtax2_type!=''?"'".$this->localtax2_type."'":"'0'"); - + $sql.= ", barcode = ". (empty($this->barcode)?"null":"'".$this->db->escape($this->barcode)."'"); $sql.= ", fk_barcode_type = ". (empty($this->barcode_type)?"null":$this->db->escape($this->barcode_type)); @@ -1056,8 +1056,8 @@ class Product extends CommonObject if ($result < 0) { $error++; } // End call triggers } - - // Delete from product_batch on product delete + + // Delete from product_batch on product delete if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch'; @@ -1072,7 +1072,7 @@ class Product extends CommonObject $this->errors[] = $this->db->lasterror(); } } - + // Delete all child tables if (! $error) { @@ -1190,7 +1190,7 @@ class Product extends CommonObject function setMultiLangs($user) { global $conf, $langs; - + $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2); $current_lang = $langs->getDefaultLang(); @@ -1509,7 +1509,7 @@ class Product extends CommonObject $sql.= " WHERE pfp.rowid = ".$prodfournprice; if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; $sql.= " ORDER BY pfp.quantity DESC"; - + dol_syslog(get_class($this)."::get_buyprice first search by prodfournprice/qty", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1641,7 +1641,7 @@ class Product extends CommonObject // If multiprices are enabled, then we check if the current product is subject to price autogeneration // Price will be modified ONLY when the first one is the one that is being modified - if (!empty($conf->global->PRODUIT_MULTIPRICES) && !$ignore_autogen && $this->price_autogen && ($level == 1)) + if (!empty($conf->global->PRODUIT_MULTIPRICES) && !$ignore_autogen && $this->price_autogen && ($level == 1)) { return $this->generateMultiprices($user, $newprice, $newpricebase, $newvat, $newnpr, $newpsq); } @@ -1709,7 +1709,7 @@ class Product extends CommonObject } if (empty($localtax1)) $localtax1=0; // If = '' then = 0 if (empty($localtax2)) $localtax2=0; // If = '' then = 0 - + $this->db->begin(); // Ne pas mettre de quote sur les numeriques decimaux. @@ -1755,7 +1755,7 @@ class Product extends CommonObject $this->localtax2_tx = $localtax2; $this->localtax1_type = $localtaxtype1; $this->localtax2_type = $localtaxtype2; - + // Price by quantity $this->price_by_qty = $newpsq; @@ -1857,7 +1857,7 @@ class Product extends CommonObject $this->url = $obj->url; $this->note_private = $obj->note_private; $this->note = $obj->note_private; // deprecated - + $this->type = $obj->fk_product_type; $this->status = $obj->tosell; $this->status_buy = $obj->tobuy; @@ -1881,7 +1881,7 @@ class Product extends CommonObject $this->localtax2_tx = $obj->localtax2_tx; $this->localtax1_type = $obj->localtax1_type; $this->localtax2_type = $obj->localtax2_type; - + $this->finished = $obj->finished; $this->duration = $obj->duration; $this->duration_value = substr($obj->duration,0,dol_strlen($obj->duration)-1); @@ -1933,7 +1933,7 @@ class Product extends CommonObject // multilangs if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); - + // Load multiprices array if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -2166,29 +2166,29 @@ class Product extends CommonObject $this->stats_commande['rows']=$obj->nb_rows; $this->stats_commande['qty']=$obj->qty?$obj->qty:0; - // if it's a virtual product, maybe it is in order by extension + // if it's a virtual product, maybe it is in order by extension if (! empty($conf->global->ORDER_ADD_ORDERS_WITH_PARENT_PROD_IF_INCDEC)) - { + { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach($TFather as &$fatherData) { $pFather = new Product($this->db); - $pFather->id = $fatherData['id']; + $pFather->id = $fatherData['id']; $qtyCoef = $fatherData['qty']; - + if ($fatherData['incdec']) { $pFather->load_stats_commande($socid, $filtrestatut); - + $this->stats_commande['customers']+=$pFather->stats_commande['customers']; $this->stats_commande['nb']+=$pFather->stats_commande['nb']; $this->stats_commande['rows']+=$pFather->stats_commande['rows']; $this->stats_commande['qty']+=$pFather->stats_commande['qty'] * $qtyCoef; - + } } } } - + return 1; } else @@ -2483,7 +2483,7 @@ class Product extends CommonObject return -1; } - if (empty($year)) + if (empty($year)) { $year = strftime('%Y',time()); $month = strftime('%m',time()); @@ -2607,7 +2607,7 @@ class Product extends CommonObject $sql = "SELECT sum(d.qty), date_format(p.datep, '%Y%m')"; if ($mode == 'bynumber') $sql.= ", count(DISTINCT p.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as prod"; + if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as prod"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.rowid = d.fk_propal"; if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id; @@ -2642,7 +2642,7 @@ class Product extends CommonObject $sql = "SELECT sum(d.qty), date_format(p.date_valid, '%Y%m')"; if ($mode == 'bynumber') $sql.= ", count(DISTINCT p.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposaldet as d, ".MAIN_DB_PREFIX."supplier_proposal as p, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as prod"; + if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as prod"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.rowid = d.fk_supplier_proposal"; if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id; @@ -2658,7 +2658,7 @@ class Product extends CommonObject return $this->_get_stats($sql,$mode, $year); } - + /** * Return nb of units or orders in which product is included * @@ -2710,7 +2710,7 @@ class Product extends CommonObject $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; if ($mode == 'bynumber') $sql.= ", count(DISTINCT c.rowid)"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as d, ".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."societe as s"; - if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as p"; + if ($filteronproducttype >= 0) $sql.=", ".MAIN_DB_PREFIX."product as p"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.rowid = d.fk_commande"; if ($this->id > 0) $sql.= " AND d.fk_product =".$this->id; @@ -2900,7 +2900,7 @@ class Product extends CommonObject $now=dol_now(); dol_syslog(get_class($this)."::add_fournisseur id_fourn = ".$id_fourn." ref_fourn=".$ref_fourn." quantity=".$quantity, LOG_DEBUG); - + if ($ref_fourn) { $sql = "SELECT rowid, fk_product"; @@ -3289,7 +3289,7 @@ class Product extends CommonObject function getChildsArbo($id, $firstlevelonly=0, $level=1) { global $alreadyfound; - + $sql = "SELECT p.rowid, p.label as label, pa.qty as qty, pa.fk_product_fils as id, p.fk_product_type, pa.incdec"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ", ".MAIN_DB_PREFIX."product_association as pa"; @@ -3298,18 +3298,18 @@ class Product extends CommonObject $sql.= " AND pa.fk_product_fils != ".$id; // This should not happens, it is to avoid infinite loop if it happens dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level, LOG_DEBUG); - + if ($level == 1) $alreadyfound=array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly // Protection against infinite loop if ($level > 30) return array(); - + $res = $this->db->query($sql); if ($res) { $prods = array(); while ($rec = $this->db->fetch_array($res)) { - if (! empty($alreadyfound[$rec['rowid']])) + if (! empty($alreadyfound[$rec['rowid']])) { dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING); continue; @@ -3379,7 +3379,7 @@ class Product extends CommonObject $result=''; $newref=$this->ref; if ($maxlength) $newref=dol_trunc($newref,$maxlength,'middle'); - + if ($this->type == Product::TYPE_PRODUCT) $label = '' . $langs->trans("ShowProduct") . ''; if ($this->type == Product::TYPE_SERVICE) $label = '' . $langs->trans("ShowService") . ''; if (! empty($this->ref)) @@ -3402,13 +3402,13 @@ class Product extends CommonObject { // } - if (! empty($this->entity)) + if (! empty($this->entity)) { $tmpphoto = $this->show_photos($conf->product->multidir_output[$this->entity],1,1,0,0,0,80); - if ($this->nbphoto > 0) $label .= '
' . $tmpphoto; + if ($this->nbphoto > 0) $label .= '
' . $tmpphoto; } - + $linkclose=''; if (empty($notooltip)) { @@ -3420,7 +3420,7 @@ class Product extends CommonObject $linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; $linkclose.=' class="classfortooltip"'; - + if (! is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; @@ -3445,7 +3445,7 @@ class Product extends CommonObject $linkstart = ''; $linkend=''; - + if ($withpicto) { if ($this->type == Product::TYPE_PRODUCT) $result.=($linkstart.img_object(($notooltip?'':$label), 'product', ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' '); if ($this->type == Product::TYPE_SERVICE) $result.=($linkstart.img_object(($notooltip?'':$label), 'service', ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend.' '); @@ -3523,7 +3523,7 @@ class Product extends CommonObject function LibStatut($status,$mode=0,$type=0) { global $conf, $langs; - + $langs->load('products'); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); @@ -3630,7 +3630,7 @@ class Product extends CommonObject $this->db->begin(); require_once DOL_DOCUMENT_ROOT .'/product/stock/class/mouvementstock.class.php'; - + $op[0] = "+".trim($nbpiece); $op[1] = "-".trim($nbpiece); @@ -3704,14 +3704,14 @@ class Product extends CommonObject /** * Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) - * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. + * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. * If ENTREPOT_EXTRA_STATUS set, filtering on warehouse status possible. * - * @param string $option '' = Load all stock info, also from closed and internal warehouses, - * 'nobatch' = Do not load batch information, + * @param string $option '' = Load all stock info, also from closed and internal warehouses, + * 'nobatch' = Do not load batch information, * 'novirtual' = Do not load virtual stock, * 'warehouseopen' = Load stock from open warehouses only, - * 'warehouseclosed' = Load stock from closed warehouses only, + * 'warehouseclosed' = Load stock from closed warehouses only, * 'warehouseinternal' = Load stock from warehouses for internal correction/transfer only * @return int < 0 if KO, > 0 if OK * @see load_virtual_stock, getBatchInfo @@ -3719,26 +3719,26 @@ class Product extends CommonObject function load_stock($option='') { global $conf; - + $this->stock_reel = 0; $this->stock_warehouse = array(); $this->stock_theorique = 0; $warehouseStatus = array(); - if (preg_match('/warehouseclosed/', $option)) + if (preg_match('/warehouseclosed/', $option)) { $warehouseStatus[] = Entrepot::STATUS_CLOSED; } - if (preg_match('/warehouseopen/', $option)) + if (preg_match('/warehouseopen/', $option)) { $warehouseStatus[] = Entrepot::STATUS_OPEN_ALL; } - if (preg_match('/warehouseinternal/', $option)) + if (preg_match('/warehouseinternal/', $option)) { $warehouseStatus[] = Entrepot::STATUS_OPEN_INTERNAL; } - + $sql = "SELECT ps.rowid, ps.reel, ps.fk_entrepot"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."entrepot as w"; @@ -3768,7 +3768,7 @@ class Product extends CommonObject } $this->db->free($result); - if (! preg_match('/novirtual/', $option)) + if (! preg_match('/novirtual/', $option)) { $this->load_virtual_stock(); // This also load stats_commande_fournisseur, ... } @@ -3784,7 +3784,7 @@ class Product extends CommonObject /** * Load value ->stock_theorique of a product. Property this->id must be defined. - * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. + * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. * * @return int < 0 if KO, > 0 if OK * @see load_stock, getBatchInfo @@ -3932,7 +3932,7 @@ class Product extends CommonObject { include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; - + global $conf; $dir = $sdir; @@ -3982,7 +3982,7 @@ class Product extends CommonObject $sortfield='position_name'; $sortorder='asc'; - + $dir = $sdir . '/'; $pdir = '/'; $dir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/'; @@ -4002,7 +4002,7 @@ class Product extends CommonObject $relativedir = preg_replace('/^[\\/]/','',$relativedir); $relativedir = preg_replace('/[\\/]$/','',$relativedir); } - + $dirthumb = $dir.'thumbs/'; $pdirthumb = $pdir.'thumbs/'; @@ -4010,7 +4010,7 @@ class Product extends CommonObject $nbphoto=0; $filearray=dol_dir_list($dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); - + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs { $filearrayold=dol_dir_list($dirold,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); @@ -4018,10 +4018,10 @@ class Product extends CommonObject } $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); - + //var_dump($filearray); //var_dump($filearrayindatabase); - + // Complete filearray with properties found into $filearrayindatabase foreach($filearray as $key => $val) { @@ -4042,19 +4042,19 @@ class Product extends CommonObject } } } - + if (count($filearray)) { if ($sortfield && $sortorder) { $filearray=dol_sort_array($filearray, $sortfield, $sortorder); } - + foreach($filearray as $key => $val) { $photo=''; $file = $val['name']; - + //if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory //if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) @@ -4069,7 +4069,7 @@ class Product extends CommonObject // Find name of thumb file $photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small')); if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette=''; - + // Get filesize of original file $imgarray=dol_getImageSize($dir.$photo); @@ -4083,9 +4083,9 @@ class Product extends CommonObject else if ($nbbyrow < 0) $return .= '
'; $return.= "\n"; - + $relativefile=preg_replace('/^\//', '', $pdir.$photo); - if (empty($nolink)) + if (empty($nolink)) { $urladvanced=getAdvancedPreviewUrl('product', $relativefile, 0, 'entity='.$this->entity); if ($urladvanced) $return.=''; @@ -4096,7 +4096,7 @@ class Product extends CommonObject // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine $alt=$langs->transnoentitiesnoconv('File').': '.$relativefile; $alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height']; - + if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { $return.= ''; @@ -4195,7 +4195,7 @@ class Product extends CommonObject { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - + $nbphoto=0; $tabobj=array(); @@ -4249,7 +4249,7 @@ class Product extends CommonObject { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - + $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine $dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette $filename = preg_replace('/'.preg_quote($dir,'/').'/i','',$file); // Nom du fichier @@ -4295,14 +4295,21 @@ class Product extends CommonObject */ function load_state_board() { - global $conf, $user; + global $conf, $user, $hookmanager; $this->nb=array(); $sql = "SELECT count(p.rowid) as nb, fk_product_type"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity($this->element, 1).')'; - $sql.= ' GROUP BY fk_product_type'; + // Add where from hooks + if (is_object($hookmanager)) + { + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook + $sql.=$hookmanager->resPrint; + } + $sql.= ' GROUP BY fk_product_type'; $resql=$this->db->query($sql); if ($resql) @@ -4401,7 +4408,7 @@ class Product extends CommonObject $this->note='This is a comment (private)'; $this->date_creation = $now; $this->date_modification = $now; - + $this->weight = 4; $this->weight_unit = 1; @@ -4411,12 +4418,12 @@ class Product extends CommonObject $this->width_unit = 0; $this->height = null; $this->height_unit = null; - + $this->surface = 30; $this->surface_unit = 0; $this->volume = 300; $this->volume_unit = 0; - + $this->barcode=-1; // Create barcode automatically } @@ -4647,7 +4654,7 @@ class Product extends CommonObject return $user->rights->service; } } - + /** * Load information for tab info * @@ -4695,5 +4702,5 @@ class Product extends CommonObject dol_print_error($this->db); } } - + } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index a09a8069b9e..9eca57faf43 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -42,6 +42,9 @@ else $result=restrictedArea($user,'produit|service'); $langs->load("products"); $langs->load("stocks"); +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks +$hookmanager->initHooks(array('productindex')); + $product_static = new Product($db); @@ -106,7 +109,6 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele } } - /* * Number of products and/or services */ @@ -117,6 +119,10 @@ $prodser[1][0]=$prodser[1][1]=$prodser[1][2]=$prodser[1][3]=0; $sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy"; $result = $db->query($sql); while ($objp = $db->fetch_object($result)) @@ -254,6 +260,10 @@ $sql.= " p.tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE p.entity IN (".getEntity($product_static->element, 1).")"; if ($type != '') $sql.= " AND p.fk_product_type = ".$type; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= $db->order("p.tms","DESC"); $sql.= $db->plimit($max,0); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 4cd986de291..65094981ef2 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -93,7 +93,7 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'productser if ((string) $type == '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; } if ((string) $type == '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; } -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); $form=new Form($db); @@ -174,7 +174,7 @@ $arrayfields=array( 'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000), - 'p.tobuy'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Purchases").')', 'checked'=>1, 'position'=>1000) + 'p.tobuy'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Buy").')', 'checked'=>1, 'position'=>1000) ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -664,8 +664,8 @@ else print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 21b191f92cc..a2cab708281 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -91,7 +91,7 @@ $extrafields = new ExtraFields($db); function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='') { global $user, $conf, $langs, $mysoc; - + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers print ''; @@ -301,32 +301,43 @@ if ($action == 'add') { if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') { - $urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; + $urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email')); } else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { - $urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; + $urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email')); - if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) + if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) { - $urlback.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2); + if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) + { + $urlback.='&securekey='.urlencode(dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2)); + } + else + { + $urlback.='&securekey='.urlencode($conf->global->PAYPAL_SECURITY_TOKEN); + } } - } else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') { $urlback=DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email')); - /* - if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) + if (! empty($conf->global->STRIPE_SECURITY_TOKEN)) { - $urlback.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2); + if (! empty($conf->global->STRIPE_SECURITY_TOKEN_UNIQUE)) + { + $urlback.='&securekey='.urlencode(dol_hash($conf->global->STRIPE_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2)); + } + else + { + $urlback.='&securekey='.urlencode($conf->global->STRIPE_SECURITY_TOKEN); + } } - */ } else { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f3e7df31609..9ba91c33475 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1086,6 +1086,9 @@ div.nopadding { margin-: 8px; margin-bottom: 4px; } +.pictoobjectwidth { + width: 14px; +} .pictosubstatus { padding-left: 2px; padding-right: 2px; @@ -2811,6 +2814,9 @@ div.tabBar .noborder { float: left; padding-left: 5px; } + .boxstats { + width: 100px; + } } .boxstats:hover { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 49a8745f61e..a1d26705d46 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -48,7 +48,7 @@ $colorbacklineimpair2='255,255,255'; // line impair $colorbacklinepair1='250,250,250'; // line pair $colorbacklinepair2='248,248,248'; // line pair $colorbacklinepairhover='244,244,244'; // line pair -$colorbackbody='240,240,240'; +$colorbackbody='248,248,248'; $colortexttitlenotab='90,90,90'; $colortexttitle='20,20,20'; $colortext='0,0,0'; @@ -1121,6 +1121,9 @@ table.noborder tr.liste_titre td { margin-: 8px; margin-bottom: 4px; } +.pictoobjectwidth { + width: 14px; +} .pictosubstatus { padding-left: 2px; padding-right: 2px; @@ -2894,6 +2897,9 @@ div .tdtop { float: left; padding-left: 5px; } + .boxstats { + width: 100px; + } } .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 5de1a3b80ac..041213fbe64 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -315,7 +315,7 @@ if ($result) { // On affiche ligne pour modifier droits print ''; - print ''.img_object('',$picto).' '.$objMod->getName(); + print ''.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName(); print ''; print ''; print 'module.'">'.$langs->trans("All").""; @@ -330,7 +330,7 @@ if ($result) print ''; // Picto and label of permission - print ''.img_object('',$picto).' '.$objMod->getName().''; + print ''.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName().''; // Permission and tick if (! empty($object->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin