diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7cd094b32df..f48c0538c34 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -518,8 +518,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $ok=1; foreach ($listfield as $f => $value) { - if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes'))) continue; // For some pages, country is not mandatory - if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory + if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory + if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'color' && empty($_POST['color'])) continue; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 84c5ecb92e4..fe20d868e83 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -292,6 +292,7 @@ $var=!$var; $this->NbRepeat = $tabConf[4]; $this->WithoutAmbi = $tabConf[5]; */ + print '
'; print ''; print ''; print ''; @@ -332,13 +333,17 @@ $var=!$var; print '"; print ''; print ''; - - $var=!$var; - print ""; - print ''; - print ''; + print '
'.$langs->trans("PasswordPatternDesc").'' . $langs->trans("NoAmbiCaracAutoGeneration")." '.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'
'.$langs->trans("Save").'
'; + print '
'; + print ''; + print ''; + print '
'; + print ''.$langs->trans("Save").''; + print '
'; + print '

'; + print ''."\n"; + print ''."\n"; } // jQuery jMobile if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 07d4a75a522..3f2893ffcfb 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -162,7 +162,7 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ""; print ''; -$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref,"; +$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"; if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " sum(d.total_ht) as selling_price,"; @@ -264,6 +264,7 @@ if ($result) $product_static->id=$objp->rowid; $product_static->ref=$objp->ref; $product_static->label=$objp->label; + $product_static->entity=$objp->pentity; $text=$product_static->getNomUrl(1); print $text.= ' - '.$objp->label; print "\n"; diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index aba6325d234..e32d31122dc 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -341,7 +341,7 @@ class ActionsCardProduct $sql = 'SELECT DISTINCT '; // Fields requiered - $sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte'; + $sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte, p.entity'; // Fields not requiered foreach($this->field_list as $field) @@ -417,6 +417,7 @@ class ActionsCardProduct $this->id = $obj->rowid; $this->ref = $obj->$alias; $this->type = $obj->fk_product_type; + $this->entity = $obj->entity; $datas[$alias] = $this->getNomUrl(1,'',24); } else if ($alias == 'stock') diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6f4e37c8ab2..4253d2c0e48 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2768,7 +2768,8 @@ class Product extends CommonObject 'type'=>$type, // Nb of units that compose parent product 'desiredstock'=>$this->desiredstock, 'level'=>$level, - 'incdec'=>$incdec + 'incdec'=>$incdec, + 'entity'=>$this->entity ); // Recursive call if there is childs to child @@ -2850,7 +2851,7 @@ class Product extends CommonObject */ function getFather() { - $sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec"; + $sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec, p.entity"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,"; $sql.= " ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE p.rowid = pa.fk_product_pere"; @@ -2868,6 +2869,7 @@ class Product extends CommonObject $prods[$record['id']]['qty'] = $record['qty']; $prods[$record['id']]['incdec'] = $record['incdec']; $prods[$record['id']]['fk_product_type'] = $record['fk_product_type']; + $prods[$record['id']]['entity'] = $record['entity']; } return $prods; } @@ -3409,7 +3411,7 @@ class Product extends CommonObject $dir = $sdir; if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos"; - else $dir .= '/'.dol_sanitizeFileName($this->ref); + else $dir .= '/'.get_exdir(0,0,0,0,$this,'product').dol_sanitizeFileName($this->ref); dol_mkdir($dir); @@ -3447,7 +3449,7 @@ class Product extends CommonObject $dir = $sdir; if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/"; - else $dir .= '/'.dol_sanitizeFileName($this->ref).'/'; + else $dir .= '/'.get_exdir(0,0,0,0,$this,'product').dol_sanitizeFileName($this->ref).'/'; $nbphoto=0; @@ -3498,8 +3500,8 @@ class Product extends CommonObject } else { - $dir .= $this->ref.'/'; - $pdir .= $this->ref.'/'; + $dir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/'; + $pdir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/'; } $dirthumb = $dir.'thumbs/'; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 96e4c955cd6..71742f261cf 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -139,7 +139,7 @@ if ($action == 'search') { $current_lang = $langs->getDefaultLang(); - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; + $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem'; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; @@ -278,6 +278,7 @@ if ($id > 0 || ! empty($ref)) $productstatic->type=$value["fk_product_type"]; $productstatic->ref=$value['ref']; $productstatic->label=$value['label']; + $productstatic->entity=$value['entity']; $class=($class=='impair')?'pair':'impair'; print ''; @@ -334,6 +335,7 @@ if ($id > 0 || ! empty($ref)) $productstatic->id=$value['id']; $productstatic->type=$value['type']; $productstatic->label=$value['label']; + $productstatic->entity=$value['entity']; if ($value['level'] <= 1) { @@ -542,6 +544,7 @@ if ($id > 0 || ! empty($ref)) $productstatic->ref=$objp->ref; $productstatic->label=$objp->label; $productstatic->type=$objp->type; + $productstatic->entity=$objp->entity; print ''.$productstatic->getNomUrl(1,'',24).''; $labeltoshow=$objp->label; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index cb174e5847e..ea16a13582c 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -70,8 +70,14 @@ if ($id > 0 || ! empty($ref)) { $result = $object->fetch($id, $ref); - 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); + if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product').dol_sanitizeFileName($object->ref); + elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product').dol_sanitizeFileName($object->ref); + + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs + { + if (! empty($conf->product->enabled)) $upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos"; + else $upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2),1,1).'/'.substr(substr("000".$object->id, -2),0,1).'/'.$object->id."/photos"; + } } $modulepart='produit'; @@ -175,12 +181,19 @@ if ($object->id) // Construit liste des fichiers $filearray=dol_dir_list($upload_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($upload_dirold,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=array_merge($filearray, $filearrayold); + } + $totalsize=0; foreach($filearray as $key => $file) { $totalsize+=$file['size']; } - + print ''; @@ -233,7 +246,8 @@ if ($object->id) $filearray = dol_dir_list($upload_dir, "files", 0, '', '\.meta$', 'name', SORT_ASC, 1); // For each file build select list with PDF extention - if (count($filearray) > 0) { + if (count($filearray) > 0) + { print '
'; // Actual file to merge is : if (count($filetomerge->lines) > 0) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 77e8373d2a7..c7789761cd3 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -133,7 +133,7 @@ else // Add what we are searching for if (! empty($sall)) $texte.= " - ".$sall; - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; + $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' MIN(pfp.unitprice) as minsellprice'; @@ -431,6 +431,7 @@ else $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,'',24); print "\n"; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 8bd2096af69..40b1e0f9816 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -101,7 +101,7 @@ $htmlother=new FormOther($db); $title=$langs->trans("ProductsAndServices"); -$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; +$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' SUM(s.reel) as stock_physique'; @@ -307,6 +307,7 @@ if ($resql) $product_static->id=$objp->rowid; $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; + $product_static->entity=$objp->entity; print $product_static->getNomUrl(1,'',16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 86410df8a00..b2ac9fbcbec 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -104,7 +104,7 @@ $htmlother=new FormOther($db); $title=$langs->trans("ProductsAndServices"); -$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; +$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,'; $sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' s.fk_entrepot,'; @@ -324,6 +324,7 @@ if ($resql) $product_static->id=$objp->rowid; $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; + $product_static->entity=$objp->entity; print $product_static->getNomUrl(1,'',16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; @@ -344,7 +345,7 @@ if ($resql) // Warehouse print ''; print ''; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 42925a704ec..2769c1a699e 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -129,7 +129,7 @@ if ($id > 0 || ! empty($ref)) if ($user->rights->commande->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,"; - $sql .= " c.ref_client,"; + $sql.= " c.ref_client,"; $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 0516163b2a1..07d9dc3ad4b 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -134,7 +134,8 @@ if ($id > 0 || ! empty($ref)) { print ''; - if ($user->rights->fournisseur->commande->lire) { + if ($user->rights->fournisseur->commande->lire) + { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql .= " c.rowid, d.total_ht as total_ht, c.ref,"; $sql .= " c.date_commande, c.fk_statut as statut, c.rowid as commandeid, d.rowid, d.qty"; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 84d1ba72a80..4992cd7c728 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -126,7 +126,8 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($user->rights->propale->lire) { + if ($user->rights->propale->lire) + { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, p.rowid as propalid, p.ref, d.total_ht as amount,"; $sql .= " p.ref_client,"; $sql .= "p.datep, p.fk_statut as statut, d.rowid, d.qty"; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 22ed390bc8f..034fd71a2bb 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -394,7 +394,7 @@ else $totalunit=0; $totalvalue=$totalvaluesell=0; - $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,"; + $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,"; $sql.= " ps.pmp, ps.reel as value"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_product = p.rowid"; @@ -438,6 +438,7 @@ else $productstatic->ref = $objp->ref; $productstatic->label = $objp->produit; $productstatic->type=$objp->type; + $productstatic->entity=$objp->entity; print $productstatic->getNomUrl(1,'stock',16); print ''; print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 26a2aef8e12..d5deffb2c12 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -164,7 +164,7 @@ $form=new Form($db); $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 = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type, p.entity,"; $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.inventorycode, m.fk_origin, m.origintype,"; $sql.= " m.batch,m.eatby,m.sellby,"; @@ -575,6 +575,7 @@ if ($resql) $productstatic->ref=$objp->product_ref; $productstatic->label=$objp->produit; $productstatic->type=$objp->type; + $productstatic->entity=$objp->entity; print $productstatic->getNomUrl(1,'',16); print "\n"; // Product label diff --git a/htdocs/public/emailing/mailing-read.php b/htdocs/public/emailing/mailing-read.php index 1e991305658..4aa388ecf24 100644 --- a/htdocs/public/emailing/mailing-read.php +++ b/htdocs/public/emailing/mailing-read.php @@ -72,13 +72,13 @@ if (! empty($tag)) $resql=$db->query($sql); //Update status communication of thirdparty prospect - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag='".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)"; dol_syslog("public/emailing/mailing-read.php : Mail read thirdparty : ".$sql, LOG_DEBUG); $resql=$db->query($sql); //Update status communication of contact prospect - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=3 WHERE fk_stcomm != -1 AND rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)"; dol_syslog("public/emailing/mailing-read.php : Mail read contact : ".$sql, LOG_DEBUG); $resql=$db->query($sql); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index e075f67cdaf..2282b42cf0f 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -285,7 +285,7 @@ $sql = $sql_select; $sql.= ' d.description as description,'; if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; -if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type,'; +if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; $sql.= " s.rowid as socid "; if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; @@ -402,6 +402,7 @@ if ($sql_select) $product_static->type=$objp->fk_product_type; $product_static->id=$objp->fk_product; $product_static->ref=$objp->ref; + $product_static->entity=$objp->pentity; $text=$product_static->getNomUrl(1); } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index f1388530317..7898f543507 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -44,16 +44,16 @@ $langs->load("bills"); $action = GETPOST('action', 'alpha'); // Security check -$socid = GETPOST('socid', 'int'); +$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); if ($user->societe_id) $socid = $user->societe_id; $result = restrictedArea($user, 'societe', $socid, '&societe'); -/** - * *************************************************** - * Price by customer - * **************************************************** + +/* + * Actions */ + if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->rights->produit->creer || $user->rights->service->creer)) { $update_child_soc = GETPOST('updatechildprice'); @@ -114,91 +114,92 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user- $action = ''; } + /* * View */ $form = new Form($db); -$soc = new Societe($db); +$object = new Societe($db); -$result = $soc->fetch($socid); +$result = $object->fetch($socid); llxHeader("", $langs->trans("ThirdParty") . '-' . $langs->trans('PriceByCustomer')); if (! empty($conf->notification->enabled)) $langs->load("mails"); -$head = societe_prepare_head($soc); +$head = societe_prepare_head($object); dol_fiche_head($head, 'price', $langs->trans("ThirdParty"), 0, 'company'); print '
'; - $warehousetmp->fetch($obj->fk_entrepot); + $warehousetmp->fetch($objp->fk_entrepot); print $warehousetmp->getNomUrl(1); print ''.$objp->batch.''.$objp->produit.'
'; print ''; // Alias names (commercial, trademark or alias names) print '"; if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''; + print ''; } -if ($soc->client) { +if ($object->client) { print ''; } -if ($soc->fournisseur) { +if ($object->fournisseur) { print ''; } if (! empty($conf->barcode->enabled)) { - print ''; + print ''; } print ""; // Zip / Town -print '"; -print '"; +print '"; +print '"; // Country -if ($soc->country) { +if ($object->country) { print ''; } // EMail print ''; // Web print ''; // Phone / Fax -print ''; -print ''; +print ''; +print ''; print '
' . $langs->trans("ThirdPartyName") . ''; -print $form->showrefnav($soc, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); +print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); print '
'.$langs->trans('AliasNames').''; -print $soc->name_alias; +print $object->name_alias; print "
' . $langs->trans('Prefix') . '' . $soc->prefix_comm . '
' . $langs->trans('Prefix') . '' . $object->prefix_comm . '
'; print $langs->trans('CustomerCode') . ''; - print $soc->code_client; - if ($soc->check_codeclient() != 0) + print $object->code_client; + if ($object->check_codeclient() != 0) print ' (' . $langs->trans("WrongCustomerCode") . ')'; print '
'; print $langs->trans('SupplierCode') . ''; - print $soc->code_fournisseur; - if ($soc->check_codefournisseur() != 0) + print $object->code_fournisseur; + if ($object->check_codefournisseur() != 0) print ' (' . $langs->trans("WrongSupplierCode") . ')'; print '
' . $langs->trans('Gencod') . '' . $soc->barcode . '
' . $langs->trans('Gencod') . '' . $object->barcode . '
" . $langs->trans('Address') . ""; -dol_print_address($soc->address, 'gmap', 'thirdparty', $soc->id); +dol_print_address($object->address, 'gmap', 'thirdparty', $object->id); print "
' . $langs->trans('Zip') . '' . $soc->zip . "' . $langs->trans('Town') . '' . $soc->town . "
' . $langs->trans('Zip') . '' . $object->zip . "' . $langs->trans('Town') . '' . $object->town . "
' . $langs->trans('Country') . ''; - $img = picto_from_langcode($soc->country_code); + $img = picto_from_langcode($object->country_code); print($img ? $img . ' ' : ''); - print $soc->country; + print $object->country; print '
' . $langs->trans('EMail') . ''; -print dol_print_email($soc->email, 0, $soc->id, 'AC_EMAIL'); +print dol_print_email($object->email, 0, $object->id, 'AC_EMAIL'); print '
' . $langs->trans('Web') . ''; -print dol_print_url($soc->url); +print dol_print_url($object->url); print '
' . $langs->trans('Phone') . '' . dol_print_phone($soc->tel, $soc->country_code, 0, $soc->id, 'AC_TEL') . '' . $langs->trans('Fax') . '' . dol_print_phone($soc->fax, $soc->country_code, 0, $soc->id, 'AC_FAX') . '
' . $langs->trans('Phone') . '' . dol_print_phone($object->tel, $object->country_code, 0, $object->id, 'AC_TEL') . '' . $langs->trans('Fax') . '' . dol_print_phone($object->fax, $object->country_code, 0, $object->id, 'AC_FAX') . '
'; @@ -224,7 +225,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Build filter to diplay only concerned lines $filter = array ( - 't.fk_soc' => $soc->id + 't.fk_soc' => $object->id ); $search_soc = GETPOST('search_soc'); @@ -238,10 +239,10 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print_fiche_titre($langs->trans('PriceByCustomer')); - print '
'; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -316,7 +317,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { setEventMessage($prodcustprice->error, 'errors'); } - print ''; + print ''; print ''; print ''; print ''; @@ -456,7 +457,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print "\n" . '
' . "\n"; - print ''; + print ''; print "\n

\n"; } else { @@ -536,15 +537,15 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Action if ($user->rights->produit->creer || $user->rights->service->creer) { print ''; @@ -568,7 +569,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n" . '
' . "\n"; if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; + print ''; } print "\n

\n"; }
' . $langs->trans('Product') . ''; - print 'id . '&prodid=' . $line->fk_product . '">'; + print 'id . '&prodid=' . $line->fk_product . '">'; print img_info(); print ''; print ' '; - print 'id . '&lineid=' . $line->id . '">'; + print 'id . '&lineid=' . $line->id . '">'; print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; print ' '; - print 'id . '&lineid=' . $line->id . '">'; + print 'id . '&lineid=' . $line->id . '">'; print img_delete('default', 'style="vertical-align: middle;"'); print ''; print '