Merge remote branch 'upstream/develop' into sticker

Conflicts:
	htdocs/install/mysql/migration/3.9.0-4.0.0.sql
This commit is contained in:
frederic34 2016-02-06 12:12:35 +01:00
commit 0d11d94234
24 changed files with 449 additions and 34 deletions

View File

@ -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

View File

@ -161,7 +161,8 @@ if ($action == 'add')
$params,
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
(GETPOST('list')?1:0),
(GETPOST('ishidden')?1:0)
);
if ($result > 0)
{
@ -311,7 +312,8 @@ if ($action == 'update')
$params,
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
(GETPOST('list')?1:0),
(GETPOST('ishidden')?1:0)
);
if ($result > 0)
{

View File

@ -4085,6 +4085,7 @@ abstract class CommonObject
else
{
$csstyle='';
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
if (is_array($params) && count($params)>0) {
if (array_key_exists('style',$params)) {
$csstyle=$params['style'];
@ -4092,12 +4093,12 @@ abstract class CommonObject
}
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
$out .= '<tr '.$csstyle.'>';
$out .= '<tr '.$class.$csstyle.'>';
$colspan='0';
}
else
{
$out .= '<tr '.$csstyle.'>';
$out .= '<tr '.$class.$csstyle.'>';
}
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
@ -4109,7 +4110,8 @@ abstract class CommonObject
$label = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$label.'</span>';
$out .= '<td>'.$langs->trans($label).'</td>';
$out .='<td'.($colspan?' colspan="'.$colspan.'"':'').'>';
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
switch($mode) {
case "view":

View File

@ -61,6 +61,8 @@ class ExtraFields
var $error;
var $errno;
var $attribute_hidden;
public static $type2label=array(
'varchar'=>'String',
'text'=>'TextLong',
@ -98,6 +100,7 @@ class ExtraFields
$this->attribute_required = array();
$this->attribute_perms = array();
$this->attribute_list = array();
$this->attribute_hidden = array();
}
/**
@ -116,9 +119,10 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @return int <=0 if KO, >0 if OK
*/
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0)
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0)
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@ -135,7 +139,7 @@ class ExtraFields
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{
// Add declaration of field into table
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable, $perms, $list);
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden);
$err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{
@ -243,9 +247,10 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @return int <=0 if KO, >0 if OK
*/
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0)
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0)
{
global $conf;
@ -271,7 +276,7 @@ class ExtraFields
$params='';
}
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list)";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list, ishidden)";
$sql.= " VALUES('".$attrname."',";
$sql.= " '".$this->db->escape($label)."',";
$sql.= " '".$type."',";
@ -285,6 +290,7 @@ class ExtraFields
$sql.= " '".$alwayseditable."',";
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
$sql.= " ".$list;
$sql.= ", ".$ishidden;
$sql.=')';
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
@ -389,9 +395,10 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @return int >0 if OK, <=0 if KO
*/
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='')
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0)
{
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@ -432,7 +439,7 @@ class ExtraFields
{
if ($label)
{
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list);
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden);
}
if ($result > 0)
{
@ -483,12 +490,13 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
* @param int $ishidden Is hidden extrafield
* @return int <=0 if KO, >0 if OK
*/
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0)
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0)
{
global $conf;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list);
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden);
// Clean parameters
if ($elementtype == 'thirdparty') $elementtype='societe';
@ -526,6 +534,7 @@ class ExtraFields
$sql.= " alwayseditable,";
$sql.= " param,";
$sql.= " list";
$sql.= ", ishidden";
$sql.= ") VALUES (";
$sql.= "'".$attrname."',";
$sql.= " ".$conf->entity.",";
@ -540,6 +549,7 @@ class ExtraFields
$sql.= " '".$alwayseditable."',";
$sql.= " '".$param."',";
$sql.= " ".$list;
$sql.= ", ".$ishidden;
$sql.= ")";
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
$resql2=$this->db->query($sql);
@ -585,7 +595,7 @@ class ExtraFields
// For avoid conflicts with external modules
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list";
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
@ -616,6 +626,7 @@ class ExtraFields
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
$this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_list[$tab->name]=$tab->list;
$this->attribute_hidden[$tab->name]=$tab->ishidden;
}
}
}

View File

@ -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++;
}
}
}

View File

@ -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
*/

View 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;
}
}

View File

