diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 73b43e95f4b..1db2aa867ae 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -180,8 +180,38 @@ tools:
- 'htdocs/includes/*'
paths: { }
+ php_changetracking:
+ enabled: false
+ bug_patterns:
+ - '\bfix(?:es|ed)?\b'
+ feature_patterns:
+ - '\badd(?:s|ed)?\b'
+ - '\bimplement(?:s|ed)?\b'
+ filter:
+ excluded_paths:
+ - 'build/*'
+ - 'dev/*'
+ - 'doc/*'
+ - 'test/*'
+ - 'htdocs/includes/*'
+ paths: { }
+
# Coding-Style / Bug Detection
- js_hint: false
+ js_hint:
+ enabled: false
+ use_native_config: true
+ extensions:
+ - js
+ filter:
+ excluded_paths:
+ - 'build/*'
+ - 'dev/*'
+ - 'doc/*'
+ - 'test/*'
+ - 'htdocs/includes/*'
+ paths: { }
+ config: { }
+ path_configs: { }
before_commands: { }
diff --git a/COPYRIGHT b/COPYRIGHT
index fd54e10f354..2e1c6e921b9 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -26,7 +26,7 @@ TCPDF 6.0.093 LGPL-3+ Yes
JS libraries:
jQuery 1.8.2 MIT License Yes JS library
jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
-jQuery multiple-select 1.1.0 MIT License Yes JS library plugin for sexier multiselect
+jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
diff --git a/ChangeLog b/ChangeLog
index 9f1ae0857a2..22b1631390f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
+- New: Match other auth system: Login can be done entering login or user
+ email (this open the road for SSO).
- New: Agenda export by project #1967.
- New: Increase length of thirdparty to 128 chars.
- New: "Is Order shippable" icon #1975.
diff --git a/dev/initdata/mysqldump_dolibarr_3.6.0.sql b/dev/initdata/mysqldump_dolibarr_3.6.0.sql
index 77cbbcc511f..b1b8d77aa3c 100644
--- a/dev/initdata/mysqldump_dolibarr_3.6.0.sql
+++ b/dev/initdata/mysqldump_dolibarr_3.6.0.sql
@@ -4867,7 +4867,7 @@ CREATE TABLE `llx_opensurvey_sondage` (
`mailsonde` tinyint(4) NOT NULL DEFAULT '0',
`survey_link_visible` int(11) DEFAULT '1',
`origin` varchar(64) DEFAULT NULL,
- `tms` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id_sondage`),
KEY `idx_id_sondage_admin` (`id_sondage_admin`),
KEY `idx_date_fin` (`date_fin`)
diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php
index f623debc581..4dddc5a8c80 100644
--- a/dev/skeletons/skeleton_class.class.php
+++ b/dev/skeletons/skeleton_class.class.php
@@ -182,7 +182,7 @@ class Skeleton_Class extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
- function update($user=0, $notrigger=0)
+ function update($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php
index dc8f50241a1..d0eef1dc2f4 100644
--- a/htdocs/accountancy/admin/export.php
+++ b/htdocs/accountancy/admin/export.php
@@ -26,7 +26,7 @@
*/
require '../../main.inc.php';
-
+
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@@ -44,7 +44,7 @@ $action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_*
$list = array (
- 'ACCOUNTING_SEPARATORCSV'
+ 'ACCOUNTING_SEPARATORCSV'
);
/*
@@ -52,26 +52,26 @@ $list = array (
*/
if ($action == 'update') {
$error = 0;
-
+
$modelcsv = GETPOST('modelcsv', 'int');
-
+
if (! empty($modelcsv)) {
-
+
if (! dolibarr_set_const($db, 'ACCOUNTING_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
} else {
$error ++;
}
-
+
foreach ( $list as $constname ) {
$constvalue = GETPOST($constname, 'alpha');
-
+
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
-
+
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
} else {
@@ -90,7 +90,7 @@ $form = new Form($db);
$linkback=''.$langs->trans("BackToModuleList").' ';
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup');
-$head = admin_accounting_prepare_head(null);
+$head = admin_accounting_prepare_head();
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
@@ -142,13 +142,13 @@ if ($num) {
foreach ( $list as $key ) {
$var = ! $var;
-
+
print '
';
-
+
// Param
$label = $langs->trans($key);
print '' . $label . ' ';
-
+
// Value
print '';
print ' ';
diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
index 5907c754644..4dd005fca85 100644
--- a/htdocs/accountancy/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -59,10 +59,10 @@ $max=100;
$form = new Form($db);
-llxHeader('',$title);
-
$title = $langs->trans('FiscalYears');
+llxHeader('',$title,LOG_ERR);
+
print_fiche_titre($langs->trans('FiscalYears'));
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index c442eacc23c..46a34698785 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -25,12 +25,13 @@
*/
/**
- * Classe permettant la gestion des comptes generaux de compta
+ * Class to manage accounting accounts
*/
class AccountingAccount
{
var $db;
var $error;
+ var $errors;
var $id;
var $rowid;
@@ -126,6 +127,8 @@ class AccountingAccount
global $conf, $langs;
$error = 0;
+ $now=dol_now();
+
// Clean parameters
if (isset($this->fk_pcg_version))
$this->fk_pcg_version = trim($this->fk_pcg_version);
diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 2788526de05..6291790d008 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -30,6 +30,9 @@
class BookKeeping
{
var $db;
+ var $error;
+ var $errors;
+
var $id;
var $doc_date;
var $doc_type;
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index 97d52124c01..d2f204c6b8c 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -58,8 +58,10 @@ if ($user->societe_id > 0)
$action = GETPOST('action');
+
+
/*
- * View
+ * Actions
*/
$year_current = strftime("%Y", dol_now());
@@ -152,9 +154,6 @@ if ($result) {
dol_print_error($db);
}
-/*
- * Actions
-*/
// Bookkeeping Write
if ($action == 'writebookkeeping') {
$now = dol_now();
@@ -237,9 +236,16 @@ if ($action == 'writebookkeeping') {
}
}
-// export csv
-if ($action == 'export_csv') {
+/*
+ * View
+ */
+
+$companystatic = new Societe($db);
+
+// export csv
+if ($action == 'export_csv')
+{
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
header('Content-Type: text/csv');
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index 102f45496c6..d6295981586 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -70,7 +70,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($rowid);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
-$objcanvas='';
+$objcanvas=null;
if (! empty($canvas))
{
require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
@@ -79,7 +79,7 @@ if (! empty($canvas))
}
// Security check
-$result=restrictedArea($user,'adherent',$rowid,'','','fk_soc', 'rowid', $objcanvas);
+$result=restrictedArea($user, 'adherent', $rowid, '', '', 'fk_soc', 'rowid', $objcanvas);
if ($rowid > 0)
{
@@ -291,8 +291,6 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
//$object->note = trim($_POST["comment"]);
$object->morphy = $_POST["morphy"];
- $object->amount = $_POST["amount"];
-
if (GETPOST('deletephoto')) $object->photo='';
elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index cdbfabf4576..714fd2af3ca 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -465,8 +465,11 @@ class Adherent extends CommonObject
$nbrowsaffected+=$this->db->affected_rows($resql);
+ $action='update';
+
// Actions on extra fields (by external module)
- $hookmanager->initHooks(array('memberdao'));
+ // FIXME le hook fait double emploi avec le trigger !!
+ $hookmanager->initHooks(array('memberdao'));
$parameters=array('id'=>$this->id);
$action='';
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 4d33723a947..72b7c8fe549 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -453,8 +453,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=1;
foreach ($listfield as $f => $value)
{
+ if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
- if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryRegion','DictionaryCompanyType'))) continue; // For some pages, country is not mandatory
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
if ($value == 'color' && empty($_POST['color'])) continue;
@@ -1361,14 +1361,18 @@ function fieldList($fieldlist,$obj='',$tabname='')
continue;
} // For state page, we do not show the country input (we link to region, not country)
print ' ';
- print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), 'country', '', 28);
+ $fieldname='country';
+ print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28);
print ' ';
}
elseif ($fieldlist[$field] == 'country_id') {
- $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
- print '';
- print ' ';
- print ' ';
+ if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
+ {
+ $country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
+ print '';
+ print ' ';
+ print ' ';
+ }
}
elseif ($fieldlist[$field] == 'region') {
print '';
diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php
index c81366bc5e9..ac0fe715c99 100644
--- a/htdocs/admin/dons.php
+++ b/htdocs/admin/dons.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2005-2010 Laurent Destailleur
* Copyright (C) 2012-2013 Juanjo Menent
* Copyright (C) 2013 Philippe Grand
- * Copyright (C) 2014 Alexandre Spangaro
+ * Copyright (C) 2014 Alexandre Spangaro
*
* 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
@@ -37,6 +37,8 @@ $typeconst=array('yesno','texte','chaine');
$action = GETPOST('action','alpha');
+$type='donation';
+
/*
* Action
@@ -135,7 +137,7 @@ else if ($action == 'setart200') {
$res = dolibarr_set_const($db, "DONATION_ART200", $setart200, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
-
+
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
@@ -147,7 +149,7 @@ else if ($action == 'setart238') {
$res = dolibarr_set_const($db, "DONATION_ART238", $setart238, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
-
+
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
@@ -159,7 +161,7 @@ else if ($action == 'setart885') {
$res = dolibarr_set_const($db, "DONATION_ART885", $setart885, 'yesno', 0, '', $conf->entity);
if (! $res > 0)
$error ++;
-
+
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
} else {
@@ -183,7 +185,7 @@ print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup');
* Params
*/
print_titre($langs->trans("Options"));
-
+
print '';
print '';
print ''.$langs->trans("Parameter").' ';
@@ -207,11 +209,11 @@ print '';
/*
* French params
*/
-if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR")
+if ($conf->global->MAIN_LANG_DEFAULT == "fr_FR")
{
print ' ';
print_titre($langs->trans("FrenchOptions"));
-
+
print '';
print '';
print '' . $langs->trans('Parameters') . ' ';
@@ -377,7 +379,7 @@ if (is_resource($handle))
print '';
print $form->textwithpicto('',$htmltooltip,-1,0);
print ' ';
-
+
// Preview
print '';
print ''.img_object($langs->trans("Preview"),'generic').' ';
diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php
index 59205dcdbab..d5562248c55 100644
--- a/htdocs/admin/events.php
+++ b/htdocs/admin/events.php
@@ -78,15 +78,16 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
print $langs->trans("LogEventDesc")." \n";
print " \n";
-$head=security_prepare_head();
-
-dol_fiche_head($head, 'audit', $langs->trans("Security"));
-
print '\n";
-print '';
-
-$db->close();
llxFooter();
+$db->close();
diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php
index 5cdb41cbe23..bd2ffa66342 100644
--- a/htdocs/admin/ihm.php
+++ b/htdocs/admin/ihm.php
@@ -142,7 +142,7 @@ if ($action == 'edit') // Edit
print '
'."\n";
// Themes
- show_theme('',1);
+ show_theme(null,1);
print ' ';
// Liste des zone de recherche permanantes supportees
@@ -323,7 +323,7 @@ else // Show
// Themes
- show_theme('',0);
+ show_theme(null,0);
print ' ';
diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php
index 2e050a4bbe8..6dfefd14feb 100644
--- a/htdocs/admin/menus.php
+++ b/htdocs/admin/menus.php
@@ -26,7 +26,6 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$action=GETPOST('action');
diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php
index 215f2eae069..d7fce1c937d 100644
--- a/htdocs/admin/menus/index.php
+++ b/htdocs/admin/menus/index.php
@@ -326,6 +326,7 @@ if ($conf->use_javascript_ajax)
''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '.
''.img_edit_add('default').' '.
''.img_delete('default').' '.
+ ' '.
''.img_picto("Monter","1uparrow").' '.img_picto("Descendre","1downarrow").' '.
'
'
);
diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php
index 050c92fd188..2e9d1f49169 100644
--- a/htdocs/admin/proxy.php
+++ b/htdocs/admin/proxy.php
@@ -86,6 +86,13 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
print $langs->trans("ProxyDesc")." \n";
print " \n";
+
+
+print '';
-
dol_fiche_end();
+print '';
+print ' ';
+print '
';
+
+print '';
$db->close();
diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php
index d7027d8a1dd..99651a4f4f3 100644
--- a/htdocs/admin/salaries.php
+++ b/htdocs/admin/salaries.php
@@ -23,7 +23,7 @@
*/
require '../main.inc.php';
-
+
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@@ -45,7 +45,7 @@ $list = array (
/*
* Actions
*/
-
+
if ($action == 'update')
{
$error = 0;
@@ -72,12 +72,12 @@ if ($action == 'update')
* View
*/
-llxHeader();
+llxHeader('',$langs->trans('SalariesSetup'));
$form = new Form($db);
$linkback=''.$langs->trans("BackToModuleList").' ';
-print_fiche_titre($langs->trans('ConfigSalaries'),$linkback,'setup');
+print_fiche_titre($langs->trans('SalariesSetup'),$linkback,'setup');
print '';
+
+
+
// Form to test upload
print ' ';
$formfile=new FormFile($db);
diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php
index b69e8a4cacf..18de8bf6bfc 100644
--- a/htdocs/admin/syslog.php
+++ b/htdocs/admin/syslog.php
@@ -183,8 +183,9 @@ foreach ($syslogModules as $moduleName)
{
$module = new $moduleName;
- $moduleactive=$module->isActive();
- if ($moduleactive == -1 && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
+ $moduleactive=(int) $module->isActive();
+ //print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)." \n";
+ if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
$var=!$var;
print '';
@@ -199,7 +200,7 @@ foreach ($syslogModules as $moduleName)
{
foreach ($setuparray as $option)
{
- if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']];
+ if (isset($_POST[$option['constant']])) $value=$_POST[$option['constant']];
else if (defined($option['constant'])) $value = constant($option['constant']);
else $value = (isset($option['default']) ? $option['default'] : '');
@@ -220,7 +221,7 @@ foreach ($syslogModules as $moduleName)
print "\n";
print "\n";
-print ' ';
+print ' '."\n\n";
print_titre($langs->trans("SyslogLevel"));
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index f7de102d96d..de8d494f9fc 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -107,7 +107,7 @@ class Categorie extends CommonObject
$this->type = $res['type'];
$this->entity = $res['entity'];
- $this->fetch_optionals($this->id,$extralabels);
+ $this->fetch_optionals($this->id,null);
$this->db->free($resql);
@@ -198,6 +198,8 @@ class Categorie extends CommonObject
{
$this->id = $id;
+ $action='create';
+
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookModuleNamedao'));
@@ -289,11 +291,13 @@ class Categorie extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql))
{
+ $action='update';
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('HookCategorydao'));
$parameters=array();
+ $action='update';
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
@@ -408,6 +412,17 @@ class Categorie extends CommonObject
$error++;
}
}
+ if (! $error)
+ {
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang";
+ $sql .= " WHERE fk_category = ".$this->id;
+ if (!$this->db->query($sql))
+ {
+ $this->error=$this->db->lasterror();
+ dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR);
+ $error++;
+ }
+ }
// Delete category
if (! $error)
@@ -430,7 +445,7 @@ class Categorie extends CommonObject
if ($result < 0)
{
$error++;
- dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
+ dol_syslog(get_class($this)."::delete erreur ".$this->error, LOG_ERR);
}
}
}
@@ -788,7 +803,7 @@ class Categorie extends CommonObject
*/
function get_full_arbo($type,$markafterid=0)
{
- global $langs;
+ global $conf, $langs;
$this->cats = array();
@@ -798,11 +813,9 @@ class Categorie extends CommonObject
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.description, c.fk_parent"; // Distinct reduce pb with old tables with duplicates
- if (! empty($conf->global->MAIN_MULTILANGS))
- $sql.= ", t.label as label_trans, t.description as description_trans";
+ if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
- if (! empty($conf->global->MAIN_MULTILANGS))
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
+ if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
$sql.= " WHERE c.entity IN (".getEntity('category',1).")";
$sql.= " AND c.type = ".$type;
@@ -1263,7 +1276,7 @@ class Categorie extends CommonObject
$result='';
$lien = '';
- $label=$langs->trans("ShowCategory").': '.$this->label;
+ $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label);
$lienfin=' ';
$picto='category';
@@ -1271,7 +1284,7 @@ class Categorie extends CommonObject
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';
- if ($withpicto != 2) $result.=$lien.dol_trunc($this->ref,$maxlength).$lienfin;
+ if ($withpicto != 2) $result.=$lien.dol_trunc(($this->ref?$this->ref:$this->label),$maxlength).$lienfin;
return $result;
}
@@ -1369,7 +1382,7 @@ class Categorie extends CommonObject
// Objet
$obj=array();
$obj['photo']=$photo;
- if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette;
+ if ($photo_vignette && is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']='thumbs/' . $photo_vignette;
else $obj['photo_vignette']="";
$tabobj[$nbphoto-1]=$obj;
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index 69a8bb97eab..c54d7d889b2 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -241,7 +241,7 @@ if ($object->id)
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
if ($obj['photo_vignette'])
{
- $filename='thumbs/'.$obj['photo_vignette'];
+ $filename=$obj['photo_vignette'];
}
else
{
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 96db3133cf9..1cb3bc741bc 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@@ -74,6 +76,7 @@ $cactioncomm = new CActionComm($db);
$object = new ActionComm($db);
$contact = new Contact($db);
$extrafields = new ExtraFields($db);
+$formfile = new FormFile($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
@@ -710,9 +713,9 @@ if ($action == 'create')
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
//For external user force the company to user company
if (!empty($user->societe_id)) {
- print $form->select_company($user->societe_id,'socid','',1,1,0,$events);
+ print $form->select_thirdparty_list($user->societe_id,'socid','',1,1,0,$events);
} else {
- print $form->select_company('','socid','',1,1,0,$events);
+ print $form->select_thirdparty_list('','socid','',1,1,0,$events);
}
}
@@ -1243,6 +1246,34 @@ if ($id > 0)
if ($action != 'edit')
{
+
+ if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) {
+ print '';
+ print '
'; // ancre
+
+ /*
+ * Documents generes
+ */
+
+ $filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
+ $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id;
+
+ $genallowed=$user->rights->agenda->myactions->create;
+ $delallowed=$user->rights->agenda->myactions->delete;
+
+ $var=true;
+
+ $somethingshown=$formfile->show_documents('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang);
+
+ print '
';
+
+ print '
';
+ }
+
+
// Link to agenda views
print '';
print '
';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index b4a5fdeed60..34e88dd893e 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -241,8 +241,11 @@ class ActionComm extends CommonObject
if (! $error)
{
+ $action='create';
+
// Actions on extra fields (by external module or standard code)
- $hookmanager->initHooks(array('actioncommdao'));
+ // FIXME le hook fait double emploi avec le trigger !!
+ $hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
@@ -560,8 +563,10 @@ class ActionComm extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql))
{
+ $action='update';
// Actions on extra fields (by external module or standard code)
+ // FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('actioncommdao'));
$parameters=array('actcomm'=>$this->id);
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 065f01d2091..77dfea739e1 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -103,7 +103,7 @@ class CActionComm
* @param string $idorcode 'id' or 'code'
* @param string $excludetype Type to exclude
* @param string $onlyautoornot Group list by auto events or not
- * @return array Array of all event types if OK, <0 if KO
+ * @return mixed Array of all event types if OK, <0 if KO
*/
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0)
{
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index b6c3054f3a8..dcebefbcbb7 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -201,6 +201,7 @@ if ($filter) $param.="&filter=".$filter;
if ($filtera) $param.="&filtera=".$filtera;
if ($filtert) $param.="&filtert=".$filtert;
if ($filterd) $param.="&filterd=".$filterd;
+if ($usergroup) $param.="&usergroup=".$usergroup;
if ($socid) $param.="&socid=".$socid;
if ($showbirthday) $param.="&showbirthday=1";
if ($pid) $param.="&projectid=".$pid;
@@ -242,6 +243,20 @@ $nav.=" (';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+$nav.=' ';
+
$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
$nav.=' ';
$nav.=' ';
@@ -659,10 +674,12 @@ while ($obj = $db->fetch_object($resql))
$todayarray=dol_getdate($now,'fast');
$sav = $tmpday;
$showheader = true;
+$var = false;
foreach ($usernames as $username)
{
+ $var = ! $var;
echo "
";
- echo '' . $username->getNomUrl(1). ' ';
+ echo '' . $username->getNomUrl(1). ' ';
$tmpday = $sav;
// Lopp on each day of week
@@ -688,7 +705,7 @@ foreach ($usernames as $username)
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
if ($today) $style='cal_today_peruser';
- show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype);
+ show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
$i++;
}
@@ -785,9 +802,10 @@ $db->close();
* @param int $minheight Minimum height for each event. 60px by default.
* @param boolean $showheader Show header
* @param array $colorsbytype Array with colors by type
+ * @param string $var true or false for alternat style on tr/td
* @return void
*/
-function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array())
+function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false)
{
global $db;
global $user, $conf, $langs, $hookmanager, $action;
@@ -989,8 +1007,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
- if ($h == $begin_h) echo '';
- else echo ' ';
+ if ($h == $begin_h) echo ' ';
+ else echo ' ';
if (count($cases1[$h]) == 1) // 1 seul evenement
{
$ids=array_keys($cases1[$h]);
diff --git a/htdocs/comm/list.php b/htdocs/comm/list.php
index ac354d4d08d..ce7eb82f9a1 100644
--- a/htdocs/comm/list.php
+++ b/htdocs/comm/list.php
@@ -48,13 +48,12 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
-$search_nom=GETPOST("search_nom");
+$search_company=GETPOST("search_company");
$search_zipcode=GETPOST("search_zipcode");
$search_town=GETPOST("search_town");
$search_code=GETPOST("search_code");
$search_compta=GETPOST("search_compta");
$search_status = GETPOST("search_status",'int');
-if ($search_status=='') $search_status=1; // always display activ customer first
// Load sale and categ filters
$search_sale = GETPOST("search_sale");
@@ -78,21 +77,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x"))
{
- $search_categ='';
- $catid='';
- $search_sale='';
- $socname="";
- $search_nom="";
+ $search_sale="";
+ $search_categ="";
+ $catid="";
+ $search_company="";
$search_zipcode="";
$search_town="";
- $search_idprof1='';
- $search_idprof2='';
- $search_idprof3='';
- $search_idprof4='';
- $seach_status=1;
+ $search_code='';
+ $search_compta='';
+ $search_status='';
}
-
+if ($search_status=='') $search_status=1; // always display activ customer first
/*
* view
@@ -122,8 +118,8 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
-if ($search_nom) {
- $sql .= natural_search('s.nom', $search_nom);
+if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
}
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) {
@@ -156,7 +152,7 @@ if ($result)
{
$num = $db->num_rows($result);
- $param = "&search_nom=".$search_nom."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town;
+ $param = "&search_company=".$search_company."&search_code=".$search_code."&search_zipcode=".$search_zipcode."&search_town=".$search_town;
if ($search_categ != '') $param.='&search_categ='.$search_categ;
if ($search_sale != '') $param.='&search_sale='.$search_sale;
if ($search_status != '') $param.='&search_status='.$search_status;
@@ -207,7 +203,7 @@ if ($result)
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
@@ -235,7 +231,6 @@ if ($result)
print ' ';
print ' ';
- print ' ';
print ' ';
print ' ';
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 3eeef6916eb..6d23d3a982d 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -2000,7 +2000,7 @@ if ($action == 'create')
{
$var = true;
- // Add free products/services
+ // Add products/services form
$object->formAddObjectLine(1, $mysoc, $soc);
$parameters = array();
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 15d85afec07..12dbbe7d1c1 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -651,7 +651,7 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
* @return int <0 if KO, >=0 if OK
*/
- function create($user='', $notrigger=0)
+ function create($user, $notrigger=0)
{
global $langs,$conf,$mysoc,$hookmanager;
$error=0;
@@ -846,6 +846,8 @@ class Propal extends CommonObject
$resql=$this->update_price(1);
if ($resql)
{
+ $action='update';
+
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
@@ -917,7 +919,7 @@ class Propal extends CommonObject
{
$this->products=$this->lines;
- return $this->create();
+ return $this->create($user);
}
/**
@@ -1264,6 +1266,8 @@ class Propal extends CommonObject
*/
function update_extrafields($user)
{
+ $action='update';
+
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('propaldao'));
@@ -2118,7 +2122,7 @@ class Propal extends CommonObject
if (! $error)
{
- dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG);
+ dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG);
$this->db->commit();
return 1;
}
@@ -2879,7 +2883,7 @@ class PropaleLigne extends CommonObject
$error=0;
- dol_syslog("PropaleLigne::insert rang=".$this->rang);
+ dol_syslog(get_class($this)."::insert rang=".$this->rang);
// Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0;
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 96d633bd834..66b36e0320f 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -56,6 +56,8 @@ $search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_author=GETPOST('search_author','alpha');
$search_town=GETPOST('search_town','alpha');
+$viewstatut=$db->escape(GETPOST('viewstatut'));
+$object_statut=$db->escape(GETPOST('propal_statut'));
$sall=GETPOST("sall");
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
@@ -78,6 +80,26 @@ if (! empty($socid))
}
$result = restrictedArea($user, $module, $objectid, $dbtable);
+if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers
+{
+ $search_categ='';
+ $search_user='';
+ $search_sale='';
+ $search_ref='';
+ $search_refcustomer='';
+ $search_societe='';
+ $search_montant_ht='';
+ $search_author='';
+ $search_town='';
+ $year='';
+ $month='';
+ $viewstatut='';
+ $object_statut='';
+}
+
+if($object_statut != '')
+$viewstatut=$object_statut;
+
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propallist'));
@@ -93,21 +115,6 @@ $parameters=array('socid'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-// Do we click on purge search criteria ?
-if (GETPOST("button_removefilter_x"))
-{
- $search_categ='';
- $search_user='';
- $search_sale='';
- $search_ref='';
- $search_refcustomer='';
- $search_societe='';
- $search_montant_ht='';
- $search_author='';
- $search_town='';
- $year='';
- $month='';
-}
/*
@@ -132,11 +139,6 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-$viewstatut=$db->escape(GETPOST('viewstatut'));
-$object_statut = $db->escape(GETPOST('propal_statut'));
-if($object_statut != '')
-$viewstatut=$object_statut;
-
if (! $sortfield) $sortfield='p.datep';
if (! $sortorder) $sortorder='DESC';
$limit = $conf->liste_limit;
@@ -322,10 +324,12 @@ if ($result)
print '';
$formpropal->selectProposalStatus($viewstatut,1);
print ' ';
+
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
+
print " \n";
$var=true;
@@ -391,7 +395,7 @@ if ($result)
// Date proposal
print '
';
- print dol_print_date($db->jdate($obj->dp), 'day');
+ print dol_print_date($db->jdate($objp->dp), 'day');
print " \n";
// Date end validity
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index ce3ec431180..ed308394e6c 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -801,6 +801,8 @@ class Commande extends CommonOrder
if (! $error)
{
+ $action='create';
+
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
@@ -998,7 +1000,12 @@ class Commande extends CommonOrder
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
- $this->lines[$i] = $line;
+ // get extrafields from original line
+ $object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
+ foreach($object->lines[$i]->array_options as $options_key => $value)
+ $line->array_options[$options_key] = $value;
+
+ $this->lines[$i] = $line;
}
$this->socid = $object->socid;
@@ -1019,6 +1026,11 @@ class Commande extends CommonOrder
$this->origin = $object->element;
$this->origin_id = $object->id;
+ // get extrafields from original line
+ $object->fetch_optionals($object->id);
+ foreach($object->array_options as $options_key => $value)
+ $this->array_options[$options_key] = $value;
+
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
@@ -2928,6 +2940,8 @@ class Commande extends CommonOrder
*/
function update_extrafields($user)
{
+ $action='create';
+
// Actions on extra fields (by external module or standard code)
// FIXME le hook fait double emploi avec le trigger !!
$hookmanager->initHooks(array('orderdao'));
@@ -3280,7 +3294,7 @@ class OrderLine extends CommonOrderLine
$error=0;
- dol_syslog("OrderLine::insert rang=".$this->rang);
+ dol_syslog(get_class($this)."::insert rang=".$this->rang);
// Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0;
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index ea17d895b95..b152a38db02 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -229,7 +229,7 @@ if ($resql)
if ($viewstatut == 1)
$title.=' - '.$langs->trans('StatusOrderValidatedShort');
if ($viewstatut == 2)
- $title.=' - '.$langs->trans('StatusOrderOnProcessShort');
+ $title.=' - '.$langs->trans('StatusOrderSentShort');
if ($viewstatut == 3)
$title.=' - '.$langs->trans('StatusOrderToBillShort');
if ($viewstatut == 4)
@@ -295,7 +295,7 @@ if ($resql)
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print '
';
-
+
print '';
print '';
print ' ';
diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php
index b92aa1eb34a..03f0babe75d 100644
--- a/htdocs/compta/bank/bankid_fr.php
+++ b/htdocs/compta/bank/bankid_fr.php
@@ -63,8 +63,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$account->number = trim($_POST["number"]);
$account->cle_rib = trim($_POST["cle_rib"]);
$account->bic = trim($_POST["bic"]);
- $account->iban = trim($_POST["iban_prefix"]);
- $account->iban_prefix = trim($_POST["iban_prefix"]); // deprecated
+ $account->iban = trim($_POST["iban"]);
$account->domiciliation = trim($_POST["domiciliation"]);
$account->proprio = trim($_POST["proprio"]);
$account->owner_address = trim($_POST["owner_address"]);
@@ -246,7 +245,7 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
print ' '.$langs->trans($ibankey).' ';
- print ''.$account->iban_prefix.' ';
+ print ''.$account->iban.' ';
print '