Merge branch 'Upstream/develop'

This commit is contained in:
aspangaro 2014-08-29 06:33:00 +02:00
commit bb7aa9f29c
24 changed files with 866 additions and 227 deletions

View File

@ -93,8 +93,8 @@ script:
- php upgrade.php 3.5.0 3.6.0 >> upgrade.log
- php upgrade2.php 3.5.0 3.6.0 >> upgrade2.log
- php upgrade.php 3.6.0 3.7.0 >> upgrade.log
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
# - cat upgrade.log
- php upgrade2.php 3.6.0 3.7.0 >> upgrade2.log
# - cat upgrade2.log
- cd ../..
- date

View File

@ -93,7 +93,15 @@ Dolibarr better:
- Table llx_c_pays were renamed into llx_c_country.
- Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after
creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead.
***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users:
- Fix: Can upload files on services.
- Fix: sql errors on updat fichinter
- Fix: debian script syntax error
- Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets
***** ChangeLog for 3.6 compared to 3.5.* *****
For users:

View File

@ -153,16 +153,22 @@ from origin/upstream and origin/pristine.
* Into root dir, launch:
> debian/get-orig-source.sh
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0 " to solve this.
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this.
* Edit tgz file to remove
- includes/sRGB.icc
And rename file into
tcpdf_x.y.z+dfsg.tar.xz
(x.y.z = version, w start from 1 and is increased for each new import)
* Staying into git root directory, run
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.tar.xz
Note: If there was errors solved manually, you may need to make a git commit
* Add an entry into debian/changelog
> dch -v x.y.z-dsfg-1 "My comment" will add entry.
For example: dch -v x.y.z-dsfg-1 "New upstream release." for a new version
> dch -v x.y.z+dsfg-1 "My comment" will add entry.
For example: dch -v x.y.z+dsfg-1 "New upstream release." for a new version
Then modify changelog to replace "version" or "unstable" with "UNRELEASED".
Warning: Date must have format reported by "date -R"
@ -229,7 +235,7 @@ from origin/upstream and origin/pristine.
* If new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0 " to solve this.
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this.
* Edit tgz file to remove
- ckeditor
@ -248,8 +254,8 @@ x.y.z+dsfgw
Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
* Add an entry into debian/changelog
> dch -v x.y.z-w "My comment" will add entry.
For example: dch -v x.y.z-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import)
> dch -v x.y.z+dfsg-w "My comment" will add entry.
For example: dch -v x.y.z+dfsg-w "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import)
Then modify changelog to replace "version" or "unstable" with "UNRELEASED".
Then check/modify also the user/date signature:
- Date must have format reported by "date -R"

View File

@ -243,6 +243,10 @@
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
<severity>0</severity>
</rule>
@ -253,13 +257,13 @@
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.NotCamelCaps">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidVariableName" />
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -538,6 +539,69 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti
print '</tr>';
}
/*
* Salaries
*/
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount, u.firstname, u.lastname, p.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
$sql.= " WHERE p.entity = ".$conf->entity;
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY u.rowid";
$sql.= " ORDER BY u.firstname";
dol_syslog("get payment salaries sql=".$sql);
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{
$num = $db->num_rows($result);
$var=true;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total_ht -= $obj->amount;
$total_ttc -= $obj->amount;
$subtotal_ht += $obj->amount;
$subtotal_ttc += $obj->amount;
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print "<td>".$langs->trans("Salaries")." <a href=\"".DOL_URL_ROOT."/compta/salaries/index.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount).'</td>';
print '<td align="right">'.price(-$obj->amount).'</td>';
print '</tr>';
$i++;
}
}
else
{
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td colspan="3">'.$langs->trans("None").'</td>';
print '</tr>';
}
}
else
{
dol_print_error($db);
}
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
print '</tr>';
/*
* VAT

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -469,6 +470,44 @@ $parameters["mode"] = $modecompta;
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
/*
* Salaries
*/
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " GROUP BY p.label, dm";
dol_syslog("get social salaries payments sql=".$sql);
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
$decaiss[$obj->dm] += $obj->amount;
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
$decaiss_ttc[$obj->dm] += $obj->amount;
$i++;
}
}
}
else
{
dol_print_error($db);
}
/*
* Show result array
*/

View File

