Merge pull request #11821 from Tim-Otte/develop
NEW Extrafields support in product supplier prices
This commit is contained in:
commit
496f93911f
@ -597,6 +597,29 @@ abstract class CommonDocGenerator
|
|||||||
|
|
||||||
$resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
|
$resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
|
||||||
|
|
||||||
|
// Check if the current line belongs to a supplier order
|
||||||
|
if (get_class($line) == 'CommandeFournisseurLigne')
|
||||||
|
{
|
||||||
|
// Add the product supplier extrafields to the substitutions
|
||||||
|
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||||
|
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
|
||||||
|
$columns = "";
|
||||||
|
foreach ($extralabels as $key => $value)
|
||||||
|
$columns .= "$key, ";
|
||||||
|
|
||||||
|
if ($columns != "")
|
||||||
|
{
|
||||||
|
$columns = substr($columns, 0, strlen($columns) - 2);
|
||||||
|
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_supplier . "'");
|
||||||
|
if ($this->db->num_rows($resql) > 0) {
|
||||||
|
$resql = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
foreach ($extralabels as $key => $value)
|
||||||
|
$resarray['line_product_supplier_'.$key] = $resql->{$key};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
|
// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
|
||||||
if (isset($line->fk_product) && $line->fk_product > 0)
|
if (isset($line->fk_product) && $line->fk_product > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -291,6 +291,11 @@ function product_admin_prepare_head()
|
|||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/product/admin/product_supplier_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ProductSupplierExtraFields");
|
||||||
|
$head[$h][2] = 'supplierAttributes';
|
||||||
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'product_admin', 'remove');
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'product_admin', 'remove');
|
||||||
|
|
||||||
return $head;
|
return $head;
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_product_fournisseur_price_extrafields ADD INDEX idx_product_fournisseur_price_extrafields (fk_object);
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
Create Table llx_product_fournisseur_price_extrafields (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14) -- import key
|
||||||
|
) ENGINE=innodb;
|
||||||
@ -341,3 +341,4 @@ ErrorDestinationProductNotFound=Zielprodukt nicht gefunden
|
|||||||
ErrorProductCombinationNotFound=Produktvariante nicht gefunden
|
ErrorProductCombinationNotFound=Produktvariante nicht gefunden
|
||||||
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
|
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
|
||||||
ProductsPricePerCustomer=Product prices per customers
|
ProductsPricePerCustomer=Product prices per customers
|
||||||
|
ProductSupplierExtraFields=Ergänzende Attribute (Lieferantenpreise)
|
||||||
@ -347,3 +347,4 @@ ErrorDestinationProductNotFound=Destination product not found
|
|||||||
ErrorProductCombinationNotFound=Product variant not found
|
ErrorProductCombinationNotFound=Product variant not found
|
||||||
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
|
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
|
||||||
ProductsPricePerCustomer=Product prices per customers
|
ProductsPricePerCustomer=Product prices per customers
|
||||||
|
ProductSupplierExtraFields=Additional Attributes (Supplier Prices)
|
||||||
132
htdocs/product/admin/product_supplier_extrafields.php
Normal file
132
htdocs/product/admin/product_supplier_extrafields.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
|
* Copyright (C) 2019 Tim Otte <otte@meuser.it>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/product/admin/product_supplier_extrafields.php
|
||||||
|
* \ingroup product
|
||||||
|
* \brief Page to setup extra fields of products
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->loadLangs(array('companies', 'admin', 'products'));
|
||||||
|
|
||||||
|
$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->transnoentitiesnoconv($val);
|
||||||
|
|
||||||
|
$action=GETPOST('action', 'alpha');
|
||||||
|
$attrname=GETPOST('attrname', 'alpha');
|
||||||
|
$elementtype='product_fournisseur_price'; //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
|
||||||
|
*/
|
||||||
|
|
||||||
|
$title = $langs->trans('ProductServiceSetup');
|
||||||
|
$textobject = $langs->trans("ProductsAndServices");
|
||||||
|
if (empty($conf->product->enabled))
|
||||||
|
{
|
||||||
|
$title = $langs->trans('ServiceSetup');
|
||||||
|
$textobject = $langs->trans('Services');
|
||||||
|
}
|
||||||
|
elseif (empty($conf->service->enabled))
|
||||||
|
{
|
||||||
|
$title = $langs->trans('ProductSetup');
|
||||||
|
$textobject = $langs->trans('Products');
|
||||||
|
}
|
||||||
|
|
||||||
|
//$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
|
||||||
|
$help_url='';
|
||||||
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($title, $linkback, 'title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
$head = product_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'supplierAttributes', $textobject, -1, 'product');
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
if ($action != 'create' && $action != 'edit')
|
||||||
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||||
|
print "</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Creation of an optional field */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
if ($action == 'create')
|
||||||
|
{
|
||||||
|
print '<br><div id="newattrib"></div>';
|
||||||
|
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* Edition of an optional field */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
if ($action == 'edit' && ! empty($attrname))
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||||
|
|
||||||
|
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
@ -9,6 +9,7 @@
|
|||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2019 Tim Otte <otte@meuser.it>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -33,6 +34,7 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.class.php';
|
||||||
@ -53,6 +55,8 @@ $cost_price=GETPOST('cost_price', 'alpha');
|
|||||||
$backtopage=GETPOST('backtopage', 'alpha');
|
$backtopage=GETPOST('backtopage', 'alpha');
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// If socid provided by ajax company selector
|
// If socid provided by ajax company selector
|
||||||
if (! empty($_REQUEST['search_fourn_id']))
|
if (! empty($_REQUEST['search_fourn_id']))
|
||||||
{
|
{
|
||||||
@ -138,6 +142,7 @@ if (empty($reshook))
|
|||||||
$action = '';
|
$action = '';
|
||||||
$result=$object->remove_product_fournisseur_price($rowid);
|
$result=$object->remove_product_fournisseur_price($rowid);
|
||||||
if($result > 0){
|
if($result > 0){
|
||||||
|
$db->query("DELETE FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = $rowid");
|
||||||
setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
|
setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
|
||||||
}else{
|
}else{
|
||||||
$error++;
|
$error++;
|
||||||
@ -146,7 +151,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'updateprice')
|
if ($action == 'save_price')
|
||||||
{
|
{
|
||||||
$id_fourn=GETPOST("id_fourn");
|
$id_fourn=GETPOST("id_fourn");
|
||||||
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
|
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
|
||||||
@ -257,6 +262,36 @@ if (empty($reshook))
|
|||||||
if (isset($_POST['ref_fourn_price_id']))
|
if (isset($_POST['ref_fourn_price_id']))
|
||||||
$object->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
$object->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
|
||||||
|
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||||
|
$extrafield_values = $extrafields->getOptionalsFromPost("product_fournisseur_price");
|
||||||
|
|
||||||
|
$sql = "";
|
||||||
|
$resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $object->product_fourn_price_id);
|
||||||
|
// Insert a new extrafields row, if none exists
|
||||||
|
if ($db->num_rows($resql) != 1) {
|
||||||
|
|
||||||
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields (fk_object, ";
|
||||||
|
foreach ($extrafield_values as $key => $value) {
|
||||||
|
$sql .= str_replace('options_', '', $key) . ', ';
|
||||||
|
}
|
||||||
|
$sql = substr($sql, 0, strlen($sql)-2) . ") VALUES (" . $object->product_fourn_price_id . ", ";
|
||||||
|
foreach ($extrafield_values as $key => $value) {
|
||||||
|
$sql .= '"' . $value . '", ';
|
||||||
|
}
|
||||||
|
$sql = substr($sql, 0, strlen($sql)-2) . ')';
|
||||||
|
}
|
||||||
|
// else update the existing one
|
||||||
|
else {
|
||||||
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields SET ";
|
||||||
|
foreach ($extrafield_values as $key => $value) {
|
||||||
|
$sql .= str_replace('options_', '', $key) . ' = "' . $value . '", ';
|
||||||
|
}
|
||||||
|
$sql = substr($sql, 0, strlen($sql)-2) . ' WHERE fk_object = ' . $object->product_fourn_price_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the sql command from above
|
||||||
|
$db->query($sql);
|
||||||
|
|
||||||
$newprice = price2num(GETPOST("price", "alpha"));
|
$newprice = price2num(GETPOST("price", "alpha"));
|
||||||
|
|
||||||
if ($conf->multicurrency->enabled)
|
if ($conf->multicurrency->enabled)
|
||||||
@ -402,7 +437,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
|
|
||||||
// Form to add or update a price
|
// Form to add or update a price
|
||||||
if (($action == 'add_price' || $action == 'updateprice' ) && $usercancreate)
|
if (($action == 'add_price' || $action == 'update_price' ) && $usercancreate)
|
||||||
{
|
{
|
||||||
$langs->load("suppliers");
|
$langs->load("suppliers");
|
||||||
|
|
||||||
@ -418,7 +453,7 @@ if ($id > 0 || $ref)
|
|||||||
|
|
||||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="updateprice">';
|
print '<input type="hidden" name="action" value="save_price">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
@ -730,6 +765,25 @@ SCRIPT;
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||||
|
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
|
||||||
|
// Extrafields
|
||||||
|
$resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $rowid);
|
||||||
|
if ($db->num_rows($resql) != 1) {
|
||||||
|
foreach ($extralabels as $key => $value) {
|
||||||
|
if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||||
|
print '<tr><td' . ($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '') . '>' . $langs->trans($value) . '</td><td>' . $extrafields->showInputField($key, '', '', '', '', '', 0, 'product_fournisseur_price') . '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$resql = $db->fetch_object($resql);
|
||||||
|
foreach ($extralabels as $key => $value) {
|
||||||
|
if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) {
|
||||||
|
print '<tr><td' . ($extrafields->attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '') . '>' . $langs->trans($value) . '</td><td>' . $extrafields->showInputField($key, $resql->{$key}, '', '', '', '', 0, 'product_fournisseur_price') . '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('id_fourn'=>$id_fourn,'prod_id'=>$object->id);
|
$parameters=array('id_fourn'=>$id_fourn,'prod_id'=>$object->id);
|
||||||
@ -754,7 +808,7 @@ SCRIPT;
|
|||||||
|
|
||||||
print "\n<div class=\"tabsAction\">\n";
|
print "\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($action != 'add_price' && $action != 'updateprice')
|
if ($action != 'add_price' && $action != 'update_price')
|
||||||
{
|
{
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
@ -817,6 +871,17 @@ SCRIPT;
|
|||||||
print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
|
||||||
|
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
|
||||||
|
foreach ($extralabels as $key => $value) {
|
||||||
|
// Show field if not hidden
|
||||||
|
if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||||
|
print_liste_field_titre($value, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
|
$parameters=array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
|
||||||
@ -938,6 +1003,23 @@ SCRIPT;
|
|||||||
print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification), "dayhour");
|
print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification), "dayhour");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $productfourn->product_fourn_price_id);
|
||||||
|
if ($db->num_rows($resql) != 1) {
|
||||||
|
foreach ($extralabels as $key => $value) {
|
||||||
|
if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||||
|
print "<td></td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$resql = $db->fetch_object($resql);
|
||||||
|
foreach ($extralabels as $key => $value) {
|
||||||
|
if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
|
||||||
|
print '<td align="right">' . $extrafields->showOutputField($key, $resql->{$key}) . "</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$object->id);
|
$parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$object->id);
|
||||||
@ -948,7 +1030,7 @@ SCRIPT;
|
|||||||
print '<td class="center nowraponall">';
|
print '<td class="center nowraponall">';
|
||||||
if ($usercancreate)
|
if ($usercancreate)
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$productfourn->fourn_id.'&action=add_price&rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>";
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$productfourn->fourn_id.'&action=update_price&rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>";
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$productfourn->fourn_id.'&action=ask_remove_pf&rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"), 'delete').'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$productfourn->fourn_id.'&action=ask_remove_pf&rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"), 'delete').'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user