';
}
@@ -360,9 +362,9 @@ if ($mode == 'feature')
$text.='
'.$langs->trans("RequiredBy").': ';
if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby);
else $text.=$langs->trans("None");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddRemoveTabs").': ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
@@ -375,9 +377,9 @@ if ($mode == 'feature')
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddDictionaries").': ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
@@ -389,9 +391,9 @@ if ($mode == 'feature')
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddBoxes").': ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
@@ -403,27 +405,27 @@ if ($mode == 'feature')
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddModels").': ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddSubstitutions").': ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddSheduledJobs").': ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
@@ -435,55 +437,72 @@ if ($mode == 'feature')
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddTriggers").': ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddHooks").': ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
- $i=0;
- foreach($objMod->module_parts['hooks'] as $val)
+ $i=0;
+ foreach($objMod->module_parts['hooks'] as $key => $val)
{
- $text.=($i?', ':'').($val);
- $i++;
+ if ($key == 'entity') continue;
+
+ // For special values
+ if ($key == 'data')
+ {
+ if (is_array($val))
+ {
+ foreach($val as $value)
+ {
+ $text.=($i?', ':'').($value);
+ $i++;
+ }
+
+ continue;
+ }
+ }
+
+ $text.=($i?', ':'').($val);
+ $i++;
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddPermissions").': ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
$i=0;
foreach($objMod->rights as $val)
{
- $text.=($i?', ':'').($val[1]);
- $i++;
+ $text.=($i?', ':'').($val[1]);
+ $i++;
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddMenus").': ';
if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddExportProfiles").': ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
@@ -495,9 +514,9 @@ if ($mode == 'feature')
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddImportProfiles").': ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
@@ -509,9 +528,9 @@ if ($mode == 'feature')
}
}
else $text.=$langs->trans("No");
-
+
$text.='
';
-
+
$text.='
'.$langs->trans("AddOtherPagesOrServices").': ';
$text.=$langs->trans("DetectionNotPossible");
}
diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php
index 6a9884e263c..7c8413a28a6 100644
--- a/htdocs/admin/propal.php
+++ b/htdocs/admin/propal.php
@@ -30,6 +30,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
$langs->load("admin");
diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php
index 8f115d3963b..85603de2ae5 100644
--- a/htdocs/admin/salaries.php
+++ b/htdocs/admin/salaries.php
@@ -26,7 +26,7 @@ require '../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->load("admin");
$langs->load("salaries");
@@ -76,7 +76,7 @@ if ($action == 'update')
llxHeader('',$langs->trans('SalariesSetup'));
$form = new Form($db);
-if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
+if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
$linkback='
'.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup');
@@ -109,7 +109,7 @@ foreach ($list as $key)
print '
';
if (! empty($conf->accounting->enabled))
{
- print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
}
else
{
diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php
index de128184d18..d408657ac8c 100644
--- a/htdocs/admin/supplier_invoice.php
+++ b/htdocs/admin/supplier_invoice.php
@@ -29,6 +29,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index 030a507ce20..acce3a38c7c 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -29,6 +29,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php
index 345f622a533..8a8d2a181a4 100644
--- a/htdocs/admin/supplier_proposal.php
+++ b/htdocs/admin/supplier_proposal.php
@@ -25,6 +25,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
$langs->load("admin");
@@ -274,7 +275,7 @@ foreach ($dirmodels as $reldir)
while (($file = readdir($handle))!==false)
{
- if (substr($file, 0, 21) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
+ if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php
index dbdce59c3c5..59796919a8b 100644
--- a/htdocs/admin/taxes.php
+++ b/htdocs/admin/taxes.php
@@ -27,7 +27,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
-if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
+if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->load('admin');
@@ -113,7 +113,7 @@ if ($action == 'update') {
llxHeader();
$form=new Form($db);
-if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
+if (! empty($conf->accounting->enabled)) $formaccounting = New FormAccounting($db);
$linkback=''.$langs->trans("BackToModuleList").'';
print load_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup');
@@ -216,7 +216,7 @@ foreach ($list as $key)
print ' | ';
if (! empty($conf->accounting->enabled))
{
- print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
+ print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
}
else
{
diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php
index c22a12fee61..218ab58467e 100644
--- a/htdocs/api/admin/index.php
+++ b/htdocs/api/admin/index.php
@@ -43,12 +43,29 @@ if ($action == 'setproductionmode')
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0)
{
- $result = dol_mkdir($conf->api->dir_temp);
- if ($result < 0)
- {
- setEventMessages($langs->trans("ErrorFaildToCreateDir", $conf->api->dir_temp), null, 'errors');
- }
- else
+ $error=0;
+
+ if ($status == 1)
+ {
+ $result = dol_mkdir($conf->api->dir_temp);
+ if ($result < 0)
+ {
+ setEventMessages($langs->trans("ErrorFailedToCreateDir", $conf->api->dir_temp), null, 'errors');
+ $error++;
+ }
+ }
+ else
+ {
+ // Delete the cache file otherwise it does not update
+ $result = dol_delete_file($conf->api->dir_temp.'/routes.php');
+ if ($result < 0)
+ {
+ setEventMessages($langs->trans("ErrorFailedToDeleteFile", $conf->api->dir_temp.'/routes.php'), null, 'errors');
+ $error++;
+ }
+ }
+
+ if (!$error)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
diff --git a/htdocs/api/class/api_dictionaryevents.class.php b/htdocs/api/class/api_dictionaryevents.class.php
new file mode 100644
index 00000000000..23d7e8e5dba
--- /dev/null
+++ b/htdocs/api/class/api_dictionaryevents.class.php
@@ -0,0 +1,100 @@
+
+ *
+ * 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 .
+ */
+
+use Luracast\Restler\RestException;
+
+require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
+
+/**
+ * API class for events type (content of the actioncomm dictionary)
+ *
+ * @access protected
+ * @class DolibarrApiAccess {@requires user,external}
+ */
+class DictionaryEvents extends DolibarrApi
+{
+ /**
+ * Constructor
+ */
+ function __construct()
+ {
+ global $db;
+ $this->db = $db;
+ }
+
+ /**
+ * Get the list of events types.
+ *
+ * @param string $sortfield Sort field
+ * @param string $sortorder Sort order
+ * @param int $limit Number of items per page
+ * @param int $page Page number (starting from zero)
+ * @param string $type To filter on type of event
+ * @param string $module To filter on module events
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
+ * @return List of events types
+ *
+ * @throws RestException
+ */
+ function index($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $sqlfilters = '')
+ {
+ $list = array();
+
+ $sql = "SELECT id, code, type, libelle as label, module";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as t";
+ $sql.= " WHERE t.active = 1";
+ if ($type) $sql.=" AND t.type LIKE '%" . $this->db->escape($type) . "%'";
+ if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'";
+ // Add sql filters
+ if ($sqlfilters)
+ {
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ }
+
+
+ $sql.= $this->db->order($sortfield, $sortorder);
+
+ if ($limit) {
+ if ($page < 0) {
+ $page = 0;
+ }
+ $offset = $limit * $page;
+
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+
+ $result = $this->db->query($sql);
+
+ if ($result) {
+ $num = $this->db->num_rows($result);
+ $min = min($num, ($limit <= 0 ? $num : $limit));
+ for ($i = 0; $i < $min; $i++) {
+ $list[] = $this->db->fetch_object($result);
+ }
+ } else {
+ throw new RestException(503, 'Error when retrieving list of events types : '.$this->db->lasterror());
+ }
+
+ return $list;
+ }
+
+}
diff --git a/htdocs/api/index.php b/htdocs/api/index.php
index fa96da6b139..1e04590da14 100644
--- a/htdocs/api/index.php
+++ b/htdocs/api/index.php
@@ -1,6 +1,7 @@
+/* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2016 Laurent Destailleur
+ * Copyright (C) 2017 Regis Houssin
*
* 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
@@ -143,10 +144,9 @@ foreach ($modulesdir as $dir)
*
* Search files named api_ |