From d79478e66d25364f89b587e5bd2cf933ceb5b3cc Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 30 Jan 2016 09:43:02 +0100 Subject: [PATCH 01/12] Add hook on contacttpl The goal is to display additionnal feature a the bottom of the contact page like display contact adress and print stamp directly Another way is to show on a google maps the travel to do between us and the multiple thirdpartie present --- htdocs/core/tpl/contacts.tpl.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 638d54a62ef..e6037637d35 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2015 Laurent Destailleur - * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2015-2016 Charlie BENKE * * 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 @@ -228,4 +228,13 @@ $userstatic=new User($db); + +initHooks(array('contacttpl')); + $parameters=array(); + $reshook=$hookmanager->executeHooks('formContactTpl',$parameters,$object,$action); + } +?> From 324c1123e0c847d75d928c3894e70acd3d3fdf70 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Sat, 30 Jan 2016 17:21:42 +0100 Subject: [PATCH 02/12] Update contacts.tpl.php if permission modules right are not in french --- htdocs/core/tpl/contacts.tpl.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index e6037637d35..4908d162f8b 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -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); From d430676e51284609fb8fb97c4d734af4ce1221a9 Mon Sep 17 00:00:00 2001 From: abcnet-lu Date: Wed, 3 Feb 2016 12:14:26 +0100 Subject: [PATCH 03/12] [Close] [#4558] Add districts and cantons for Luxembourg --- htdocs/install/mysql/data/llx_10_c_regions.sql | 7 ++++++- .../install/mysql/data/llx_20_c_departements.sql | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index e736f7d993d..c3bed3ae3c6 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -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); \ No newline at end of file +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); diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 765f96f1da7..c1338fe5d1f 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -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); \ No newline at end of file +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); From 7b456d23f0dd35ed3c66730f660f6880c2f36a1f Mon Sep 17 00:00:00 2001 From: phf Date: Wed, 3 Feb 2016 22:53:15 +0100 Subject: [PATCH 04/12] FIX if we add extrafield on socpeople we got sql error on the list of contact --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index c916710e087..b319072dc68 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -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 From 0c05342934d37dbb031ed6c996bbf0e67a9bbb2d Mon Sep 17 00:00:00 2001 From: phf Date: Wed, 3 Feb 2016 22:54:48 +0100 Subject: [PATCH 05/12] FIX infinite loop --- htdocs/core/class/html.formpropal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index d64cd23e98d..57dd6336a43 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -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++; } } } From 490f3eaf82f5e6fc25d335f1e89d73ff87d26cb6 Mon Sep 17 00:00:00 2001 From: abcnet-lu Date: Thu, 4 Feb 2016 14:41:26 +0100 Subject: [PATCH 06/12] [#4566] Add legal forms for Luxembourg --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 52d488d3706..550190a89c5 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -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); From f87bfffdd96b1f203fed705c479fdb46d8f927d9 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 16:12:00 +0100 Subject: [PATCH 07/12] add edition feacture on product element --- .../core/modules/product/modules_product.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 htdocs/core/modules/product/modules_product.php diff --git a/htdocs/core/modules/product/modules_product.php b/htdocs/core/modules/product/modules_product.php new file mode 100644 index 00000000000..afe07e39503 --- /dev/null +++ b/htdocs/core/modules/product/modules_product.php @@ -0,0 +1,52 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2016 Charlie Benke + * + * 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 . + * 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; + } +} From db0c8740b9321742a092727c1c6c6ca1d644183e Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 16:17:45 +0100 Subject: [PATCH 08/12] add administration feature of products docs --- htdocs/product/admin/product.php | 226 ++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 2 deletions(-) diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 57f6577f789..15b113ffffb 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -7,6 +7,7 @@ * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2016 Charlie Benke * * 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 ''; + +print '
'; +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 ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\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 ''; + + // Activate / Disable + if (in_array($name, $def)) + { + print ""; + } + else + { + if (versioncompare($module->phpmin,versionphparray()) > 0) + { + print ""; + } + else + { + print ""; + } + } + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1); + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + closedir($handle); + } +} +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print $module->name; + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print '\n"; + print 'scandir.'&label='.urlencode($module->name).'">'; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print "\n"; + print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off'); + print "\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + $linkspec=''.img_object($langs->trans("Preview"),'bill').''; + } + else + { + $linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print $linkspec; + print '
'; + /* * Other conf */ From 0517435797c72fc338e8a3acf46dc05ba94c450f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 16:21:27 +0100 Subject: [PATCH 09/12] add product document generation --- htdocs/product/card.php | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d65c7fe1f35..bdfdf986d17 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -13,6 +13,7 @@ * Copyright (C) 2014-2015 Ferran Marcet * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2016 Charlie Benke * * 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 '
'; +print ''; // 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 '
'; + + +print '
'; + +print '

'; /* ************************************************************************** */ From 1e9ea4f2ac181fe9a357692d65516057f8db42cc Mon Sep 17 00:00:00 2001 From: abcnet-lu Date: Thu, 4 Feb 2016 16:40:49 +0100 Subject: [PATCH 10/12] [#4568] Add professional IDs for Luxembourg --- htdocs/langs/de_DE/companies.lang | 6 ++++++ htdocs/langs/en_US/companies.lang | 6 ++++++ htdocs/langs/fr_FR/companies.lang | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/htdocs/langs/de_DE/companies.lang b/htdocs/langs/de_DE/companies.lang index caca577779f..7efd00d61ff 100644 --- a/htdocs/langs/de_DE/companies.lang +++ b/htdocs/langs/de_DE/companies.lang @@ -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.) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 292fcafe238..588867b1f2f 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -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.) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index d9a85c72175..7c64149b5bf 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -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.) From 87c5854382640069f4895e4b3253b968b6f22c00 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 4 Feb 2016 16:58:19 +0100 Subject: [PATCH 11/12] just change for rerun travis cheking --- htdocs/core/tpl/contacts.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 4908d162f8b..de3d79a790d 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Laurent Destailleur +/* Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013-2015 Laurent Destailleur * Copyright (C) 2015-2016 Charlie BENKE * * This program is free software; you can redistribute it and/or modify From e1da95871a02c9f39cc987de6097691517bea2ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2016 12:23:16 +0100 Subject: [PATCH 12/12] Fix bad name --- htdocs/core/js/select2_locale.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/select2_locale.js.php b/htdocs/core/js/select2_locale.js.php index 2600182dfa1..660b41820df 100644 --- a/htdocs/core/js/select2_locale.js.php +++ b/htdocs/core/js/select2_locale.js.php @@ -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 */