Merge pull request #2 from Dolibarr/develop
Merge back official Dolibarr develop into my abcnet-lu fork
This commit is contained in:
commit
a4dedfb169
@ -218,7 +218,7 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contact_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||
|
||||
@ -83,6 +83,7 @@ class FormPropal
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$listofstatus[$obj->id]=array('id'=>$obj->id,'code'=>$obj->code,'label'=>$obj->label);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/js/timepicker.js.php
|
||||
* \file htdocs/core/js/select2_locale.js.php
|
||||
* \brief File that include javascript functions for timepicker
|
||||
*/
|
||||
|
||||
|
||||
52
htdocs/core/modules/product/modules_product.php
Normal file
52
htdocs/core/modules/product/modules_product.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
|
||||
/**
|
||||
* \class ModeleProduct
|
||||
* \brief Parent class for product models of doc generators
|
||||
*/
|
||||
abstract class ModeleProduct extends CommonDocGenerator
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$type='product';
|
||||
$liste=array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||
|
||||
return $liste;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015-2016 Charlie BENKE <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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
|
||||
@ -27,15 +27,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
$module = $object->element;
|
||||
|
||||
// Special cases
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer; }
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; }
|
||||
if ($module == 'propal') { $permission=$user->rights->propale->creer; }
|
||||
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer; }
|
||||
elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer; }
|
||||
elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer; }
|
||||
elseif ($module == 'project') { $permission=$user->rights->projet->creer; }
|
||||
elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; }
|
||||
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; }
|
||||
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; }
|
||||
elseif (! isset($permission)) { $permission=$user->rights->$module->creer; } // If already defined by caller page
|
||||
elseif ($module == 'project') { $permission=$user->rights->projet->creer; }
|
||||
elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; }
|
||||
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; }
|
||||
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; }
|
||||
elseif (! isset($permission) && isset($user->rights->$module->creer))
|
||||
{
|
||||
$permission=$user->rights->$module->creer;
|
||||
}
|
||||
elseif (! isset($permission) && isset($user->rights->$module->write))
|
||||
{
|
||||
$permission=$user->rights->$module->write;
|
||||
}
|
||||
|
||||
$formcompany= new FormCompany($db);
|
||||
$companystatic=new Societe($db);
|
||||
@ -228,4 +235,13 @@ $userstatic=new User($db);
|
||||
<?php } } ?>
|
||||
|
||||
</div>
|
||||
<!-- TEMPLATE CONTACTS HOOK BEGIN HERE -->
|
||||
<?php
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$hookmanager->initHooks(array('contacttpl'));
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formContactTpl',$parameters,$object,$action);
|
||||
}
|
||||
?>
|
||||
<!-- END PHP TEMPLATE CONTACTS -->
|
||||
|
||||
@ -284,4 +284,9 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) v
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5206, '', 0, 'Tarija', 1);
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5207, '', 0, 'Santa Cruz', 1);
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5208, '', 0, 'El Beni', 1);
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5209, '', 0, 'Pando', 1);
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 52, 5209, '', 0, 'Pando', 1);
|
||||
|
||||
-- Regions (districts) Luxembourg (id country=140)
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 140, 14001, '', 0, 'Diekirch', 1);
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 140, 14002, '', 0, 'Grevenmacher', 1);
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) values ( 140, 14003, '', 0, 'Luxembourg', 1);
|
||||
|
||||
@ -1223,4 +1223,18 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('109', 5209, '', 0, '', 'Madre de Dios', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('110', 5209, '', 0, '', 'Manuripi', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('111', 5209, '', 0, '', 'Nicolás Suárez', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('112', 5209, '', 0, '', 'General Federico Román', 1);
|
||||
|
||||
-- Cantons Luxembourg (id country=140)
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0001', 14001, '', 0, '', 'Clervaux', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0002', 14001, '', 0, '', 'Diekirch', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0003', 14001, '', 0, '', 'Redange', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0004', 14001, '', 0, '', 'Vianden', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0005', 14001, '', 0, '', 'Wiltz', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0006', 14002, '', 0, '', 'Echternach', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0007', 14002, '', 0, '', 'Grevenmacher', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0008', 14002, '', 0, '', 'Remich', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0009', 14003, '', 0, '', 'Capellen', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0010', 14003, '', 0, '', 'Esch-sur-Alzette', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0011', 14003, '', 0, '', 'Luxembourg', 1);
|
||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('LU0012', 14003, '', 0, '', 'Mersch', 1);
|
||||
|
||||
@ -278,3 +278,13 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154,
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', 'Sociedad anónima', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', 'Sociedad en comandita por acciones', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', 'Sociedad cooperativa', 1);
|
||||
|
||||
-- Luxembourg
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14001', 'Entreprise individuelle', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14002', 'Société en nom collectif (SENC)', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14003', 'Société en commandite simple (SECS)', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14004', 'Société en commandite par actions (SECA)', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14005', 'Société à responsabilité limitée (SARL)', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14006', 'Société anonyme (SA)', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14007', 'Société coopérative (SC)', 1);
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14008', 'Société européenne (SE)', 1);
|
||||
|
||||
@ -202,6 +202,12 @@ ProfId3IN=Prof Id 3
|
||||
ProfId4IN=Prof Id 4
|
||||
ProfId5IN=Prof Id 5
|
||||
ProfId6IN=-
|
||||
ProfId1LU=Id. prof. 1 (RCS)
|
||||
ProfId2LU=Id. prof. 2 (Niederlassungsgenehmigung)
|
||||
ProfId3LU=-
|
||||
ProfId4LU=-
|
||||
ProfId5LU=-
|
||||
ProfId6LU=-
|
||||
ProfId1MA=Id prof. 1 (R.C.)
|
||||
ProfId2MA=Id prof. 2 (Patente)
|
||||
ProfId3MA=Id prof. 3 (I.F.)
|
||||
|
||||
@ -202,6 +202,12 @@ ProfId3IN=Prof Id 3 (SRVC TAX)
|
||||
ProfId4IN=Prof Id 4
|
||||
ProfId5IN=Prof Id 5
|
||||
ProfId6IN=-
|
||||
ProfId1LU=Id. prof. 1 (RCS)
|
||||
ProfId2LU=Id. prof. 2 (Business permit)
|
||||
ProfId3LU=-
|
||||
ProfId4LU=-
|
||||
ProfId5LU=-
|
||||
ProfId6LU=-
|
||||
ProfId1MA=Id prof. 1 (R.C.)
|
||||
ProfId2MA=Id prof. 2 (Patente)
|
||||
ProfId3MA=Id prof. 3 (I.F.)
|
||||
|
||||
@ -202,6 +202,12 @@ ProfId3IN=Id. prof. 3 (SRVC TAX)
|
||||
ProfId4IN=Id. prof. 4
|
||||
ProfId5IN=Id. prof. 5
|
||||
ProfId6IN=-
|
||||
ProfId1LU=Id. prof. 1 (RCS)
|
||||
ProfId2LU=Id. prof. 2 (Autorisation d'établissement)
|
||||
ProfId3LU=-
|
||||
ProfId4LU=-
|
||||
ProfId5LU=-
|
||||
ProfId6LU=-
|
||||
ProfId1MA=Id. prof. 1 (R.C.)
|
||||
ProfId2MA=Id. prof. 2 (Patente)
|
||||
ProfId3MA=Id. prof. 3 (I.F.)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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
|
||||
@ -42,6 +43,9 @@ if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->e
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$type = GETPOST('type','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
// Pricing Rules
|
||||
$select_pricing_rules=array(
|
||||
@ -98,12 +102,13 @@ if ($action == 'setModuleOptions')
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
//setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
// message yet present at the bottom if($action)
|
||||
//setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,6 +176,86 @@ if ($action == 'other')
|
||||
$value = GETPOST('activate_usesearchtoselectproduct','alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'specimen') // For products
|
||||
{
|
||||
$modele= GETPOST('module','alpha');
|
||||
|
||||
$inter = new Fichinter($db);
|
||||
$inter->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($inter,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=products&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($obj->error,'errors');
|
||||
dol_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->PRODUCT_ADDON_PDF == "$value") dolibarr_del_const($db, 'PRODUCT_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "PRODUCT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->PRODUCT_ADDON_PDF = $value;
|
||||
}
|
||||
|
||||
// On active le modele
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'set')
|
||||
{
|
||||
$const = "PRODUCT_SPECIAL_".strtoupper(GETPOST('spe','alpha'));
|
||||
@ -314,6 +399,143 @@ foreach ($dirproduct as $dirroot)
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
print_titre($langs->trans("ModelModulesProduct"));
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = 'product'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
foreach ($dirproduct as $dirroot)
|
||||
{
|
||||
$dir = dol_buildpath($dirroot.'core/modules/product/doc/',0);
|
||||
$handle=@opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i',$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
try {
|
||||
dol_include_once($dirroot.'core/modules/product/doc/'.$file);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if (! empty($module->version)) {
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
}
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'><td width="100">';
|
||||
print $module->name;
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module,'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
print '</td>';
|
||||
|
||||
// Activate / Disable
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&type=product&scandir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||
print '</a>';
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (versioncompare($module->phpmin,versionphparray()) > 0)
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off');
|
||||
print "</td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td align=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&type=product&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
}
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
|
||||
}
|
||||
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1);
|
||||
|
||||
print '<td align="center" class="nowrap">';
|
||||
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$linkspec='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print $linkspec;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
* Other conf
|
||||
*/
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* 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
|
||||
@ -44,6 +45,8 @@ 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/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.php';
|
||||
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -125,7 +128,33 @@ if (empty($reshook))
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
/*
|
||||
* Build doc
|
||||
*/
|
||||
else if ($action == 'builddoc' && $user->rights->produit->creer)
|
||||
{
|
||||
|
||||
// Save last template used to generate document
|
||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$result=product_create($db, $object, GETPOST('model','alpha'), $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Barcode type
|
||||
if ($action == 'setfk_barcode_type' && $createbarcode)
|
||||
{
|
||||
@ -1649,7 +1678,28 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',250,600);
|
||||
}
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$filedir=$conf->product->dir_output.'/product/'.$object->id;
|
||||
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||
$genallowed=$user->rights->produit->creer;
|
||||
$delallowed=$user->rights->produit->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
$somethingshown=$formfile->show_documents('product',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang);
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user