@ -118,6 +118,8 @@
<tr><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required" <?php echo (GETPOST('required')?' checked':''); ?>></td></tr>
<!-- Always editable -->
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo (GETPOST('alwayseditable')?' checked':''); ?>></td></tr>
<!-- Is visible or not -->
<tr><td><?php echo $langs->trans("IsHidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden" <?php echo (GETPOST('ishidden') ?' checked':''); ?>></td></tr>
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
<!-- By default visible into list -->
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>

View File

@ -60,6 +60,7 @@ $alwayseditable=$extrafields->attribute_alwayseditable[$attrname];
$param=$extrafields->attribute_param[$attrname];
$perms=$extrafields->attribute_perms[$attrname];
$list=$extrafields->attribute_list[$attrname];
$ishidden=$extrafields->attribute_hidden[$attrname];
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{
@ -117,6 +118,8 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($typ
<tr><td><?php echo $langs->trans("Required"); ?></td><td class="valeur"><input id="required" type="checkbox" name="required" <?php echo ($required?' checked':''); ?>></td></tr>
<!-- Always editable -->
<tr><td><?php echo $langs->trans("AlwaysEditable"); ?></td><td class="valeur"><input id="alwayseditable" type="checkbox" name="alwayseditable" <?php echo ($alwayseditable?' checked':''); ?>></td></tr>
<!-- Is visible or not -->
<tr><td><?php echo $langs->trans("IsHidden"); ?></td><td class="valeur"><input id="ishidden" type="checkbox" name="ishidden" <?php echo ($ishidden ?' checked':''); ?>></td></tr>
<!-- By default visible into list -->
<?php if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { ?>
<tr><td><?php echo $langs->trans("ByDefaultInList"); ?>

View File

@ -44,6 +44,7 @@ print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td align="center">'.$langs->trans("AlwaysEditable").'</td>';
print '<td align="center">'.$langs->trans("IsHidden").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
@ -60,6 +61,7 @@ foreach($extrafields->attribute_type as $key => $value)
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_alwayseditable[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_hidden[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";

View File

@ -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 -->

View File

@ -45,7 +45,8 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
}
else
{
print '<tr><td>';
if (!empty($extrafields->attribute_hidden[$key])) print '<tr class="hideobject"><td>';
else print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td';
//var_dump($action);exit;
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
@ -67,7 +68,8 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
print '</tr></table>';
print '<td colspan="'.$cols.'">';
$html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : '';
print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.'" colspan="'.$cols.'">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key], array('date','datetime'))) {

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -149,8 +149,8 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (12
-- LUXEMBOURG (id country=140)
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1401, 140, '17','0','VAT standard rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1402, 140, '14','0','VAT reduced rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1403, 140, '8','0','VAT intermediary rate', 1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1402, 140, '14','0','VAT intermediary rate',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1403, 140, '8','0','VAT reduced rate', 1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1404, 140, '3','0','VAT super-reduced rate', 1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1405, 140, '0','0','VAT Rate 0', 1);

View File

@ -110,6 +110,7 @@ INSERT INTO llx_c_format_cards (rowid, code, name, paper_size, orientation, metr
INSERT INTO llx_c_format_cards (rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active) VALUES (10, 'CARD', 'Dolibarr Business cards', 'A4', 'P', 'mm', 15.00000000, 15.00000000, 2, 5, 0.00000000, 0.00000000, 85.00000000, 54.00000000, 10, 0.00000000, 0.00000000, 1);
INSERT INTO llx_c_format_cards (rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active) VALUES (11, 'L7163', 'Avery-L7163', 'A4', 'P', 'mm', 5.00000000, 15.00000000, 2, 7, 2.50000000, 0.00000000, 99.10000000, 38.10000000, 8, 0.00000000, 0.00000000, 1);
ALTER TABLE llx_extrafields ADD COLUMN ishidden integer DEFAULT 0;

View File

@ -34,4 +34,5 @@ create table llx_extrafields
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, -- extra parameters to define possible values of field
list integer DEFAULT 0 -- list of values for field that are combo lists
,ishidden integer DEFAULT 0
)ENGINE=innodb;

View File

@ -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.)

View File

@ -1641,6 +1641,7 @@ CloseFiscalYear=Close fiscal year
DeleteFiscalYear=Delete fiscal year
ConfirmDeleteFiscalYear=Are you sure to delete this fiscal year ?
AlwaysEditable=Can always be edited
IsHidden=Is not visible
MAIN_APPLICATION_TITLE=Force visible name of application (warning: setting your own name here may break autofill login feature when using DoliDroid mobile application)
NbMajMin=Minimum number of uppercase characters
NbNumMin=Minimum number of numeric characters

View File

@ -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.)

View File

@ -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.)

View File

@ -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
*/

View File

@ -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>';
/* ************************************************************************** */