@ -71,8 +71,8 @@ $form = new Form($db);
$salstatic = new PaymentSalary($db);
$userstatic = new User($db);
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type,";
$sql.= " s.num_payment, pst.code as payment_code";
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
@ -87,7 +87,7 @@ if ($filtre) {
if ($typeid) {
$sql .= " AND s.fk_typepayment=".$typeid;
}
$sql.= " GROUP BY s.rowid, s.fk_typepayment, s.amount, s.datev, s.label";
//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev, s.fk_typepayment, s.num_payment, pst.code";
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1,$offset);
@ -174,6 +174,7 @@ else
}
$db->close();
llxFooter();
$db->close();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -25,31 +26,88 @@
/**
* Parent class of boxes
* Class ModeleBoxes
*
* Boxes parent class
*/
class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" boxes
{
var $db;
var $error='';
var $max=5;
var $enabled=1;
var $rowid;
var $id;
var $position;
var $box_order;
var $fk_user;
var $sourcefile;
var $class;
var $box_id;
var $note;
/**
* @var DoliDB Database handler
*/
public $db;
/**
* Constructor
* @var string Error message
*/
public $error = '';
/**
* @var int Maximum lines
*/
public $max = 5;
/**
* @var int Status
*/
public $enabled=1;
/**
* @var int Box definition database ID
*/
public $rowid;
/**
* @var int ID
* @deprecated Same as box_id?
*/
public $id;
/**
* @var int Position?
*/
public $position;
/**
* @var string Display order
*/
public $box_order;
/**
* @var int User ID
*/
public $fk_user;
/**
* @var string Source file
*/
public $sourcefile;
/**
* @var string Class name
*/
public $class;
/**
* @var string ID
*/
public $box_id;
/**
* @var string Alphanumeric ID
*/
public $boxcode;
/**
* @var string Note
*/
public $note;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
@ -57,9 +115,9 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
}
/**
* Return last error message
* Return last error message
*
* @return string Error message
* @return string Error message
*/
function error()
{
@ -68,10 +126,11 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
/**
* Load a box line from its rowid
* Load a box line from its rowid
*
* @param int $rowid Row id to load
* @return int <0 if KO, >0 if OK
* @param int $rowid Row id to load
*
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid)
{
@ -110,11 +169,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
/**
* Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
*Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @return void
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
*
* @return void
*/
function showBox($head, $contents)
{

View File

@ -26,7 +26,7 @@
* Parent class for class inheritance lines of business objects
* This class is useless for the moment so no inherit are done on it
*/
abstract class CommonObjectLine
abstract class CommonObjectLine extends CommonObject
{
/**
* Call trigger based on this instance

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (c) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (c) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (c) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (c) 2014 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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
@ -270,7 +270,7 @@ class FormFile
if (! empty($iconPDF)) {
return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
}
$printer = ($user->rights->printipp->read && $conf->printipp->enabled)?true:false;
$printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false;
$hookmanager->initHooks(array('formfile'));
$forname='builddoc';
$out='';
@ -514,11 +514,11 @@ class FormFile
$out.= $genbutton;
$out.= '</th>';
if($hookmanager->hooks['formfile'])
if (!empty($hookmanager->hooks['formfile']))
{
foreach($hookmanager->hooks['formfile'] as $module)
{
if(method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
if (method_exists($module, 'formBuilddocLineOptions')) $out .= '<th></th>';
}
}
$out.= '</tr>';

View File

@ -126,6 +126,11 @@ function fichinter_admin_prepare_head()
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributesdet';
$h++;
complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove');

View File

@ -597,7 +597,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
global $conf, $db, $user, $langs;
global $object, $hookmanager;
$error=0;
$reshook=0;
$file_name = $dest_file;
if (empty($nohook))
@ -663,8 +663,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
}
// Security:
// On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans
// les noms de fichiers.
// On interdit fichiers caches, remontees de repertoire ainsi que les pipe dans les noms de fichiers.
if (preg_match('/^\./',$dest_file) || preg_match('/\.\./',$dest_file) || preg_match('/[<>|]/',$dest_file))
{
dol_syslog("Refused to deliver file ".$dest_file, LOG_WARNING);
@ -677,7 +676,13 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
$reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object);
}
if (empty($reshook))
if ($reshook < 0) // At least one blocking error returned by one hook
{
$errmsg = join(',', $hookmanager->errors);
if (empty($errmsg)) $errmsg = 'ErrorReturnedBySomeHooks'; // Should not occurs. Added if hook is bugged and does not set ->errors when there is error.
return $errmsg;
}
elseif (empty($reshook))
{
// The file functions must be in OS filesystem encoding.
$src_file_osencoded=dol_osencode($src_file);
@ -710,8 +715,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
return -3; // Unknown error
}
}
else
return $reshook;
return 1; // Success
}
/**
@ -802,12 +807,12 @@ function dol_delete_dir($dir,$nophperrors=0)
}
/**
* Remove a directory $dir and its subdirectories (or only files and subdirectories)
* Remove a directory $dir and its subdirectories (or only files and subdirectories)
*
* @param string $dir Dir to delete
* @param int $count Counter to count nb of deleted elements
* @param int $nophperrors Disable all PHP output errors
* @param int $onlysub Delete only files and subdir, not main directory
* @param int $onlysub Delete only files and subdir, not main directory
* @return int Number of files and directory removed
*/
function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0)
@ -837,7 +842,7 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0,$onlysub=0)
}
}
closedir($handle);
if (empty($onlysub))
{
dol_delete_dir($dir,$nophperrors);

View File

@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
@ -21,48 +22,184 @@
*/
/**
* \file htdocs/core/modules/DolibarrModules.class.php
* \brief File of parent class of module descriptor class files
* \file htdocs/core/modules/DolibarrModules.class.php
* \brief File of parent class of module descriptor class files
*/
/**
* Parent class of module descriptor class files
* Class DolibarrModules
*
* Parent class for module descriptor class files
*/
abstract class DolibarrModules
{
//! Database handler
var $db;
//! Relative path to module style sheet
var $style_sheet = ''; // deprecated
//! Path to create when module activated
var $dirs = array();
//! Tableau des boites
var $boxes;
//! Tableau des constantes
var $const;
//! Tableau des droits
var $rights;
//! Tableau des menus
var $menu=array();
//! Module parts array
var $module_parts=array();
//! Tableau des documents ???
var $docs;
var $dbversion = "-";
/**
* Method to enable a module. Insert into database all constants, boxes of module
*
* @param array $array_sql Array of SQL requests to execute when enabling module
* @param string $options String with options when disabling module ('newboxdefonly|noboxes')
* @return int 1 if OK, 0 if KO
* @var DoliDb Database handler
*/
public $db;
/**
* @var string Relative path to module style sheet
* @deprecated
*/
public $style_sheet = '';
/**
* @var array Paths to create when module is activated
*/
public $dirs = array();
/**
* @var array Module boxes
*/
public $boxes = array();
/**
* @var array Module constants
*/
public $const = array();
/**
* @var array Module access rights
*/
public $rights;
/**
* @var string Module access rights family
*/
public $rights_class;
/**
* @var array Module menu entries
*/
public $menu = array();
/**
* @var array Module parts
* array(
* // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers)
* 'triggers' => 0,
* // Set this to 1 if module has its own login method directory (/mymodule/core/login)
* 'login' => 0,
* // Set this to 1 if module has its own substitution function file (/mymodule/core/substitutions)
* 'substitutions' => 0,
* // Set this to 1 if module has its own menus handler directory (/mymodule/core/menus)
* 'menus' => 0,
* // Set this to 1 if module has its own theme directory (/mymodule/theme)
* 'theme' => 0,
* // Set this to 1 if module overwrite template dir (/mymodule/core/tpl)
* 'tpl' => 0,
* // Set this to 1 if module has its own barcode directory (/mymodule/core/modules/barcode)
* 'barcode' => 0,
* // Set this to 1 if module has its own models directory (/mymodule/core/modules/xxx)
* 'models' => 0,
* // Set this to relative path of css file if module has its own css file
* 'css' => '/mymodule/css/mymodule.css.php',
* // Set this to relative path of js file if module must load a js on all pages
* 'js' => '/mymodule/js/mymodule.js',
* // Set here all hooks context managed by module
* 'hooks' => array('hookcontext1','hookcontext2'),
* // Set here all workflow context managed by module
* 'workflow' => array(
* 'WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2' = >array(
* 'enabled' => '! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)',
* 'picto'=>'yourpicto@mymodule'
* )
* )
* )
*/
public $module_parts = array();
/**
* @var string Module documents ?
* @deprecated Seems unused anywhere
*/
public $docs;
/**
* @var string ?
* @deprecated Seems unused anywhere
*/
public $dbversion = "-";
/**
* @var string Error message
*/
public $error;
/**
* @var int Module unique ID
*/
public $numero;
/**
* @var string Module name
*/
public $name;
/**
* @var string Module version
*/
public $version;
/**
* @var string Module description
*/
public $description;
/**
* @var string[] Module language files
*/
public $langfiles;
/**
* @var string Module export code
*/
public $export_code;
/**
* @var string Module export label
*/
public $export_label;
/**
* @var string Module import code
*/
public $import_code;
/**
* @var string Module import label
*/
public $import_label;
/**
* @var string Module constant name
*/
public $const_name;
/**
* @var bool Module can't be disabled
*/
public $always_enabled;
/**
* @var bool Module is enabled globally (Multicompany support)
*/
public $core_enabled;
/**
* Enables a module.
* Inserts all informations into database
*
* @param string[] $array_sql SQL requests to be executed when enabling module
* @param string $options String with options when disabling module ('newboxdefonly|noboxes')
*
* @return int 1 if OK, 0 if KO
*/
function _init($array_sql, $options='')
{
global $conf, $langs;
global $conf;
$err=0;
$this->db->begin();
@ -98,18 +235,13 @@ abstract class DolibarrModules
if (! $err)
{
$val=$array_sql[$i];
$sql='';
$sql=$val;
$ignoreerror=0;
if (is_array($val))
{
$sql=$val['sql'];
$ignoreerror=$val['ignoreerror'];
}
else
{
$sql=$val;
}
// Add current entity id
$sql=str_replace('__ENTITY__', $conf->entity, $sql);
@ -144,15 +276,15 @@ abstract class DolibarrModules
}
/**
* Fonction de desactivation. Supprime de la base les constantes et boites du module
* Disable function. Deletes the module constant and boxes from the database.
*
* @param array $array_sql Array of SQL requests to execute when disable module
* @param string $options String with options when disabling module ('newboxdefonly|noboxes')
* @return int 1 if OK, 0 if KO
* @param string[] $array_sql SQL requests to be executed when module is disabled
* @param string $options Options when disabling module ('newboxdefonly|noboxes')
*
* @return int 1 if OK, 0 if KO
*/
function _remove($array_sql, $options='')
{
global $langs;
$err=0;
$this->db->begin();
@ -212,10 +344,9 @@ abstract class DolibarrModules
/**
* Retourne le nom traduit du module si la traduction existe dans admin.lang,
* sinon le nom defini par defaut dans le module.
* Gives the translated module name if translation exists in admin.lang or the default module name.
*
* @return string Nom du module traduit
* @return string Translated module name
*/
function getName()
{
@ -224,22 +355,21 @@ abstract class DolibarrModules
if ($langs->trans("Module".$this->numero."Name") != ("Module".$this->numero."Name"))
{
// Si traduction du nom du module existe
// If module name translation exists
return $langs->trans("Module".$this->numero."Name");
}
else
{
// If translation of module with its numero does not exists, we take its name
// If module name translation using it's unique id does not exists, we take its name
return $this->name;
}
}
/**
* Retourne la description traduite du module si la traduction existe dans admin.lang,
* sinon la description definie par defaut dans le module
* Gives the translated module description if translation exists in admin.lang or the default module description
*
* @return string Nom du module traduit
* @return string Translated module description
*/
function getDesc()
{
@ -248,24 +378,23 @@ abstract class DolibarrModules
if ($langs->trans("Module".$this->numero."Desc") != ("Module".$this->numero."Desc"))
{
// Si traduction de la description du module existe
// If module description translation exists
return $langs->trans("Module".$this->numero."Desc");
}
else
{
// Si traduction de la description du module n'existe pas, on prend definition en dur dans module
// If module description translation using it's unique id does not exists, we take its description
return $this->description;
}
}
/**
* Return module version.
* Pour les modules a l'etat 'experimental', retourne la traduction de 'experimental'
* Pour les modules 'dolibarr', retourne la version de Dolibarr
* Pour les autres modules, retourne la version du module
* Gives module version
* For 'experimental' modules, gives 'experimental' translation
* For 'dolibarr' modules, gives Dolibarr version
*
* @return string Version du module
* @return string Module version
*/
function getVersion()
{
@ -281,9 +410,9 @@ abstract class DolibarrModules
/**
* Return if a module is a core or external module
* Tells if module is core or external
*
* @return string 'core', 'external' or 'unknown'
* @return string 'core', 'external' or 'unknown'
*/
function isCoreOrExternalModule()
{
@ -295,9 +424,9 @@ abstract class DolibarrModules
/**
* Return list of lang files related to module
* Gives module related language files list
*
* @return array Array of lang files
* @return string[] Language files list
*/
function getLangFilesArray()
{
@ -305,10 +434,11 @@ abstract class DolibarrModules
}
/**
* Return translated label of a export dataset
* Gives translated label of an export dataset
*
* @param int $r Index of dataset
* @return string Label of databaset
* @param int $r Dataset index
*
* @return string Translated databaset label
*/
function getExportDatasetLabel($r)
{
@ -329,10 +459,11 @@ abstract class DolibarrModules
/**
* Return translated label of an import dataset
* Gives translated label of an import dataset
*
* @param int $r Index of dataset
* @return string Label of databaset
* @param int $r Dataset index
*
* @return string Translated dataset label
*/
function getImportDatasetLabel($r)
{
@ -354,9 +485,9 @@ abstract class DolibarrModules
/**
* Insert constant to activate module
* Insert constants for module activation
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function _active()
{
@ -389,10 +520,10 @@ abstract class DolibarrModules
/**
* Remove activation line
* Module deactivation
*
* @return int Nb of errors (0 if OK)
**/
* @return int Error count (0 if OK)
*/
function _unactive()
{
global $conf;
@ -414,24 +545,24 @@ abstract class DolibarrModules
/**
* Create tables and keys required by module.
* Files module.sql and module.key.sql with create table and create keys
* commands must be stored in directory reldir='/module/sql/'
* This function is called by this->init
* Create tables and keys required by module.
* Files module.sql and module.key.sql with create table and create keys
* commands must be stored in directory reldir='/module/sql/'
* This function is called by this->init
*
* @param string $reldir Relative directory where to scan files
* @return int <=0 if KO, >0 if OK
* @param string $reldir Relative directory where to scan files
* @return int <=0 if KO, >0 if OK
*/
function _load_tables($reldir)
{
global $db,$conf;
global $conf;
$error=0;
$dirfound=0;
if (empty($reldir)) return 1;
include_once DOL_DOCUMENT_ROOT .'/core/lib/admin.lib.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
$ok = 1;
foreach($conf->file->dol_document_root as $dirroot)
@ -508,14 +639,15 @@ abstract class DolibarrModules
/**
* Insert boxes into llx_boxes_def
* Adds boxes
*
* @param string $option String with options when disabling module ('newboxdefonly'=insert only boxes definition)
* @return int Nb of errors (0 if OK)
* @param string $option Options when disabling module ('newboxdefonly'=insert only boxes definition)
*
* @return int Error count (0 if OK)
*/
function insert_boxes($option='')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
global $conf;
@ -605,9 +737,9 @@ abstract class DolibarrModules
/**
* Delete boxes
* Removes boxes
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function delete_boxes()
{
@ -657,9 +789,9 @@ abstract class DolibarrModules
}
/**
* Remove links to new module page present in llx_const
* Removes tabs
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function delete_tabs()
{
@ -682,9 +814,9 @@ abstract class DolibarrModules
}
/**
* Add links of new pages from modules in llx_const
* Adds tabs
*
* @return int Number of errors (0 if ok)
* @return int Error count (0 if ok)
*/
function insert_tabs()
{
@ -717,13 +849,7 @@ abstract class DolibarrModules
$sql.= ")";
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
$resql=$this->db->query($sql);
/* Allow duplicate key
if (! $resql)
{
$err++;
}
*/
$this->db->query($sql);
}
$i++;
}
@ -732,9 +858,9 @@ abstract class DolibarrModules
}
/**
* Insert constants defined into $this->const array into table llx_const
* Adds constants
*
* @return int Number of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function insert_const()
{
@ -799,9 +925,9 @@ abstract class DolibarrModules
}
/**
* Remove constants with tags deleteonunactive
* Removes constants tagged 'deleteonunactive'
*
* @return int <0 if KO, 0 if OK
* @return int <0 if KO, 0 if OK
*/
function delete_const()
{
@ -832,11 +958,12 @@ abstract class DolibarrModules
}
/**
* Insert permissions definitions related to the module into llx_rights_def
* Adds access rights
*
* @param int $reinitadminperms If 1, we also grant them to all admin users
* @param int $force_entity Force current entity
* @return int Number of error (0 if OK)
* @param int $reinitadminperms If 1, we also grant them to all admin users
* @param int $force_entity Force current entity
*
* @return int Error count (0 if OK)
*/
function insert_permissions($reinitadminperms=0, $force_entity=null)
{
@ -928,7 +1055,7 @@ abstract class DolibarrModules
if ($reinitadminperms)
{
if (! class_exists('User')) {
require DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
}
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 1";
dol_syslog(get_class($this)."::insert_permissions Search all admin users", LOG_DEBUG);
@ -972,9 +1099,9 @@ abstract class DolibarrModules
/**
* Delete permissions
* Removes access rights
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function delete_permissions()
{
@ -997,15 +1124,15 @@ abstract class DolibarrModules
/**
* Insert menus entries found into $this->menu into llx_menu*
* Adds menu entries
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function insert_menus()
{
global $user;
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php';
$err=0;
@ -1101,9 +1228,9 @@ abstract class DolibarrModules
/**
* Remove menus entries
* Removes menu entries
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function delete_menus()
{
@ -1127,9 +1254,9 @@ abstract class DolibarrModules
}
/**
* Create directories required by module
* Creates directories
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function create_dirs()
{
@ -1185,11 +1312,12 @@ abstract class DolibarrModules
/**
* Insert directories in llx_const
* Adds directories definitions
*
* @param string $name Name
* @param string $dir Directory
* @return int Nb of errors (0 if OK)
* @param string $name Name
* @param string $dir Directory
*
* @return int Error count (0 if OK)
*/
function insert_dirs($name,$dir)
{
@ -1214,7 +1342,7 @@ abstract class DolibarrModules
$sql.= " VALUES (".$this->db->encrypt($name,1).",'chaine',".$this->db->encrypt($dir,1).",'Directory for module ".$this->name."','0',".$conf->entity.")";
dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG);
$resql=$this->db->query($sql);
$this->db->query($sql);
}
}
else
@ -1228,9 +1356,9 @@ abstract class DolibarrModules
/**
* Remove directory entries
* Removes directories
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function delete_dirs()
{
@ -1253,23 +1381,9 @@ abstract class DolibarrModules
}
/**
* Insert activation of generic parts from modules in llx_const
* Input entry use $this->module_parts = array(
* 'triggers' => 0, // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers)
* 'login' => 0, // Set this to 1 if module has its own login method directory (/mymodule/core/login)
* 'substitutions' => 0, // Set this to 1 if module has its own substitution function file (/mymodule/core/substitutions)
* 'menus' => 0, // Set this to 1 if module has its own menus handler directory (/mymodule/core/menus)
* 'theme' => 0, // Set this to 1 if module has its own theme directory (/mymodule/theme)
* 'tpl' => 0, // Set this to 1 if module overwrite template dir (/mymodule/core/tpl)
* 'barcode' => 0, // Set this to 1 if module has its own barcode directory (/mymodule/core/modules/barcode)
* 'models' => 0, // Set this to 1 if module has its own models directory (/mymodule/core/modules/xxx)
* 'css' => '/mymodule/css/mymodule.css.php', // Set this to relative path of css file if module has its own css file
* 'js' => '/mymodule/js/mymodule.js', // Set this to relative path of js file if module must load a js on all pages
* 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module
* 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)', 'picto'=>'yourpicto@mymodule') // Set here all workflow context managed by module
* )
* Adds generic parts
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function insert_module_parts()
{
@ -1338,9 +1452,9 @@ abstract class DolibarrModules
}
/**
* Remove activation of generic parts of modules from llx_const
* Removes generic parts
*
* @return int Nb of errors (0 if OK)
* @return int Error count (0 if OK)
*/
function delete_module_parts()
{
@ -1368,7 +1482,6 @@ abstract class DolibarrModules
}
}
}
return $err;
}

View File

@ -124,7 +124,7 @@ class modSociete extends DolibarrModules
$this->const[$r][4] = 1;
$r++;
*/
$this->const[$r][0] = "SOCIETE_ADD_REF_IN_LIST";
$this->const[$r][1] = "yesno";
$this->const[$r][2] = "0";
@ -320,7 +320,7 @@ class modSociete extends DolibarrModules
$this->export_label[$r]='ExportDataset_company_2';
$this->export_icon[$r]='contact';
$this->export_permission[$r]=array(array("societe","contact","export"));
$this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','p.libelle'=>"Country",'p.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'Customer 0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'Supplier 0 or 1');
$this->export_fields_array[$r]=array('c.rowid'=>"IdContact",'c.civility'=>"CivilityCode",'c.lastname'=>'Lastname','c.firstname'=>'Firstname','c.poste'=>'PostOrFunction','c.datec'=>"DateCreation",'c.tms'=>"DateLastModification",'c.priv'=>"ContactPrivate",'c.address'=>"Address",'c.zip'=>"Zip",'c.town'=>"Town",'d.nom'=>'State','co.label'=>"Country",'co.code'=>"CountryCode",'c.phone'=>"Phone",'c.fax'=>"Fax",'c.phone_mobile'=>"Mobile",'c.email'=>"EMail",'s.rowid'=>"IdCompany",'s.nom'=>"CompanyName",'s.status'=>"Status",'s.code_client'=>"CustomerCode",'s.code_fournisseur'=>"SupplierCode", 's.client'=>'Customer 0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)','s.fournisseur'=>'Supplier 0 or 1');
$this->export_TypeFields_array[$r]=array('c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",'c.address'=>"Text",'c.cp'=>"Text",'c.ville'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text",'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.client'=>"Text",'s.fournisseur'=>"Text");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>"company",'s.code_client'=>"company",'s.code_fournisseur'=>"company", 's.client'=>"company", 's.fournisseur'=>"company"); // We define here only fields that use another picto
if (empty($conf->fournisseur->enabled))

View File

@ -0,0 +1,159 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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/fichinter/admin/fichinter_extrafields.php
* \ingroup fichinter
* \brief Page to setup extra fields of ficheinter
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("admin");
$langs->load("members");
$langs->load('interventions');
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='fichinterdet'; //Must be the $element of the class that manage extrafield
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
llxHeader();
$textobject=$langs->transnoentitiesnoconv("Interventions");
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'setup');
$head=fichinter_admin_prepare_head();
dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), 0, 'intervention');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
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 width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
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="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>";
// $i++;
}
print "</table>";
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();
$db->close();

View File

@ -167,6 +167,17 @@ class Fichinter extends CommonObject
$resql=$this->db->query($sql);
if (! $resql) $error++;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Add linked object
if (! $error && $this->origin && $this->origin_id)
{
@ -853,11 +864,12 @@ class Fichinter extends CommonObject
* @param string $desc Line description
* @param date $date_intervention Intervention date
* @param int $duration Intervention duration
* @param array $array_option Array option
* @return int >0 if ok, <0 if ko
*/
function addline($user,$fichinterid, $desc, $date_intervention, $duration)
function addline($user,$fichinterid, $desc, $date_intervention, $duration, $array_option='')
{
dol_syslog("Fichinter::Addline $fichinterid, $desc, $date_intervention, $duration");
dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration");
if ($this->statut == 0)
{
@ -871,8 +883,13 @@ class Fichinter extends CommonObject
$line->datei = $date_intervention;
$line->duration = $duration;
if (is_array($array_option) && count($array_option)>0) {
$line->array_options=$array_option;
}
$result=$line->insert($user);
if ($result > 0)
if ($result >= 0)
{
$this->db->commit();
return 1;
@ -987,6 +1004,9 @@ class FichinterLigne extends CommonObjectLine
var $duration; // Duree de l'intervention
var $rang = 0;
public $element='fichinterdet';
public $table_element='fichinterdet';
public $fk_element='fk_fichinter';
/**
* Constructor
@ -1017,6 +1037,7 @@ class FichinterLigne extends CommonObjectLine
{
$objp = $this->db->fetch_object($result);
$this->rowid = $objp->rowid;
$this->id = $objp->rowid;
$this->fk_fichinter = $objp->fk_fichinter;
$this->datei = $this->db->jdate($objp->datei);
$this->desc = $objp->description;
@ -1082,7 +1103,21 @@ class FichinterLigne extends CommonObjectLine
$resql=$this->db->query($sql);
if ($resql)
{
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet');
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$this->id=$this->rowid;
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$result=$this->update_total();
if ($result > 0)
{
$this->rang=$rangToUse;
@ -1140,6 +1175,17 @@ class FichinterLigne extends CommonObjectLine
$resql=$this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$this->id=$this->rowid;
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$result=$this->update_total();
if ($result > 0)
{

View File

@ -196,6 +196,13 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
}
// Extrafields
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$array_option = $extrafields->getOptionalsFromPost($extralabels);
$object->array_options = $array_option;
$id = $object->create($user);
if ($id > 0)
@ -266,12 +273,20 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
$duration = 0;
}
$predef = '';
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
$result = $object->addline(
$user,
$id,
$desc,
$date_intervention,
$duration
$duration,
$array_option
);
if ($result < 0)
@ -298,6 +313,13 @@ else if ($action == 'add' && $user->rights->ficheinter->creer)
}
else
{
// Extrafields
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$array_option = $extrafields->getOptionalsFromPost($extralabels);
$object->array_options = $array_option;
$result = $object->create($user);
if ($result > 0)
{
@ -433,12 +455,19 @@ else if ($action == "addline" && $user->rights->ficheinter->creer)
$date_intervention = dol_mktime(GETPOST('dihour','int'), GETPOST('dimin','int'), 0, GETPOST('dimonth','int'), GETPOST('diday','int'), GETPOST('diyear','int'));
$duration = convertTime2Seconds(GETPOST('durationhour','int'), GETPOST('durationmin','int'));
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
$result=$object->addline(
$user,
$id,
$desc,
$date_intervention,
$duration
$duration,
$array_option
);
// Define output language
@ -524,6 +553,13 @@ else if ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST(
$objectline->datei = $date_inter;
$objectline->desc = $desc;
$objectline->duration = $duration;
// Extrafields
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
$objectline->array_options = $array_option;
$result = $objectline->update($user);
if ($result < 0)
{
@ -1433,6 +1469,18 @@ else if ($id > 0 || ! empty($ref))
}
print '</tr>';
$line = new FichinterLigne($db);
$line->fetch($objp->rowid);
$extrafieldsline = new ExtraFields($db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($line->table_element);
$line->fetch_optionals($line->rowid, $extralabelslines);
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>5));
}
// Line in update mode
@ -1461,6 +1509,17 @@ else if ($id > 0 || ! empty($ref))
print '<td align="center" colspan="5" valign="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
print '</tr>' . "\n";
$line = new FichinterLigne($db);
$line->fetch($objp->rowid);
$extrafieldsline = new ExtraFields($db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($line->table_element);
$line->fetch_optionals($line->rowid, $extralabelslines);
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>5));
}
$i++;
@ -1511,7 +1570,16 @@ else if ($id > 0 || ! empty($ref))
print '<td align="center" valign="middle" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
print '</tr>';
//Line extrafield
$lineadd = new FichinterLigne($db);
$extrafieldsline = new ExtraFields($db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($lineadd->table_element);
print $lineadd->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>5));
if (! $num) print '</table>';
}

View File

@ -97,7 +97,7 @@ ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_a
-- Change on table c_pays
ALTER TABLE llx_c_pays RENAME TO llx_c_country;
ALTER TABLE llx_c_country CHANGE libelle label VARCHAR(50);
ALTER TABLE llx_c_country CHANGE COLUMN libelle label VARCHAR(50);
ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid);
ALTER TABLE llx_c_regions ADD CONSTRAINT fk_c_regions_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country (rowid);
@ -994,18 +994,18 @@ CREATE TABLE llx_holiday_types (
deleteAt DATETIME,
nbCongesDeducted varchar(255) NOT NULL,
nbCongesEveryMonth varchar(255) NOT NULL
);
) ENGINE=innodb;
-- Change on table c_civilite
ALTER TABLE llx_c_civilite DROP INDEX uk_c_civilite;
ALTER TABLE llx_c_civilite RENAME TO llx_c_civility;
ALTER TABLE llx_c_civility CHANGE civilite label VARCHAR(50);
ALTER TABLE llx_c_civility CHANGE COLUMN civilite label VARCHAR(50);
ALTER TABLE llx_c_civility ADD UNIQUE INDEX uk_c_civility(code);
ALTER TABLE llx_adherent CHANGE civilite civility VARCHAR(6);
ALTER TABLE llx_socpeople CHANGE civilite civility VARCHAR(6);
ALTER TABLE llx_user CHANGE civilite civility VARCHAR(6);
ALTER TABLE llx_adherent CHANGE COLUMN civilite civility VARCHAR(6);
ALTER TABLE llx_socpeople CHANGE COLUMN civilite civility VARCHAR(6);
ALTER TABLE llx_user CHANGE COLUMN civilite civility VARCHAR(6);
ALTER TABLE llx_c_type_fees CHANGE libelle label VARCHAR(30);
ALTER TABLE llx_c_type_fees CHANGE COLUMN libelle label VARCHAR(30);
ALTER TABLE llx_c_type_fees ADD COLUMN accountancy_code varchar(32) DEFAULT NULL AFTER label;
ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_element (fk_element);
@ -1013,3 +1013,17 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_element (fk_element);
ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_task (fk_task);
ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_date (task_date);
ALTER TABLE llx_projet_task_time ADD INDEX idx_projet_task_time_datehour (task_datehour);
-- add extrafield on ficheinter lines
CREATE TABLE llx_fichinterdet_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields (fk_object);

View File

@ -17,5 +17,5 @@
-- ========================================================================
ALTER TABLE llx_c_type_contact ADD UNIQUE INDEX uk_c_type_contact_id (element, source, code);
ALTER TABLE llx_c_type_resource ADD UNIQUE INDEX uk_c_type_resource_id (label, code);

View File

@ -29,6 +29,6 @@ create table llx_c_type_resource
(
rowid integer PRIMARY KEY,
code varchar(32) NOT NULL,
libelle varchar(64) NOT NULL,
label varchar(64) NOT NULL,
active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb;

View File

@ -0,0 +1,20 @@
-- ===================================================================
-- Copyright (C) 2013 Florian Henry <florian.henry@open-cocncept.pro>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
ALTER TABLE llx_fichinterdet_extrafields ADD INDEX idx_ficheinterdet_extrafields (fk_object);

View File

@ -0,0 +1,25 @@
-- ===================================================================
-- Copyright (C) 2013 florian Henry <florian.henry@open-concept.pro>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===================================================================
CREATE TABLE llx_fichinterdet_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View File

@ -83,6 +83,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_extrafields FOR EACH
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_fourn FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinterdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_livraison FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_localtax FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_menu FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@ -53,6 +53,7 @@ class Project extends CommonObject
var $statuts;
var $oldcopy;
/**
* Constructor
*
@ -252,7 +253,7 @@ class Project extends CommonObject
$result = 1;
}
else
{
{
$this->db->rollback();
$result = -1;
}