Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
69757210ce
@ -112,7 +112,7 @@ class Commande extends CommonOrder
|
||||
var $nbtodolate;
|
||||
|
||||
/**
|
||||
* ERR Not engouch stock
|
||||
* ERR Not enough stock
|
||||
*/
|
||||
const STOCK_NOT_ENOUGH_FOR_ORDER = -3;
|
||||
|
||||
@ -3315,7 +3315,7 @@ class Commande extends CommonOrder
|
||||
|
||||
|
||||
/**
|
||||
* Class to mange order lines
|
||||
* Class to manage order lines
|
||||
*/
|
||||
class OrderLine extends CommonOrderLine
|
||||
{
|
||||
|
||||
@ -4105,7 +4105,7 @@ abstract class CommonObject
|
||||
$out .= $extrafields->showOutputField($key,$value);
|
||||
break;
|
||||
case "edit":
|
||||
$out .= $extrafields->showInputField($key,$value,'',$keyprefix);
|
||||
$out .= $extrafields->showInputField($key,$value,'',$keyprefix,'',0,$this->id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -636,10 +636,11 @@ class ExtraFields
|
||||
* @param string $moreparam To add more parametes on html input tag
|
||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param int $showsize Value for size attribute
|
||||
* @param int $showsize Value for size attributed
|
||||
* @param int $objectid Current object id
|
||||
* @return string
|
||||
*/
|
||||
function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0)
|
||||
function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0, $objectid=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
@ -805,6 +806,17 @@ class ExtraFields
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0];
|
||||
if (!empty($InfoFieldList[4]))
|
||||
{
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
|
||||
}
|
||||
//We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra')!==false)
|
||||
{
|
||||
@ -820,7 +832,11 @@ class ExtraFields
|
||||
{
|
||||
$sqlwhere.= ' WHERE 1';
|
||||
}
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it.
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0],array('tablewithentity')))
|
||||
{
|
||||
$sqlwhere.= ' AND entity = '.$conf->entity;
|
||||
}
|
||||
$sql.=$sqlwhere;
|
||||
//print $sql;
|
||||
|
||||
@ -978,6 +994,19 @@ class ExtraFields
|
||||
$sql = 'SELECT ' . $keyList;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $InfoFieldList[0];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
|
||||
// can use SELECT request
|
||||
if (strpos($InfoFieldList[4], '$SEL$')!==false) {
|
||||
$InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) {
|
||||
$InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4]=str_replace('$ID$','0',$InfoFieldList[4]);
|
||||
}
|
||||
|
||||
// We have to join on extrafield table
|
||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
||||
$sql .= ' as main, ' . MAIN_DB_PREFIX . $InfoFieldList[0] . '_extrafields as extra';
|
||||
@ -988,12 +1017,14 @@ class ExtraFields
|
||||
} else {
|
||||
$sqlwhere .= ' WHERE 1';
|
||||
}
|
||||
if (in_array($InfoFieldList[0], array (
|
||||
'tablewithentity'
|
||||
)))
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity; // Some tables may have field, some other not. For the moment we disable it.
|
||||
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
// print $sql;
|
||||
// Some tables may have field, some other not. For the moment we disable it.
|
||||
if (in_array($InfoFieldList[0], array ('tablewithentity')))
|
||||
{
|
||||
$sqlwhere .= ' AND entity = ' . $conf->entity;
|
||||
}
|
||||
// $sql.=preg_replace('/^ AND /','',$sqlwhere);
|
||||
// print $sql;
|
||||
|
||||
$sql .= $sqlwhere;
|
||||
dol_syslog(get_class($this) . '::showInputField type=chkbxlst',LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -135,6 +135,12 @@ function product_prepare_head($object)
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'product', 'remove');
|
||||
|
||||
// Log
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||
|
||||
print $extrafields->showInputField($key, $value);
|
||||
print $extrafields->showInputField($key, $value,'','','',0,$object->id);
|
||||
|
||||
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
|
||||
|
||||
|
||||
@ -79,7 +79,8 @@ ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL DEFAULT '' AFTER ro
|
||||
|
||||
ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype;
|
||||
|
||||
ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL DEFAULT '';
|
||||
UPDATE llx_user_param SET param='ToDelete' WHERE param IS NULL;
|
||||
ALTER TABLE llx_user_param MODIFY COLUMN param varchar(255) NOT NULL;
|
||||
ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL;
|
||||
|
||||
ALTER TABLE llx_expedition ADD COLUMN import_key varchar(14);
|
||||
@ -323,7 +324,8 @@ ALTER TABLE llx_categorie_project ADD CONSTRAINT fk_categorie_project_fk_project
|
||||
|
||||
|
||||
ALTER TABLE llx_c_tva ADD COLUMN code varchar(10) DEFAULT '' after fk_pays;
|
||||
DROP INDEX uk_c_tva_id ON llx_c_tva;
|
||||
-- VMYSQL4.0 DROP INDEX uk_c_tva_id ON llx_c_tva;
|
||||
-- VPGSQL8.0 DROP INDEX uk_c_tva_id;
|
||||
ALTER TABLE llx_c_tva ADD UNIQUE INDEX uk_c_tva_id (fk_pays, code, taux, recuperableonly);
|
||||
|
||||
-- Regions Bolivia (id country=52)
|
||||
|
||||
@ -397,8 +397,8 @@ ExtrafieldLink=Link to an object
|
||||
ExtrafieldParamHelpselect=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...<br><br>In order to have the list depending on another :<br>1,value1|parent_list_code:parent_key<br>2,value2|parent_list_code:parent_key
|
||||
ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
|
||||
ExtrafieldParamHelpradio=Parameters list have to be like key,value<br><br> for example : <br>1,value1<br>2,value2<br>3,value3<br>...
|
||||
ExtrafieldParamHelpsellist=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
ExtrafieldParamHelpchkbxlst=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value <br> if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
ExtrafieldParamHelpsellist=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
ExtrafieldParamHelpchkbxlst=Parameters list comes from a table<br>Syntax : table_name:label_field:id_field::filter<br>Example : c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntaxt extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another :<br>c_typent:libelle:id:parent_list_code|parent_column:filter
|
||||
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax : ObjectName:Classpath<br>Example : Societe:societe/class/societe.class.php
|
||||
LibraryToBuildPDF=Library used to build PDF
|
||||
WarningUsingFPDF=Warning: Your <b>conf.php</b> contains directive <b>dolibarr_pdf_force_fpdf=1</b>. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.<br>To solve this and have a full support of PDF generation, please download <a href="http://www.tcpdf.org/" target="_blank">TCPDF library</a>, then comment or remove the line <b>$dolibarr_pdf_force_fpdf=1</b>, and add instead <b>$dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir'</b>
|
||||
|
||||
@ -1305,7 +1305,7 @@ else
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'card', $titre, 0, $picto);
|
||||
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
dol_banner_tab($object, 'id', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@ -726,6 +726,7 @@ class Product extends CommonObject
|
||||
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1);
|
||||
$sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL');
|
||||
$sql.= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
|
||||
$sql.= " WHERE rowid = " . $id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
@ -4123,4 +4124,52 @@ class Product extends CommonObject
|
||||
return $user->rights->service;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load information for tab info
|
||||
*
|
||||
* @param int $id Id of thirdparty to load
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.datec as date_creation, p.tms as date_modification,";
|
||||
$sql.= " p.fk_user_author, p.fk_user_modif";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p";
|
||||
$sql.= " WHERE p.rowid = ".$id;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
|
||||
$this->ref = $obj->ref;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
108
htdocs/product/info.php
Normal file
108
htdocs/product/info.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Maxime Kohlhaas <maxime@atm-consulting.fr>
|
||||
*
|
||||
* 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/info.php
|
||||
* \ingroup product
|
||||
* \brief Information page for product
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
$langs->load("product");
|
||||
$langs->load("other");
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
$result=restrictedArea($user,'produit|service',$id,'product&product');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('infoproduct'));
|
||||
|
||||
$object = new Product($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($b);
|
||||
|
||||
$title=$langs->trans("Product");
|
||||
$helpurl='';
|
||||
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
if ($id > 0 || $ref)
|
||||
{
|
||||
$result = $object->fetch($id,$ref);
|
||||
if (! $result)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$head=product_prepare_head($object);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||
dol_fiche_head($head, 'info', $titre, 0, $picto);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref');
|
||||
|
||||
$object->info($object->id);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
dol_print_object_info($object);
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -78,15 +78,13 @@ if ($socid > 0)
|
||||
exit;
|
||||
}
|
||||
|
||||
$object->info($socid);
|
||||
|
||||
$head = societe_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("ThirdParty"), 0, 'company');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
|
||||
|
||||
$object->info($socid);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user