Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into fix_numbering_module_supplier_payment
Conflicts: htdocs/install/mysql/migration/3.8.0-3.9.0.sql
This commit is contained in:
commit
d66bc6f1b3
39
.travis.yml
39
.travis.yml
@ -197,6 +197,7 @@ before_script:
|
||||
echo "Create documents directory and set permissions"
|
||||
# and admin/temp subdirectory needed for unit tests
|
||||
mkdir -p documents/admin/temp
|
||||
echo "first line" > documents/dolibarr.log
|
||||
echo
|
||||
|
||||
- |
|
||||
@ -279,35 +280,51 @@ script:
|
||||
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log
|
||||
php upgrade2.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-2.log
|
||||
php step5.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-3.log
|
||||
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
|
||||
php upgrade2.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||
php step5.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors
|
||||
# Ensure we catch errors. Set this to +e if you want to go to this end to see log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
#echo "Output dolibarr.log"
|
||||
#echo cat documents/dolibarr.log
|
||||
|
||||
after_script:
|
||||
- |
|
||||
# Dolibarr log file
|
||||
#echo "After script"
|
||||
#cat documents/dolibarr.log
|
||||
|
||||
|
||||
after_success:
|
||||
- |
|
||||
echo Success
|
||||
|
||||
after_failure:
|
||||
- |
|
||||
echo Failure
|
||||
# This part of code seems to be never executed, error or not ???
|
||||
echo "Debugging informations"
|
||||
# Upgrade log files
|
||||
cat *.log
|
||||
echo "Debugging informations"
|
||||
# Apache log file
|
||||
sudo cat /var/log/apache2/error.log
|
||||
# Dolibarr log file
|
||||
cat documents/dolibarr.log
|
||||
if [ "$DEBUG" = true ]; then
|
||||
echo "Debugging informations"
|
||||
# Upgrade log files
|
||||
cat *.log
|
||||
# Dolibarr log file
|
||||
cat documents/dolibarr.log
|
||||
# Apache log file
|
||||
sudo cat /var/log/apache2/error.log
|
||||
# MariaDB log file
|
||||
sudo cat /var/log/mysql/error.log
|
||||
# TODO: PostgreSQL log file
|
||||
echo
|
||||
fi
|
||||
|
||||
after_script:
|
||||
|
||||
|
||||
@ -356,6 +356,12 @@ source_file = htdocs/langs/en_US/withdrawals.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.websites]
|
||||
file_filter = htdocs/langs/<lang>/withdrawals.lang
|
||||
source_file = htdocs/langs/en_US/withdrawals.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.workflow]
|
||||
file_filter = htdocs/langs/<lang>/workflow.lang
|
||||
source_file = htdocs/langs/en_US/workflow.lang
|
||||
|
||||
@ -14,7 +14,7 @@ Component Version License GPL Compatible
|
||||
PHP libraries:
|
||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
|
||||
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
CKEditor 4.5.6 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
|
||||
|
||||
@ -14,8 +14,8 @@ with format .DEB (for Debian, Ubuntu, ...).
|
||||
# To build a debian package, you need first
|
||||
# With Ubuntu 12.04
|
||||
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
|
||||
# With Debian 7
|
||||
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
|
||||
# With Ubuntu 14.04 ou Debian 7
|
||||
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php packaging-dev
|
||||
|
||||
|
||||
# To generate gpg key for email used into changelog
|
||||
@ -49,6 +49,7 @@ Other example:
|
||||
export DEBFULLNAME="Laurent Destailleur"
|
||||
export DEBEMAIL="eldy@destailleur.fr"
|
||||
|
||||
export QUILT_PATCHES=debian/patches
|
||||
|
||||
# To use Alioth.debian.org
|
||||
* Create an account login
|
||||
@ -212,7 +213,9 @@ Warning: Name and email must match value into debian/control file (Entry added h
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area;
|
||||
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-x.y.z]
|
||||
ou
|
||||
> git-buildpackage -us -uc --git-ignore-branch --git-upstream-branch=[upstream|upstream-x.y.z]
|
||||
|
||||
Note: To build an old version, do: git checkout oldtagname -b newbranchname; git-buildpackage -us -uc --git-debian-branch=newbranchname --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
@ -220,6 +223,7 @@ Note: You can use git-buildpackage -us -uc -d if you want to test
|
||||
Note: Package is built into directory ../build-area
|
||||
Note: To compare 2 packages: debdiff package1.dsc package2.dsc
|
||||
|
||||
* Test package (see dedicated chapter to test it with debian unstable env)
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
@ -287,17 +291,24 @@ Then check/modify also the user/date signature:
|
||||
- Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
|
||||
To update dolibarr debian package when only files into debian has changed, or if you include manually backport:
|
||||
To update dolibarr debian package when only files into debian has changed:
|
||||
|
||||
* Change files and commit.
|
||||
* Add a tag debian/x.y.z+dfsgw-2 (increase the last 1 into 2, 3...)
|
||||
|
||||
|
||||
To update dolibarr debian package when only files into debian has changed:
|
||||
|
||||
* Manually, add patches into debian/patches and update file debian/series, or do the 2 steps with "quilt import filepatch.patch"
|
||||
* You can test patching of serie with "quilt push" (autant de fois que de patch). Avec "quilt pop -a", on revien a l'état du upstream sans les patch.
|
||||
|
||||
Once files has been prepared, it's time to test:
|
||||
|
||||
* Try to build package
|
||||
> rm -fr ../build-area;
|
||||
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x|3.5.5]
|
||||
ou
|
||||
> git-buildpackage -us -uc --git-ignore-branch --git-upstream-branch=[upstream|upstream-3.5.x|3.5.5]
|
||||
|
||||
Note: To build an old version, do: git checkout oldtagname -b newbranchname; git-buildpackage -us -uc --git-debian-branch=newbranchname --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
|
||||
@ -16,13 +16,19 @@
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*",
|
||||
"ccampbell/chromephp": "^4.1",
|
||||
"ckeditor/ckeditor": "dev-full/4.3.x#0b7c3f1",
|
||||
"ckeditor/ckeditor": "dev-full/stable",
|
||||
"mike42/escpos-php": "dev-master",
|
||||
"mobiledetect/mobiledetectlib": "2.8.17",
|
||||
"phpoffice/phpexcel": "1.8.1",
|
||||
"restler/framework": "^3.0",
|
||||
"tecnickcom/tcpdf": "6.2.12"
|
||||
},
|
||||
"require-dev": {
|
||||
"jakub-onderka/php-parallel-lint": "^0",
|
||||
"jakub-onderka/php-console-highlighter": "^0",
|
||||
"phpunit/phpunit": "^4",
|
||||
"squizlabs/php_codesniffer": "^2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mysqlnd": "To use with MySQL or MariaDB",
|
||||
"ext-mysqli": "To use with MySQL or MariaDB",
|
||||
|
||||
1128
composer.lock
generated
1128
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -53,14 +53,16 @@ class modMyModule extends DolibarrModules
|
||||
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
|
||||
// It is used to group modules in module setup page
|
||||
$this->family = "other";
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family. (canceled $this->family)
|
||||
$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily")));
|
||||
// Module position in the family
|
||||
$this->module_position = 500;
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
$this->familyinfo = array('myownfamily' => array('position' => '001', 'label' => $langs->trans("MyOwnFamily")));
|
||||
|
||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Description of module MyModule";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
||||
$this->version = '1.0';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
@ -177,8 +179,8 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Cronjobs
|
||||
$this->cronjobs = array(); // List of cron jobs entries to add
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
|
||||
// );
|
||||
|
||||
// Permissions
|
||||
|
||||
@ -32,6 +32,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';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
@ -50,7 +51,10 @@ $list = array (
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
|
||||
'ACCOUNTING_LENGTH_GACCOUNT',
|
||||
'ACCOUNTING_LENGTH_AACCOUNT',
|
||||
'ACCOUNTING_LENGTH_AACCOUNT'
|
||||
);
|
||||
|
||||
$list_account = array (
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
|
||||
@ -107,6 +111,14 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $list_account as $constname ) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -146,6 +158,7 @@ if ($action == 'setlistsortdone') {
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
$formaccountancy = new FormVentilation($db);
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||
@ -255,6 +268,21 @@ foreach ( $list as $key ) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
foreach ( $list_account as $key ) {
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td><label for="' . $key . '">' . $label . '</label></td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$var = ! $var;
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print '<td width="80%">' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>';
|
||||
|
||||
@ -22,11 +22,12 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
* \brief To define accounting account on product / service
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
@ -40,6 +41,14 @@ $langs->load("compta");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// search & action GETPOST
|
||||
$action = GETPOST('action');
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
@ -72,12 +81,14 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $sortfield)
|
||||
if (! $sortfield) {
|
||||
$sortfield = "p.ref";
|
||||
if (! $sortorder)
|
||||
}
|
||||
if (! $sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
// sales or purchase
|
||||
// Sales or Purchase mode ?
|
||||
if ($action == 'update') {
|
||||
if (! empty($btn_changetype)) {
|
||||
$error = 0;
|
||||
@ -129,9 +140,9 @@ if ($action == 'update') {
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||
$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '</font></div>';
|
||||
} else {
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $accounting->account_number . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,13 +155,6 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
// TODO after adding menu
|
||||
// if (! $user->rights->accounting->ventilation->dispatch)
|
||||
// accessforbidden();
|
||||
|
||||
$form = new FormVentilation($db);
|
||||
|
||||
// Defaut AccountingAccount RowId Product / Service
|
||||
@ -176,13 +180,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_desc = '';
|
||||
}
|
||||
|
||||
// debug move header to top
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
@ -206,7 +209,7 @@ $sql .= " WHERE (";
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
@ -238,10 +241,11 @@ if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("InitAccountancyDesc") . '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
@ -249,17 +253,17 @@ if ($result) {
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr ' . $bc[false] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_sell') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductSell'));
|
||||
print '<tr ' . $bc[false] . '><td width="25%"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductSellDesc'));
|
||||
print "</td></tr>\n";
|
||||
print '<tr ' . $bc[true] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_buy') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductBuy')) . "</td></tr>\n";
|
||||
print '<tr ' . $bc[true] . '><td><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductBuyDesc')) . "</td></tr>\n";
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||
print '<br /><div align="right"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
@ -267,33 +271,29 @@ if ($result) {
|
||||
print $msg;
|
||||
}
|
||||
|
||||
// print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td> ';
|
||||
// print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "p.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print ' ';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||
} else {
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||
}
|
||||
// print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>');
|
||||
/*
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print_liste_field_titre($langs->trans("Accountancy_code_buy"));
|
||||
} else {
|
||||
print_liste_field_titre($langs->trans("Accountancy_code_sell"));
|
||||
}
|
||||
*/
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"));
|
||||
print_liste_field_titre($langs->trans("Modify") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<td class=liste_titre"> </td>';
|
||||
print '<td align="center" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
@ -346,13 +346,12 @@ if ($result) {
|
||||
// TODO ADJUST DESCRIPTION SIZE
|
||||
// print '<td align="left">' . $obj->description . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
|
||||
// acountingaccount buy
|
||||
|
||||
// Accounting account buy
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||
// print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||
// TODO: replace by select
|
||||
// print '<td align="left">' . $compta_prodbuy . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
@ -361,9 +360,8 @@ if ($result) {
|
||||
print $form->select_account($compta_prodbuy_id, 'codeventil_' . $product_static->id, 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
|
||||
// acountingaccount sel
|
||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||
// Accounting account sell
|
||||
// print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||
// TODO: replace by select
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
@ -380,7 +378,7 @@ if ($result) {
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Change_Account") . '"></div>';
|
||||
print '<br><div align="right"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Validate") . '"></div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -74,6 +74,7 @@ if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
/* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -92,13 +92,15 @@ class FormVentilation extends Form
|
||||
* @param array $event Event options
|
||||
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase set accountingaccount base class to display empty=all or from 1 to 8 will display only account beginning by
|
||||
* @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
@ -123,7 +125,7 @@ class FormVentilation extends Form
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->account_number . ' - ' . $obj->label;
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
if ($select_in == 0)
|
||||
$select_value_in = $obj->rowid;
|
||||
@ -133,7 +135,7 @@ class FormVentilation extends Form
|
||||
$select_value_out = $obj->rowid;
|
||||
if ($select_out == 1)
|
||||
$select_value_out = $obj->account_number;
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
|
||||
|
||||
@ -518,7 +518,8 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("FinanceJournal"));
|
||||
|
||||
@ -111,7 +111,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
|
||||
@ -54,7 +54,7 @@ $langs->load("companies");
|
||||
|
||||
$memberstatic=new Adherent($db);
|
||||
|
||||
llxHeader('','','','',0,0,array('http://www.google.com/jsapi'));
|
||||
llxHeader('',$langs->trans("MembersStatisticsByProperties"),'','',0,0,array('http://www.google.com/jsapi'));
|
||||
|
||||
$title=$langs->trans("MembersStatisticsByProperties");
|
||||
|
||||
|
||||
@ -55,7 +55,6 @@ $langs->load("companies");
|
||||
|
||||
$arrayjs=array('http://www.google.com/jsapi');
|
||||
if (! empty($conf->dol_use_jmobile)) $arrayjs=array();
|
||||
llxHeader('','','','',0,0,$arrayjs);
|
||||
|
||||
$title=$langs->trans("Statistics");
|
||||
if ($mode == 'memberbycountry') $title=$langs->trans("MembersStatisticsByCountries");
|
||||
@ -63,6 +62,7 @@ if ($mode == 'memberbystate') $title=$langs->trans("MembersStatisticsByState");
|
||||
if ($mode == 'memberbytown') $title=$langs->trans("MembersStatisticsByTown");
|
||||
if ($mode == 'memberbyregion') $title=$langs->trans("MembersStatisticsByRegion");
|
||||
|
||||
llxHeader('', $title,'','',0,0,$arrayjs);
|
||||
|
||||
print load_fiche_titre($title, $mesg);
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ print '</td></tr>';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print $langs->trans("DefaultLink").'</td><td>';
|
||||
print '<input size="92" type="text" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
|
||||
print '<input style="width: 90%" type="text" name="CLICKTODIAL_URL"'.($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'"><br>';
|
||||
print '<br>';
|
||||
print $langs->trans("ClickToDialUrlDesc").'<br>';
|
||||
print $langs->trans("Example").':<br>http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__';
|
||||
|
||||
@ -39,7 +39,13 @@ $modules=array(
|
||||
'img' => 'action'
|
||||
)
|
||||
),
|
||||
'propal' => array(
|
||||
'projet' => array(
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_TASKS_TODO',
|
||||
'img' => 'task'
|
||||
)
|
||||
),
|
||||
'propal' => array(
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_PROPALS_TO_CLOSE',
|
||||
'img' => 'propal'
|
||||
|
||||
@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$langs->load("admin");
|
||||
@ -588,6 +590,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
@ -1310,6 +1315,9 @@ if ($id)
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
@ -1463,6 +1471,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
@ -1591,6 +1600,20 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
|
||||
print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
@ -1599,9 +1622,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='accountancy_code') $size='size="10" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_sell') $size='size="10" ';
|
||||
if ($fieldlist[$field]=='accountancy_code_buy') $size='size="10" ';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
@ -26,6 +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';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("salaries");
|
||||
@ -75,6 +76,7 @@ if ($action == 'update')
|
||||
llxHeader('',$langs->trans('SalariesSetup'));
|
||||
|
||||
$form = new Form($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans('SalariesSetup'),$linkback,'title_setup');
|
||||
@ -105,7 +107,14 @@ foreach ($list as $key)
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -115,7 +124,7 @@ print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -26,7 +26,8 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.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';
|
||||
|
||||
$langs->load('admin');
|
||||
|
||||
@ -112,6 +113,7 @@ if ($action == 'update') {
|
||||
|
||||
llxHeader();
|
||||
$form=new Form($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup');
|
||||
@ -212,7 +214,14 @@ foreach ($list as $key)
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 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
|
||||
@ -106,6 +107,10 @@ $dump_buffer_len = 0;
|
||||
$time_start = time();
|
||||
|
||||
|
||||
$outputdir = $conf->admin->dir_output.'/backup';
|
||||
$result=dol_mkdir($outputdir);
|
||||
|
||||
|
||||
// MYSQL
|
||||
if ($what == 'mysql')
|
||||
{
|
||||
@ -115,7 +120,6 @@ if ($what == 'mysql')
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_MYSQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
$outputdir = $conf->admin->dir_output.'/backup';
|
||||
$outputfile = $outputdir.'/'.$file;
|
||||
// for compression format, we add extension
|
||||
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
|
||||
@ -184,8 +188,6 @@ if ($what == 'mysql')
|
||||
|
||||
$errormsg='';
|
||||
|
||||
$result=dol_mkdir($outputdir);
|
||||
|
||||
// Debut appel methode execution
|
||||
$fullcommandcrypted=$command." ".$paramcrypted." 2>&1";
|
||||
$fullcommandclear=$command." ".$paramclear." 2>&1";
|
||||
@ -253,7 +255,6 @@ if ($what == 'mysql')
|
||||
|
||||
if ($what == 'mysqlnobin')
|
||||
{
|
||||
$outputdir = $conf->admin->dir_output.'/backup';
|
||||
$outputfile = $outputdir.'/'.$file;
|
||||
$outputfiletemp = $outputfile.'-TMP.sql';
|
||||
// for compression format, we add extension
|
||||
@ -287,7 +288,6 @@ if ($what == 'postgresql')
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
$outputdir = $conf->admin->dir_output.'/backup';
|
||||
$outputfile = $outputdir.'/'.$file;
|
||||
// for compression format, we add extension
|
||||
$compression=GETPOST('compression') ? GETPOST('compression','alpha') : 'none';
|
||||
@ -298,7 +298,7 @@ if ($what == 'postgresql')
|
||||
|
||||
// Parameteres execution
|
||||
$command=$cmddump;
|
||||
if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command); // Use quotes on command
|
||||
if (preg_match("/\s/",$command)) $command=escapeshellarg($command); // Use quotes on command
|
||||
|
||||
//$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass);
|
||||
//$param="-F c";
|
||||
@ -351,38 +351,34 @@ if ($what == 'postgresql')
|
||||
|
||||
|
||||
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
|
||||
// Si on a demande une generation
|
||||
//if ($what)
|
||||
//{
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
$resultstring='';
|
||||
$resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
||||
|
||||
$resultstring='';
|
||||
$resultstring.='<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
|
||||
$_SESSION["commandbackupresult"]=$resultstring;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($what)
|
||||
{
|
||||
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
|
||||
|
||||
$resultstring='<div class="ok">';
|
||||
$resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||
$resultstring.=$langs->trans("YouCanDownloadBackupFile");
|
||||
$resultstring.='<div>';
|
||||
|
||||
$_SESSION["commandbackupresult"]=$resultstring;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($what)
|
||||
{
|
||||
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
|
||||
setEventMessages($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
$resultstring='<div class="ok">';
|
||||
$resultstring.=$langs->trans("BackupFileSuccessfullyCreated").'.<br>';
|
||||
$resultstring.=$langs->trans("YouCanDownloadBackupFile");
|
||||
$resultstring.='<div>';
|
||||
|
||||
$_SESSION["commandbackupresult"]=$resultstring;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("YouMustRunCommandFromCommandLineAfterLoginToUser",$dolibarr_main_db_user,$dolibarr_main_db_user), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
/*
|
||||
$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1);
|
||||
@ -417,8 +413,14 @@ function backup_tables($outputfile, $tables='*')
|
||||
global $errormsg;
|
||||
|
||||
// Set to UTF-8
|
||||
$db->query('SET NAMES utf8');
|
||||
$db->query('SET CHARACTER SET utf8');
|
||||
if(is_a($db, 'DoliDBMysqli')) {
|
||||
/** @var DoliDBMysqli $db */
|
||||
$db->db->set_charset('utf8');
|
||||
} else {
|
||||
/** @var DoliDB $db */
|
||||
$db->query('SET NAMES utf8');
|
||||
$db->query('SET CHARACTER SET utf8');
|
||||
}
|
||||
|
||||
//get all of the tables
|
||||
if ($tables == '*')
|
||||
|
||||
@ -48,62 +48,11 @@ if (! empty($conf->syslog->enabled))
|
||||
*/
|
||||
if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allfiles' || $confirm == 'yes') )
|
||||
{
|
||||
$filesarray=array();
|
||||
|
||||
if ($choice=='tempfiles')
|
||||
{
|
||||
// Delete temporary files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"directories",1,'^temp$');
|
||||
}
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
|
||||
$utils = new Utils($db);
|
||||
$result = $utils->purgeFiles($choice);
|
||||
|
||||
if ($choice=='allfiles')
|
||||
{
|
||||
// Delete all files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
|
||||
}
|
||||
}
|
||||
|
||||
if ($choice=='logfile')
|
||||
{
|
||||
$filesarray[]=array('fullname'=>$filelog,'type'=>'file');
|
||||
}
|
||||
|
||||
$count=0;
|
||||
if (count($filesarray))
|
||||
{
|
||||
foreach($filesarray as $key => $value)
|
||||
{
|
||||
//print "x ".$filesarray[$key]['fullname']."<br>\n";
|
||||
if ($filesarray[$key]['type'] == 'dir')
|
||||
{
|
||||
$count+=dol_delete_dir_recursive($filesarray[$key]['fullname']);
|
||||
}
|
||||
elseif ($filesarray[$key]['type'] == 'file')
|
||||
{
|
||||
// If (file that is not logfile) or (if logfile with option logfile)
|
||||
if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile')
|
||||
{
|
||||
$count+=(dol_delete_file($filesarray[$key]['fullname'])?1:0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update cachenbofdoc
|
||||
if (! empty($conf->ecm->enabled) && $choice=='allfiles')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
$ecmdirstatic = new EcmDirectory($db);
|
||||
$result = $ecmdirstatic->refreshcachenboffile(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($count) $mesg=$langs->trans("PurgeNDirectoriesDeleted", $count);
|
||||
else $mesg=$langs->trans("PurgeNothingToDelete");
|
||||
$mesg = $utils->output;
|
||||
setEventMessages($mesg, null, 'mesgs');
|
||||
}
|
||||
|
||||
@ -159,7 +108,7 @@ if (preg_match('/^confirm/i',$choice))
|
||||
{
|
||||
print '<br>';
|
||||
$formquestion=array();
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').' '.img_warning(), 'purge', $formquestion, 'no', 2);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -33,15 +33,73 @@ $langs->load("errors");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST('rowid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$langcode=GETPOST('langcode','alpha');
|
||||
$transkey=GETPOST('transkey','alpha');
|
||||
$transvalue=GETPOST('transvalue','alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
if (empty($langcode))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Language")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($transkey == '')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Key")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($transvalue == '')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Value")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUE ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')";
|
||||
$result = $db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action="";
|
||||
$transkey="";
|
||||
$transvalue="";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete line from delete picto
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".$db->escape($id);
|
||||
$result = $db->query($sql);
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -58,11 +116,121 @@ print $langs->trans("TranslationDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print $langs->trans("CurrentUserLanguage").': <strong>'.$langs->defaultlang.'</strong><br>';
|
||||
print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
|
||||
print '<br>';
|
||||
|
||||
print img_warning().' '.$langs->trans("SomeTranslationAreUncomplete").'<br>';
|
||||
$urlwikitranslatordoc='http://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print $langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a><br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("Value"))."<br>\n";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" id="action" name="action" value="">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Language").'</td>';
|
||||
print '<td>'.$langs->trans("Key").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity) print '<td>'.$langs->trans("Entity").'</td>';
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Line to add new record
|
||||
$var=false;
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'><td><input type="text" class="flat" size="24" name="langcode" value="'.GETPOST('langcode').'"></td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="30" name="transkey" value="">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="40" name="transvalue" value="">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
}
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" name="add">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT";
|
||||
$sql.= " rowid";
|
||||
$sql.= ", lang";
|
||||
$sql.= ", transkey";
|
||||
$sql.= ", transvalue";
|
||||
//$sql.= ", entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
||||
//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
|
||||
//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
||||
//if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name'));
|
||||
//$sql.= " ORDER BY entity, name ASC";
|
||||
$sql.= " ORDER BY lang ASC, transkey ASC";
|
||||
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=false;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "\n";
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
print $obj->transvalue;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
|
||||
993
htdocs/admin/websites.php
Normal file
993
htdocs/admin/websites.php
Normal file
@ -0,0 +1,993 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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/admin/websites.php
|
||||
* \ingroup setup
|
||||
* \brief Page to administer web sites
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load("errors");
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
$langs->load("website");
|
||||
|
||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$id=GETPOST('id','int');
|
||||
$rowid=GETPOST('rowid','alpha');
|
||||
|
||||
$id=1;
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
|
||||
|
||||
$listoffset=GETPOST('listoffset');
|
||||
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
|
||||
$status = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0 ; }
|
||||
$offset = $listlimit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('admin'));
|
||||
|
||||
// This page is a generic page to edit dictionaries
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
$tabname[1] = MAIN_DB_PREFIX."website";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
$tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.shortname, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[1] ="shortname ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[1] = "shortname,description";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[1] = "shortname,description";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[1] = "shortname,description,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid=array();
|
||||
$tabrowid[1] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
$tabcond[1] = (! empty($conf->websites->enabled));
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp[1] = array();
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
$tabfieldcheck[1] = array();
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
|
||||
// Actions add or modify an entry into a dictionary
|
||||
if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
{
|
||||
$listfield=explode(',',$tabfield[$id]);
|
||||
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
|
||||
|
||||
// Check that all fields are filled
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd'))
|
||||
{
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",status)";
|
||||
$sql.= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
if ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if (GETPOST('actioncancel'))
|
||||
{
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_pages WHERE fk_website ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 1 WHERE rowid ='".$rowid."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 0 WHERE rowid ='".$rowid."'";
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$titre=$langs->trans("WebsiteSetup");
|
||||
$linkback='';
|
||||
print load_fiche_titre($titre,$linkback,'title_setup');
|
||||
|
||||
print $langs->trans("WebsiteSetupDesc").'<br>';
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&id='.$id, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete','',0,1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
/*
|
||||
* Show a dictionary
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
|
||||
if ($sortfield)
|
||||
{
|
||||
// If sort order is "country", we use country_code instead
|
||||
$sql.= " ORDER BY ".$sortfield;
|
||||
if ($sortorder)
|
||||
{
|
||||
$sql.=" ".strtoupper($sortorder);
|
||||
}
|
||||
$sql.=", ";
|
||||
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
|
||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
|
||||
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
|
||||
}
|
||||
else {
|
||||
$sql.=" ORDER BY ";
|
||||
}
|
||||
$sql.=$tabsqlsort[$id];
|
||||
$sql.=$db->plimit($listlimit+1,$offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
|
||||
$fieldlist=explode(',',$tabfield[$id]);
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$align="left";
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td align="'.$align.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
|
||||
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
|
||||
else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
}
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td colspan="4">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val))
|
||||
$obj->$val=GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if ($id == 3) unset($fieldlist[2]);
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
||||
}
|
||||
}
|
||||
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td colspan="3" align="right">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+2;
|
||||
if ($id == 4) $colspan++;
|
||||
|
||||
if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
|
||||
{
|
||||
print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
// List of available values in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
if ($num)
|
||||
{
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // Par defaut
|
||||
$align="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
$valuetoshow=$tmp['valuetoshow'];
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
|
||||
else $valuetoshow=$langs->trans("Amount");
|
||||
$align='right';
|
||||
}
|
||||
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
|
||||
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||
{
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
if ($id != 25) $valuetoshow.="*";
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
|
||||
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
|
||||
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); }
|
||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; }
|
||||
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); }
|
||||
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); }
|
||||
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
|
||||
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
|
||||
}
|
||||
}
|
||||
// Favorite - Only activated on country dictionary
|
||||
if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"status",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
$var = ! $var;
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
{
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1;
|
||||
$align="left";
|
||||
$valuetoshow=$obj->$fieldlist[$field];
|
||||
if ($value == 'type_template')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
if ($value == 'element')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
else if ($value == 'source')
|
||||
{
|
||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
||||
}
|
||||
else if ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
}
|
||||
else if ($fieldlist[$field]=='country') {
|
||||
if (empty($obj->country_code))
|
||||
{
|
||||
$valuetoshow='-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key=$langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
}
|
||||
}
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
||||
$valuetoshow=yn($valuetoshow);
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
$valuetoshow=price($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle_facture') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentCondition".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
$valuetoshow=nl2br($valuetoshow);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') {
|
||||
$key=$langs->trans("Country".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') {
|
||||
$langs->load("propal");
|
||||
$key=$langs->trans("AvailabilityType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') {
|
||||
$key=$langs->trans("Action".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') {
|
||||
$key=$langs->trans("Currency".strtoupper($obj->code_iso));
|
||||
$valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') {
|
||||
$key=$langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') {
|
||||
$key=$langs->trans("Civility".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentConditionShort".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
|
||||
$langs->load("bills");
|
||||
$key=$langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
|
||||
$key=$langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') {
|
||||
$langs->load("orders");
|
||||
$key=$langs->trans($obj->code);
|
||||
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field];
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') {
|
||||
$langs->load("sendings");
|
||||
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format')
|
||||
{
|
||||
$key = $langs->trans('PaperFormat'.strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
|
||||
{
|
||||
$langs->load('trips');
|
||||
$key = $langs->trans(strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
}
|
||||
else if ($fieldlist[$field]=='unicode') {
|
||||
$valuetoshow = $langs->getCurrencySymbol($obj->code,1);
|
||||
}
|
||||
else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow=$langs->trans($obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->$fieldlist[$field]);
|
||||
}
|
||||
else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
|
||||
{
|
||||
$key = $langs->trans('SizeUnit'.strtolower($obj->unit));
|
||||
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]);
|
||||
}
|
||||
|
||||
else if ($fieldlist[$field]=='localtax1_type') {
|
||||
if ($obj->localtax1 != 0)
|
||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2_type') {
|
||||
if ($obj->localtax2 != 0)
|
||||
$valuetoshow=$localtax_typeList[$valuetoshow];
|
||||
else
|
||||
$valuetoshow = '';
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax1') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax1 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax2 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
|
||||
{
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
||||
{
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$isdisable=1; // true by default
|
||||
|
||||
if (isset($obj->code) && $id != 10)
|
||||
{
|
||||
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $isdisable = 0; }
|
||||
else if ($obj->code == 'RECEP') { $iserasable = 0; $isdisable = 0; }
|
||||
else if ($obj->code == 'EF0') { $iserasable = 0; $isdisable = 0; }
|
||||
}
|
||||
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $isdisable=0; $isdisable = 0; }
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&';
|
||||
|
||||
// Favorite
|
||||
// Only activated on country dictionary
|
||||
if ($id == 4)
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>';
|
||||
else print $langs->trans("AlwaysActive");
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a href="'.$url.'action='.$acts[$obj->status].'">'.$actl[$obj->status].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
|
||||
else print '<td> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
|
||||
/**
|
||||
* Show fields in insert/edit mode
|
||||
*
|
||||
* @param array $fieldlist Array of fields
|
||||
* @param Object $obj If we show a particular record, obj is filled with record fields
|
||||
* @param string $tabname Name of SQL table
|
||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||
* @return void
|
||||
*/
|
||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
global $bc;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'country')
|
||||
{
|
||||
if (in_array('region_id',$fieldlist))
|
||||
{
|
||||
print '<td>';
|
||||
//print join(',',$fieldlist);
|
||||
print '</td>';
|
||||
continue;
|
||||
} // For state page, we do not show the country input (we link to region, not country)
|
||||
print '<td>';
|
||||
$fieldname='country';
|
||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth300');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id')
|
||||
{
|
||||
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 '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region')
|
||||
{
|
||||
print '<td>';
|
||||
$formcompany->select_region($region_id,'region');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'region_id')
|
||||
{
|
||||
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'lang')
|
||||
{
|
||||
print '<td>';
|
||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de template
|
||||
elseif ($fieldlist[$field] == 'type_template')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('type_template', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'element')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('element', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
// La source de l'element (pour les type de contact)
|
||||
elseif ($fieldlist[$field] == 'source')
|
||||
{
|
||||
print '<td>';
|
||||
print $form->selectarray('source', $sourceList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
|
||||
{
|
||||
print '<td>';
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''),1);
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) {
|
||||
$align="left";
|
||||
if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right
|
||||
print '<td align="'.$align.'">';
|
||||
print '<input type="text" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
|
||||
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
|
||||
}
|
||||
elseif (in_array($fieldlist[$field], array('content')))
|
||||
{
|
||||
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
|
||||
{
|
||||
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
|
||||
}
|
||||
else print '<td>';
|
||||
if ($context != 'hide')
|
||||
{
|
||||
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea>';
|
||||
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%');
|
||||
print $doleditor->Create(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.price((! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldlist[$field])) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
elseif ($fieldlist[$field]=='unit') {
|
||||
print '<td>';
|
||||
$units = array(
|
||||
'mm' => $langs->trans('SizeUnitmm'),
|
||||
'cm' => $langs->trans('SizeUnitcm'),
|
||||
'point' => $langs->trans('SizeUnitpoint'),
|
||||
'inch' => $langs->trans('SizeUnitinch')
|
||||
);
|
||||
print $form->selectarray('unit', $units, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), 0, 0, 0);
|
||||
print '</td>';
|
||||
}
|
||||
// Le type de taxe locale
|
||||
elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type')
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
|
||||
print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size='';
|
||||
if ($fieldlist[$field]=='code') $size='size="8" ';
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,12 +24,19 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
|
||||
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
|
||||
unset($_SESSION['serObjFacturation']);
|
||||
|
||||
$hookmanager->initHooks(array('cashdeskTplTicket'));
|
||||
|
||||
require ('tpl/ticket.tpl.php');
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$obj_facturation);
|
||||
if (empty($reshook))
|
||||
{
|
||||
require ('tpl/ticket.tpl.php');
|
||||
}
|
||||
|
||||
|
||||
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
|
||||
|
||||
@ -896,7 +896,7 @@ class ActionComm extends CommonObject
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$sql = "SELECT a.id, a.datep as dp";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
|
||||
|
||||
@ -1178,14 +1178,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
|
||||
// Line with td contains all div of each events
|
||||
print '<tr height="'.$minheight.'"><td valign="top" colspan="2" class="sortable" style="padding-bottom: 2px;">';
|
||||
print '<div style="width: 100%; position: relative;">';
|
||||
print '<div style="width: 100%; position: relative;">';
|
||||
|
||||
//$curtime = dol_mktime (0, 0, 0, $month, $day, $year);
|
||||
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||
|
||||
$nextindextouse=count($colorindexused); // At first run this is 0, so fist user has 0, next 1, ...
|
||||
//print $nextindextouse;
|
||||
//print $nextindextouse;
|
||||
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
@ -1198,23 +1198,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
{
|
||||
if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA))
|
||||
{
|
||||
$keysofuserassigned=array_keys($event->userassigned);
|
||||
$keysofuserassigned=array_keys($event->userassigned);
|
||||
|
||||
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
|
||||
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
|
||||
|
||||
// Define $color (Hex string like '0088FF') and $cssclass of event
|
||||
$color=-1; $colorindex=-1;
|
||||
if (in_array($user->id, $keysofuserassigned))
|
||||
{
|
||||
$nummytasks++; $cssclass='family_mytasks';
|
||||
if (in_array($user->id, $keysofuserassigned))
|
||||
{
|
||||
$nummytasks++; $cssclass='family_mytasks';
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
@ -1228,7 +1228,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||
}
|
||||
$color=$event->icalcolor;
|
||||
$color=($event->icalcolor?$event->icalcolor:-1);
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
@ -1236,20 +1236,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$numbirthday++; $colorindex=2; $cssclass='family_birthday unmovable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$numother++; $cssclass='family_other';
|
||||
{
|
||||
$numother++;
|
||||
$color=($event->icalcolor?$event->icalcolor:-1);
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
|
||||
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
if (empty($cacheusers[$event->userownerid]))
|
||||
{
|
||||
$newuser=new User($db);
|
||||
$newuser->fetch($event->userownerid);
|
||||
$cacheusers[$event->userownerid]=$newuser;
|
||||
}
|
||||
//var_dump($cacheusers[$event->userownerid]->color);
|
||||
|
||||
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
|
||||
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
|
||||
}
|
||||
}
|
||||
if ($color == -1) // Color was not forced. Set color according to color index.
|
||||
{
|
||||
// Define color index if not yet defined
|
||||
@ -1260,14 +1262,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
}
|
||||
else
|
||||
{
|
||||
$colorindex=$nextindextouse;
|
||||
$colorindexused[$idusertouse]=$colorindex;
|
||||
$colorindex=$nextindextouse;
|
||||
$colorindexused[$idusertouse]=$colorindex;
|
||||
if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
|
||||
}
|
||||
//print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'<br>';
|
||||
// Define color
|
||||
// Define color
|
||||
$color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
}
|
||||
$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
|
||||
// Defined style to disable drag and drop feature
|
||||
|
||||
975
htdocs/comm/action/pertype.php
Normal file
975
htdocs/comm/action/pertype.php
Normal file
@ -0,0 +1,975 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.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
|
||||
* 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/comm/action/pertype.php
|
||||
* \ingroup agenda
|
||||
* \brief Tab of calendar events per type
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
|
||||
|
||||
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
|
||||
|
||||
$filter=GETPOST("filter",'',3);
|
||||
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
$showbirthday = 0;
|
||||
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page","int");
|
||||
if ($page == -1) { $page = 0; }
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="a.datec";
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid","int");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
|
||||
if ($socid < 0) $socid='';
|
||||
|
||||
$canedit=1;
|
||||
if (! $user->rights->agenda->myactions->read) accessforbidden();
|
||||
if (! $user->rights->agenda->allactions->read) $canedit=0;
|
||||
if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no permission to see all, we show only affected to me
|
||||
{
|
||||
$filtert=$user->id;
|
||||
}
|
||||
|
||||
//$action=GETPOST('action','alpha');
|
||||
$action='show_pertype';
|
||||
//$year=GETPOST("year");
|
||||
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
|
||||
$month=GETPOST("month","int")?GETPOST("month","int"):date("m");
|
||||
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
|
||||
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
|
||||
$pid=GETPOST("projectid","int",3);
|
||||
$status=GETPOST("status");
|
||||
$type=GETPOST("type");
|
||||
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('actioncode','array'))
|
||||
{
|
||||
$actioncode=GETPOST('actioncode','array',3);
|
||||
if (! count($actioncode)) $actioncode='0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
|
||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
||||
if ($dateselect > 0)
|
||||
{
|
||||
$day=GETPOST('dateselectday');
|
||||
$month=GETPOST('dateselectmonth');
|
||||
$year=GETPOST('dateselectyear');
|
||||
}
|
||||
|
||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||
$tmparray=explode('-',$tmp);
|
||||
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
|
||||
if ($end_h < 1 || $end_h > 24) $end_h = 18;
|
||||
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
|
||||
|
||||
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
|
||||
$tmparray=explode('-',$tmp);
|
||||
$begin_d = 1;
|
||||
$end_d = 53;
|
||||
|
||||
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
|
||||
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
|
||||
|
||||
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
|
||||
$action='show_month'; $day='';
|
||||
} // View by month
|
||||
if (GETPOST('viewweek') || $action == 'show_week') {
|
||||
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
|
||||
} // View by week
|
||||
if (GETPOST('viewday') || $action == 'show_day') {
|
||||
$action='show_day'; $day=($day?$day:date("d"));
|
||||
} // View by day
|
||||
if (GETPOST('viewyear') || $action == 'show_year') {
|
||||
$action='show_year';
|
||||
} // View by year
|
||||
|
||||
|
||||
$langs->load("users");
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
$langs->load("commercial");
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('agenda'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action =='delete_action')
|
||||
{
|
||||
$event = new ActionComm($db);
|
||||
$event->fetch($actionid);
|
||||
$result=$event->delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
$form=new Form($db);
|
||||
$companystatic=new Societe($db);
|
||||
|
||||
$now=dol_now();
|
||||
$nowarray=dol_getdate($now);
|
||||
$nowyear=$nowarray['year'];
|
||||
$nowmonth=$nowarray['mon'];
|
||||
$nowday=$nowarray['mday'];
|
||||
|
||||
|
||||
// Define list of all external calendars (global setup)
|
||||
$listofextcals=array();
|
||||
|
||||
$prev = dol_get_first_day($year, $month);
|
||||
$first_day = 1;
|
||||
$first_month = 1;
|
||||
$first_year = $year;
|
||||
|
||||
$week = $prev['week'];
|
||||
|
||||
$day = (int) $day;
|
||||
$next = dol_get_next_day($day, $month, $year);
|
||||
$next_year = year + 1;
|
||||
$next_month = $month;
|
||||
$next_day = $day;
|
||||
|
||||
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
||||
|
||||
$tmpday = $first_day;
|
||||
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
|
||||
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
|
||||
|
||||
$title=$langs->trans("DoneAndToDoActions");
|
||||
if ($status == 'done') $title=$langs->trans("DoneActions");
|
||||
if ($status == 'todo') $title=$langs->trans("ToDoActions");
|
||||
|
||||
$param='';
|
||||
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode;
|
||||
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status;
|
||||
if ($filter) $param.="&filter=".$filter;
|
||||
if ($filtert) $param.="&filtert=".$filtert;
|
||||
if ($usergroup) $param.="&usergroup=".$usergroup;
|
||||
if ($socid) $param.="&socid=".$socid;
|
||||
if ($showbirthday) $param.="&showbirthday=1";
|
||||
if ($pid) $param.="&projectid=".$pid;
|
||||
if ($type) $param.="&type=".$type;
|
||||
if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser' || $action != 'show_pertype') $param.='&action='.$action;
|
||||
$param.="&maxprint=".$maxprint;
|
||||
|
||||
$prev = dol_get_first_day($year, 1);
|
||||
$prev_year = $year - 1;
|
||||
$prev_month = $month;
|
||||
$prev_day = $day;
|
||||
$first_day = 1;
|
||||
$first_month= 1;
|
||||
$first_year = $year;
|
||||
|
||||
$week = $prev['week'];
|
||||
|
||||
$day = (int) $day;
|
||||
$next = dol_get_next_day(31, 12, $year);
|
||||
$next_year = $year + 1;
|
||||
$next_month = $month;
|
||||
$next_day = $day;
|
||||
|
||||
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
|
||||
$firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year);
|
||||
$lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
|
||||
//print $firstday.'-'.$first_month.'-'.$first_year;
|
||||
//print dol_print_date($firstdaytoshow,'dayhour');
|
||||
//print dol_print_date($lastdaytoshow,'dayhour');
|
||||
|
||||
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year));
|
||||
|
||||
$tmpday = $first_day;
|
||||
|
||||
$nav ="<a href=\"?year=".$prev_year."&month=".$prev_month."&day=".$prev_day.$param."\">".img_previous($langs->trans("Previous"))."</a>\n";
|
||||
$nav.=" <span id=\"month_name\">".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y")."</span> \n";
|
||||
$nav.="<a href=\"?year=".$next_year."&month=".$next_month."&day=".$next_day.$param."\">".img_next($langs->trans("Next"))."</a>\n";
|
||||
$nav.=" (<a href=\"?year=".$nowyear."&month=".$nowmonth."&day=".$nowday.$param."\">".$langs->trans("Today")."</a>)";
|
||||
$picto='calendarweek';
|
||||
|
||||
$nav.=' <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
|
||||
$nav.='<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
$nav.='<input type="hidden" name="action" value="' . $action . '">';
|
||||
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
|
||||
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
|
||||
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
|
||||
$nav.='<input type="hidden" name="status" value="' . $status . '">';
|
||||
$nav.='<input type="hidden" name="socid" value="' . $socid . '">';
|
||||
$nav.='<input type="hidden" name="projectid" value="' . $projectid . '">';
|
||||
$nav.='<input type="hidden" name="begin_h" value="' . $begin_h . '">';
|
||||
$nav.='<input type="hidden" name="end_h" value="' . $end_h . '">';
|
||||
$nav.='<input type="hidden" name="begin_d" value="' . $begin_d . '">';
|
||||
$nav.='<input type="hidden" name="end_d" value="' . $end_d . '">';
|
||||
$nav.='<input type="hidden" name="showbirthday" value="' . $showbirthday . '">';
|
||||
|
||||
$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
|
||||
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
$nav.='</form>';
|
||||
|
||||
// Must be after the nav definition
|
||||
$param.='&year='.$year.'&month='.$month.($day?'&day='.$day:'');
|
||||
//print 'x'.$param;
|
||||
|
||||
|
||||
|
||||
|
||||
$tabactive='cardpertype';
|
||||
|
||||
$paramnoaction=preg_replace('/action=[a-z_]+/','',$param);
|
||||
|
||||
$head = calendars_prepare_head($paramnoaction);
|
||||
|
||||
dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
|
||||
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup);
|
||||
dol_fiche_end();
|
||||
|
||||
$showextcals=$listofextcals;
|
||||
// Legend
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
$s='';
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.='jQuery("#check_mytasks").click(function() { jQuery(".family_mytasks").toggle(); jQuery(".family_other").toggle(); });' . "\n";
|
||||
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
$s.='jQuery(".family_birthday").toggle();' . "\n";
|
||||
if ($action=="show_week" || $action=="show_month" || empty($action))
|
||||
{
|
||||
$s.='jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
|
||||
$s.='var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
|
||||
}
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
{
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = md5($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_ext' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_ext' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked> ' . $val ['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
|
||||
//$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||
|
||||
// Calendars from hooks
|
||||
$parameters=array(); $object=null;
|
||||
$reshook=$hookmanager->executeHooks('addCalendarChoice',$parameters,$object,$action);
|
||||
if (empty($reshook))
|
||||
{
|
||||
$s.= $hookmanager->resPrint;
|
||||
}
|
||||
elseif ($reshook > 1)
|
||||
{
|
||||
$s = $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$link='';
|
||||
print load_fiche_titre($s, $link.' '.$nav, '');
|
||||
|
||||
|
||||
// Get event in an array
|
||||
$eventarray=array();
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($usergroup > 0) $sql.=" DISTINCT";
|
||||
$sql.= ' a.id, a.label,';
|
||||
$sql.= ' a.datep,';
|
||||
$sql.= ' a.datep2,';
|
||||
$sql.= ' a.percent,';
|
||||
$sql.= ' a.fk_user_author,a.fk_user_action,';
|
||||
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
|
||||
$sql.= ' ca.code, ca.color';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid;
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0) $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($action == 'show_day')
|
||||
{
|
||||
$sql.= " AND (";
|
||||
$sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
|
||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
|
||||
$sql.= " OR ";
|
||||
$sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
|
||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
|
||||
$sql.= " OR ";
|
||||
$sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,$day,$year))."'";
|
||||
$sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,$day,$year))."')";
|
||||
$sql.= ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
// To limit array
|
||||
$sql.= " AND (";
|
||||
$sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,1,1,$year)-(60*60*24*7))."'"; // Start 7 days before
|
||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,12,31,$year)+(60*60*24*7))."')"; // End 7 days after
|
||||
$sql.= " OR ";
|
||||
$sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,1,1,$year)-(60*60*24*7))."'";
|
||||
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,12,31,$year)+(60*60*24*7))."')";
|
||||
$sql.= " OR ";
|
||||
$sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,12,1,$year)-(60*60*24*7))."'";
|
||||
$sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,12,31,$year)+(60*60*24*7))."')";
|
||||
$sql.= ')';
|
||||
}
|
||||
if ($type) $sql.= " AND ca.id = ".$type;
|
||||
if ($status == '0') { $sql.= " AND a.percent = 0"; }
|
||||
if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable
|
||||
if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started
|
||||
if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; }
|
||||
if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; }
|
||||
// We must filter on assignement table
|
||||
if ($filtert > 0 || $usergroup > 0)
|
||||
{
|
||||
$sql.= " AND (";
|
||||
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
|
||||
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
|
||||
$sql.= ")";
|
||||
}
|
||||
// Sort on date
|
||||
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/index.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i=0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Discard auto action if option is on
|
||||
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO')
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a new object action
|
||||
$event=new ActionComm($db);
|
||||
$event->id=$obj->id;
|
||||
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
||||
$event->datef=$db->jdate($obj->datep2);
|
||||
$event->type_code=$obj->code;
|
||||
$event->type_color=$obj->color;
|
||||
//$event->libelle=$obj->label; // deprecated
|
||||
$event->label=$obj->label;
|
||||
$event->percentage=$obj->percent;
|
||||
//$event->author->id=$obj->fk_user_author; // user id of creator
|
||||
$event->authorid=$obj->fk_user_author; // user id of creator
|
||||
$event->userownerid=$obj->fk_user_action; // user id of owner
|
||||
$event->fetch_userassigned(); // This load $event->userassigned
|
||||
$event->priority=$obj->priority;
|
||||
$event->fulldayevent=$obj->fulldayevent;
|
||||
$event->location=$obj->location;
|
||||
$event->transparency=$obj->transparency;
|
||||
|
||||
$event->socid=$obj->fk_soc;
|
||||
$event->contactid=$obj->fk_contact;
|
||||
//$event->societe->id=$obj->fk_soc; // deprecated
|
||||
//$event->contact->id=$obj->fk_contact; // deprecated
|
||||
|
||||
$event->fk_element=$obj->fk_element;
|
||||
$event->elementtype=$obj->elementtype;
|
||||
|
||||
// Defined date_start_in_calendar and date_end_in_calendar property
|
||||
// They are date start and end of action but modified to not be outside calendar view.
|
||||
if ($event->percentage <= 0)
|
||||
{
|
||||
$event->date_start_in_calendar=$event->datep;
|
||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
||||
else $event->date_end_in_calendar=$event->datep;
|
||||
}
|
||||
else
|
||||
{
|
||||
$event->date_start_in_calendar=$event->datep;
|
||||
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
|
||||
else $event->date_end_in_calendar=$event->datep;
|
||||
}
|
||||
// Define ponctual property
|
||||
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
|
||||
{
|
||||
$event->ponctuel=1;
|
||||
}
|
||||
|
||||
// Check values
|
||||
if ($event->date_end_in_calendar < $firstdaytoshow ||
|
||||
$event->date_start_in_calendar >= $lastdaytoshow)
|
||||
{
|
||||
// This record is out of visible range
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
|
||||
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
|
||||
|
||||
// Add an entry in actionarray for each day
|
||||
$daycursor=$event->date_start_in_calendar;
|
||||
$annee = date('Y',$daycursor);
|
||||
$mois = date('m',$daycursor);
|
||||
$jour = date('d',$daycursor);
|
||||
|
||||
// Loop on each day covered by action to prepare an index to show on calendar
|
||||
$loop=true; $j=0;
|
||||
$daykey=dol_mktime(0,0,0,$mois,$jour,$annee);
|
||||
do
|
||||
{
|
||||
//if ($event->id==408) print 'daykey='.$daykey.' '.$event->datep.' '.$event->datef.'<br>';
|
||||
|
||||
$eventarray[$daykey][]=$event;
|
||||
$j++;
|
||||
|
||||
$daykey+=60*60*24;
|
||||
if ($daykey > $event->date_end_in_calendar) $loop=false;
|
||||
}
|
||||
while ($loop);
|
||||
|
||||
//print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef);
|
||||
//print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array<br>';
|
||||
}
|
||||
$i++;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$maxnbofchar=18;
|
||||
$cachethirdparties=array();
|
||||
$cachecontacts=array();
|
||||
|
||||
// Define theme_datacolor array
|
||||
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
|
||||
if (is_readable($color_file))
|
||||
{
|
||||
include_once $color_file;
|
||||
}
|
||||
if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), array(200,160,180), array(190,190,220));
|
||||
|
||||
|
||||
$newparam=$param; // newparam is for birthday links
|
||||
$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done
|
||||
$newparam=preg_replace('/action=show_month&?/i','',$newparam);
|
||||
$newparam=preg_replace('/action=show_week&?/i','',$newparam);
|
||||
$newparam=preg_replace('/day=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/month=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/viewweek=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter
|
||||
$newparam.='&viewweek=1';
|
||||
|
||||
echo '<form id="move_event" action="" method="POST"><input type="hidden" name="action" value="mupdate">';
|
||||
echo '<input type="hidden" name="backtopage" value="'.$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'">';
|
||||
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
echo '<input type="hidden" name="newdate" id="newdate">' ;
|
||||
echo '</form>';
|
||||
|
||||
|
||||
// Line header with list of days
|
||||
|
||||
//print "begin_d=".$begin_d." end_d=".$end_d;
|
||||
|
||||
|
||||
echo '<table width="100%" class="nocellnopadd cal_month">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td></td>';
|
||||
$i=0; // 0 = sunday,
|
||||
echo '<td align="center" colspan="'.($end_d - $begin_d).'">';
|
||||
echo $langs->trans("Year");
|
||||
print "<br>";
|
||||
print $year;
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td></td>';
|
||||
$i=0;
|
||||
for ($h = $begin_d; $h < $end_d; $h++)
|
||||
{
|
||||
echo '<td align="center">';
|
||||
print '<small style="font-family: courier">'.sprintf("%02d",$h).'</small>';
|
||||
print "</td>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
$typeofevents=array();
|
||||
|
||||
// Load array of colors by type
|
||||
$colorsbytype=array();
|
||||
$labelbytype=array();
|
||||
$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm";
|
||||
$resql=$db->query($sql);
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$colorsbytype[$obj->code]=$obj->color;
|
||||
$labelbytype[$obj->code]=$obj->libelle;
|
||||
}
|
||||
|
||||
// Loop on each user to show calendar
|
||||
$todayarray=dol_getdate($now,'fast');
|
||||
$sav = $tmpday;
|
||||
$showheader = true;
|
||||
$var = false;
|
||||
foreach ($typeofevents as $typeofevent)
|
||||
{
|
||||
$var = ! $var;
|
||||
echo "<tr>";
|
||||
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">' . $username->getNomUrl(1). '</td>';
|
||||
$tmpday = $sav;
|
||||
|
||||
// Lopp on each day of week
|
||||
$i = 0;
|
||||
for ($iter_day = 0; $iter_day < 8; $iter_day++)
|
||||
{
|
||||
if (($i + 1) < $begin_d || ($i + 1) > $end_d)
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show days of the current week
|
||||
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd');
|
||||
$tmparray = dol_getdate($curtime,'fast');
|
||||
$tmpday = $tmparray['mday'];
|
||||
$tmpmonth = $tmparray['mon'];
|
||||
$tmpyear = $tmparray['year'];
|
||||
|
||||
$style='cal_current_month';
|
||||
if ($iter_day == 6) $style.=' cal_other_month';
|
||||
$today=0;
|
||||
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, $var);
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo "</tr>\n";
|
||||
$showheader = false;
|
||||
}
|
||||
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
$langs->load("commercial");
|
||||
print '<br>'.$langs->trans("Legend").': <br>';
|
||||
foreach($colorsbytype as $code => $color)
|
||||
{
|
||||
if ($color)
|
||||
{
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color?'background: #'.$color.';':'').'width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code];
|
||||
//print $code;
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
//$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]);
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("Other");
|
||||
print '</div>';
|
||||
/* TODO Show this if at least one cumulated event
|
||||
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #222222; width:16px; float: left; margin-right: 4px;"> </div>';
|
||||
print $langs->trans("SeveralEvents");
|
||||
print '</div>';
|
||||
*/
|
||||
}
|
||||
|
||||
// Add js code to manage click on a box
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery(".onclickopenref").click(function() {
|
||||
var ref=$(this).attr(\'ref\');
|
||||
var res = ref.split("_");
|
||||
var userid = res[1];
|
||||
var year = res[2];
|
||||
var month = res[3];
|
||||
var day = res[4];
|
||||
var hour = res[5];
|
||||
var min = res[6];
|
||||
var ids = res[7];
|
||||
if (ids == \'none\') /* No event */
|
||||
{
|
||||
/* alert(\'no event\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=create&assignedtouser="+userid+"&datep="+year+month+day+hour+min+"00&backtopage='.urlencode($_SERVER["PHP_SELF"].'?year='.$year.'&month='.$month.'&day='.$day).'"
|
||||
window.location.href = url;
|
||||
}
|
||||
else if (ids.indexOf(",") > -1) /* There is several events */
|
||||
{
|
||||
/* alert(\'several events\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
|
||||
window.location.href = url;
|
||||
}
|
||||
else /* One event */
|
||||
{
|
||||
/* alert(\'one event\'); */
|
||||
url = "'.DOL_URL_ROOT.'/comm/action/card.php?action=view&id="+ids
|
||||
window.location.href = url;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show event line of a particular day for a user
|
||||
*
|
||||
* @param string $username Login
|
||||
* @param int $day Day
|
||||
* @param int $month Month
|
||||
* @param int $year Year
|
||||
* @param int $monthshown Current month shown in calendar view
|
||||
* @param string $style Style to use for this day
|
||||
* @param array $eventarray Array of events
|
||||
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
|
||||
* @param int $maxnbofchar Nb of characters to show for event line
|
||||
* @param string $newparam Parameters on current URL
|
||||
* @param int $showinfo Add extended information (used by day view)
|
||||
* @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 bool $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(), $var=false)
|
||||
{
|
||||
global $db;
|
||||
global $user, $conf, $langs, $hookmanager, $action;
|
||||
global $filter, $filtert, $status, $actioncode; // Filters used into search form
|
||||
global $theme_datacolor; // Array with a list of different we can use (come from theme)
|
||||
global $cachethirdparties, $cachecontacts, $colorindexused;
|
||||
global $begin_h, $end_h;
|
||||
|
||||
$cases1 = array(); // Color first half hour
|
||||
$cases2 = array(); // Color second half hour
|
||||
|
||||
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
|
||||
|
||||
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
|
||||
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
|
||||
|
||||
$nextindextouse=count($colorindexused); // At first run, this is 0, so fist user has 0, next 1, ...
|
||||
//if ($username->id && $day==1) var_dump($eventarray);
|
||||
|
||||
// We are in a particular day for $username, now we scan all events
|
||||
foreach ($eventarray as $daykey => $notused)
|
||||
{
|
||||
$annee = date('Y',$daykey);
|
||||
$mois = date('m',$daykey);
|
||||
$jour = date('d',$daykey);
|
||||
//print $annee.'-'.$mois.'-'.$jour.' '.$year.'-'.$month.'-'.$day."<br>\n";
|
||||
|
||||
if ($day==$jour && $month==$mois && $year==$annee) // Is it the day we are looking for when calling function ?
|
||||
{
|
||||
// Scan all event for this date
|
||||
foreach ($eventarray[$daykey] as $index => $event)
|
||||
{
|
||||
//var_dump($event);
|
||||
|
||||
$keysofuserassigned=array_keys($event->userassigned);
|
||||
if (! in_array($username->id,$keysofuserassigned)) continue; // We discard record if event is from another user than user we want to show
|
||||
//if ($username->id != $event->userownerid) continue; // We discard record if event is from another user than user we want to show
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('formatEvent',$parameters,$event,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
$ponct=($event->date_start_in_calendar == $event->date_end_in_calendar);
|
||||
|
||||
// Define $color (Hex string like '0088FF') and $cssclass of event
|
||||
$color=-1; $cssclass=''; $colorindex=-1;
|
||||
if (in_array($user->id, $keysofuserassigned))
|
||||
{
|
||||
$nummytasks++; $cssclass='family_mytasks';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color=$event->type_color;
|
||||
}
|
||||
else if ($event->type_code == 'ICALEVENT')
|
||||
{
|
||||
$numical++;
|
||||
if (! empty($event->icalname))
|
||||
{
|
||||
if (! isset($numicals[dol_string_nospecial($event->icalname)])) {
|
||||
$numicals[dol_string_nospecial($event->icalname)] = 0;
|
||||
}
|
||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||
}
|
||||
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unsortable');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
$numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$numother++; $cssclass='family_other';
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color=$event->type_color;
|
||||
}
|
||||
|
||||
if ($color < 0) // Color was not forced. Set color according to color index.
|
||||
{
|
||||
// Define color index if not yet defined
|
||||
$idusertouse=($event->userownerid?$event->userownerid:0);
|
||||
if (isset($colorindexused[$idusertouse]))
|
||||
{
|
||||
$colorindex=$colorindexused[$idusertouse]; // Color already assigned to this user
|
||||
}
|
||||
else
|
||||
{
|
||||
$colorindex=$nextindextouse;
|
||||
$colorindexused[$idusertouse]=$colorindex;
|
||||
if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color
|
||||
}
|
||||
// Define color
|
||||
$color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]);
|
||||
}
|
||||
//$cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd;
|
||||
|
||||
// Define all rects with event (cases1 is first half hour, cases2 is second half hour)
|
||||
for ($h = $begin_h; $h < $end_h; $h++)
|
||||
{
|
||||
//if ($username->id == 1 && $day==1) print 'h='.$h;
|
||||
$newcolor = ''; //init
|
||||
if (empty($event->fulldayevent))
|
||||
{
|
||||
$a = dol_mktime((int) $h,0,0,$month,$day,$year,false,0);
|
||||
$b = dol_mktime((int) $h,30,0,$month,$day,$year,false,0);
|
||||
$c = dol_mktime((int) $h+1,0,0,$month,$day,$year,false,0);
|
||||
|
||||
$dateendtouse=$event->date_end_in_calendar;
|
||||
if ($dateendtouse==$event->date_start_in_calendar) $dateendtouse++;
|
||||
|
||||
//print dol_print_date($event->date_start_in_calendar,'dayhour').'-'.dol_print_date($a,'dayhour').'-'.dol_print_date($b,'dayhour').'<br>';
|
||||
|
||||
if ($event->date_start_in_calendar < $b && $dateendtouse > $a)
|
||||
{
|
||||
$busy=$event->transparency;
|
||||
$cases1[$h][$event->id]['busy']=$busy;
|
||||
$cases1[$h][$event->id]['string']=dol_print_date($event->date_start_in_calendar,'dayhour');
|
||||
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
|
||||
{
|
||||
$tmpa=dol_getdate($event->date_start_in_calendar,true);
|
||||
$tmpb=dol_getdate($event->date_end_in_calendar,true);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
|
||||
else $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
|
||||
}
|
||||
$cases1[$h][$event->id]['string'].=' - '.$event->label;
|
||||
$cases1[$h][$event->id]['typecode']=$event->type_code;
|
||||
if ($event->socid)
|
||||
{
|
||||
//$cases1[$h][$event->id]['string'].='xxx';
|
||||
}
|
||||
$cases1[$h][$event->id]['color']=$color;
|
||||
}
|
||||
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
|
||||
{
|
||||
$busy=$event->transparency;
|
||||
$cases2[$h][$event->id]['busy']=$busy;
|
||||
$cases2[$h][$event->id]['string']=dol_print_date($event->date_start_in_calendar,'dayhour');
|
||||
if ($event->date_end_in_calendar && $event->date_end_in_calendar != $event->date_start_in_calendar)
|
||||
{
|
||||
$tmpa=dol_getdate($event->date_start_in_calendar,true);
|
||||
$tmpb=dol_getdate($event->date_end_in_calendar,true);
|
||||
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
|
||||
else $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
|
||||
}
|
||||
$cases2[$h][$event->id]['string'].=' - '.$event->label;
|
||||
$cases2[$h][$event->id]['typecode']=$event->type_code;
|
||||
if ($event->socid)
|
||||
{
|
||||
//$cases2[$h][$event->id]['string'].='xxx';
|
||||
}
|
||||
$cases2[$h][$event->id]['color']=$color;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$busy=$event->transparency;
|
||||
$cases1[$h][$event->id]['busy']=$busy;
|
||||
$cases2[$h][$event->id]['busy']=$busy;
|
||||
$cases1[$h][$event->id]['string']=$event->label;
|
||||
$cases2[$h][$event->id]['string']=$event->label;
|
||||
$cases1[$h][$event->id]['typecode']=$event->type_code;
|
||||
$cases2[$h][$event->id]['typecode']=$event->type_code;
|
||||
$cases1[$h][$event->id]['color']=$color;
|
||||
$cases2[$h][$event->id]['color']=$color;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
break; // We found the date we were looking for. No need to search anymore.
|
||||
}
|
||||
}
|
||||
|
||||
for ($h = $begin_h; $h < $end_h; $h++)
|
||||
{
|
||||
$color1='';$color2='';
|
||||
$style1='';$style2='';
|
||||
$string1=' ';$string2=' ';
|
||||
$title1='';$title2='';
|
||||
if (isset($cases1[$h]) && $cases1[$h] != '')
|
||||
{
|
||||
//$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases1[$h]) > 1) $title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
$string1=' ';
|
||||
if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) $style1='peruser_notbusy';
|
||||
else $style1='peruser_busy';
|
||||
foreach($cases1[$h] as $id => $ev)
|
||||
{
|
||||
if ($ev['busy']) $style1='peruser_busy';
|
||||
}
|
||||
}
|
||||
if (isset($cases2[$h]) && $cases2[$h] != '')
|
||||
{
|
||||
//$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
if (count($cases2[$h]) > 1) $title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
|
||||
$string2=' ';
|
||||
if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) $style2='peruser_notbusy';
|
||||
else $style2='peruser_busy';
|
||||
foreach($cases2[$h] as $id => $ev)
|
||||
{
|
||||
if ($ev['busy']) $style2='peruser_busy';
|
||||
}
|
||||
}
|
||||
|
||||
$ids1='';$ids2='';
|
||||
if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h]));
|
||||
if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h]));
|
||||
|
||||
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
|
||||
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
|
||||
if (count($cases1[$h]) == 1) // only 1 event
|
||||
{
|
||||
$output = array_slice($cases1[$h], 0, 1);
|
||||
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
|
||||
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
|
||||
if ($output[0]['color']) $color1 = $output[0]['color'];
|
||||
}
|
||||
else if (count($cases1[$h]) > 1)
|
||||
{
|
||||
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
|
||||
$color1='222222';
|
||||
}
|
||||
|
||||
if (count($cases2[$h]) == 1) // only 1 event
|
||||
{
|
||||
$output = array_slice($cases2[$h], 0, 1);
|
||||
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
|
||||
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
|
||||
if ($output[0]['color']) $color2 = $output[0]['color'];
|
||||
}
|
||||
else if (count($cases2[$h]) > 1)
|
||||
{
|
||||
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
|
||||
$color2='222222';
|
||||
}
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
print '<tr><td '.($color1?'style="background: #'.$color1.';"':'').'class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>';
|
||||
print $string1;
|
||||
print '</td><td '.($color2?'style="background: #'.$color2.';"':'').'class="'.($style2?$style2.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_30_'.($ids2?$ids2:'none').'"'.($title2?' title="'.$title2.'"':'').'>';
|
||||
print $string2;
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@ -51,10 +51,10 @@ $result = restrictedArea($user, 'societe',$socid,'');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('','Contacts');
|
||||
llxHeader('',$langs->trans("Contacts"));
|
||||
|
||||
if ($type == "c" || $type == "p")
|
||||
{
|
||||
@ -68,8 +68,7 @@ if ($type == "f")
|
||||
}
|
||||
|
||||
/*
|
||||
* Mode liste
|
||||
*
|
||||
* List mode
|
||||
*/
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, st.libelle as stcomm";
|
||||
|
||||
@ -2116,7 +2116,7 @@ if ($action == 'create')
|
||||
$form_close .= $object->note;
|
||||
$form_close .= '</textarea></td></tr>';
|
||||
$form_close .= '<tr><td align="center" colspan="2">';
|
||||
$form_close .= '<input type="submit" class="button" name="validate" value="' . $langs->trans('Validate') . '">';
|
||||
$form_close .= '<input type="submit" class="button" name="validate" value="' . $langs->trans('Save') . '">';
|
||||
$form_close .= ' <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
|
||||
$form_close .= '<a name="close"> </a>';
|
||||
$form_close .= '</td>';
|
||||
@ -2204,10 +2204,10 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
// Close
|
||||
// Set accepted/refused
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
|
||||
print '>' . $langs->trans('Close') . '</a></div>';
|
||||
print '>' . $langs->trans('SetAcceptedRefused') . '</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
|
||||
@ -2465,7 +2465,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function load_board($user,$mode)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$clause = " WHERE";
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
|
||||
@ -50,8 +51,9 @@ class PropaleStats extends Stats
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user.
|
||||
* @param int $userid Id user for filter (creation user)
|
||||
* @param string $mode Option ('customer', 'supplier')
|
||||
*/
|
||||
function __construct($db, $socid=0, $userid=0)
|
||||
function __construct($db, $socid=0, $userid=0, $mode='customer')
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
@ -59,15 +61,30 @@ class PropaleStats extends Stats
|
||||
$this->socid = ($socid > 0 ? $socid : 0);
|
||||
$this->userid = $userid;
|
||||
|
||||
$object=new Propal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0";
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Propal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field_date='p.datep';
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0";
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$object=new SupplierProposal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field_date='p.date_valid';
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
}
|
||||
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
|
||||
$this->where.= " AND p.entity IN (".getEntity('propal', 1).")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
@ -89,10 +106,10 @@ class PropaleStats extends Stats
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, COUNT(*) as nb";
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -111,7 +128,7 @@ class PropaleStats extends Stats
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
@ -131,10 +148,10 @@ class PropaleStats extends Stats
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, SUM(p.".$this->field.")";
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -153,10 +170,10 @@ class PropaleStats extends Stats
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%m') as dm, AVG(p.".$this->field.")";
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -173,7 +190,7 @@ class PropaleStats extends Stats
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(p.datep,'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
@ -200,7 +217,7 @@ class PropaleStats extends Stats
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
|
||||
$sql.= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb','DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
@ -33,6 +33,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
if ($mode == 'customer' && ! $user->rights->propale->lire) accessforbidden();
|
||||
if ($mode == 'supplier' && ! $user->rights->supplier_proposal->lire) accessforbidden();
|
||||
|
||||
$object_statut=GETPOST('propal_statut');
|
||||
|
||||
$userid=GETPOST('userid','int');
|
||||
@ -50,7 +54,10 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||
$startyear=$year-1;
|
||||
$endyear=$year;
|
||||
|
||||
$mode=GETPOST('mode');
|
||||
$langs->load('orders');
|
||||
$langs->load('companies');
|
||||
$langs->load('other');
|
||||
$langs->load('suppliers');
|
||||
|
||||
|
||||
/*
|
||||
@ -64,16 +71,26 @@ $langs->load('propal');
|
||||
$langs->load('other');
|
||||
$langs->load("companies");
|
||||
|
||||
llxHeader('', $langs->trans("ProposalsStatistics"));
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$title=$langs->trans("ProposalsStatistics");
|
||||
$dir=$conf->propale->dir_temp;
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$title=$langs->trans("ProposalsStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")";
|
||||
$dir=$conf->supplier_proposal->dir_temp;
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("ProposalsStatistics"),'','title_commercial.png');
|
||||
llxHeader('', $title);
|
||||
|
||||
print load_fiche_titre($title,'','title_commercial.png');
|
||||
|
||||
$dir=$conf->propal->dir_temp;
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
|
||||
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0));
|
||||
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0), $mode);
|
||||
if ($object_statut != '' && $object_statut >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_statut.')';
|
||||
|
||||
// Build graphic number of object
|
||||
@ -248,7 +265,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '</td></tr>';
|
||||
// Status
|
||||
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
|
||||
$formpropal->selectProposalStatus($object_statut,0,1);
|
||||
$formpropal->selectProposalStatus($object_statut,0,1,1,$mode);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
|
||||
|
||||
@ -261,6 +261,13 @@ if (empty($reshook))
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
if (! $error)
|
||||
{
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
if (! empty($origin) && ! empty($originid))
|
||||
{
|
||||
@ -293,10 +300,6 @@ if (empty($reshook))
|
||||
$object->linked_objects = array_merge($object->linked_objects, $other_linked_objects);
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object_id = $object->create($user);
|
||||
@ -386,10 +389,6 @@ if (empty($reshook))
|
||||
$action = 'create';
|
||||
}
|
||||
} else {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object_id = $object->create($user);
|
||||
|
||||
@ -2826,7 +2826,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$clause = " WHERE";
|
||||
|
||||
|
||||
@ -72,11 +72,29 @@ if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='c.rowid';
|
||||
if (! $sortfield) $sortfield='c.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
'c.ref_client'=>'RefCustomerOrder',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
@ -96,24 +114,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$billed='';
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'c.ref'=>'Ref',
|
||||
'c.ref_client'=>'RefCustomerOrder',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
'c.note_public'=>'NotePublic',
|
||||
);
|
||||
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
@ -64,8 +64,6 @@ $langs->load('suppliers');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$title=$langs->trans("OrdersStatistics");
|
||||
@ -77,6 +75,8 @@ if ($mode == 'supplier')
|
||||
$dir=$conf->fournisseur->dir_output.'/commande/temp';
|
||||
}
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
print load_fiche_titre($title,'','title_commercial.png');
|
||||
|
||||
dol_mkdir($dir);
|
||||
@ -277,12 +277,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NbOfOrders").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="right">'.$langs->trans("NbOfOrders").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="right">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
|
||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
@ -85,7 +87,8 @@ if ($_POST["action"] == 'add')
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); }
|
||||
$account->account_number = $accountancy_code_number;
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
$account->solde = $_POST["solde"];
|
||||
@ -163,7 +166,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
if (GETPOST('account_number') <= 0) { $accountancy_code_number = ''; } else { $accountancy_code_number = GETPOST('account_number'); }
|
||||
$account->account_number = $accountancy_code_number;
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
$account->currency_code = trim($_POST["account_currency_code"]);
|
||||
@ -231,6 +235,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user-
|
||||
$form = new Form($db);
|
||||
$formbank = new FormBank($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
@ -476,14 +481,34 @@ if ($action == 'create')
|
||||
// Accountancy code
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
@ -732,7 +757,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">'.$account->account_number.'</td></tr>';
|
||||
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
@ -1008,16 +1033,36 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Accountancy code
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
|
||||
}
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST("account_number"):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST("account_number"):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
|
||||
@ -535,7 +535,7 @@ if ($result)
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
print '<td colspan="3">';
|
||||
print '<input name="amount" class="flat" size="10" '.($objp->rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$conf->currency);
|
||||
print '<input name="amount" class="flat" size="10" '.($objp->rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -154,6 +154,7 @@ $acct->fetch($id);
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
|
||||
$sql.= ", b.fk_bordereau";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= " WHERE rappro=0 AND fk_account=".$acct->id;
|
||||
$sql.= " ORDER BY dateo ASC";
|
||||
@ -291,7 +292,7 @@ if ($resql)
|
||||
// Type + Number
|
||||
$label=($langs->trans("PaymentType".$objp->type)!="PaymentType".$objp->type)?$langs->trans("PaymentType".$objp->type):$objp->type; // $objp->type is a code
|
||||
if ($label=='SOLD') $label='';
|
||||
print '<td class="nowrap">'.$label.($objp->num_chq?' '.$objp->num_chq:'').'</td>';
|
||||
print '<td class="nowrap">'.$label.($objp->num_chq?' '.$objp->num_chq:'').($objp->fk_bordereau>0?' ('.$objp->fk_bordereau.')':'').'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'">';
|
||||
@ -412,7 +413,7 @@ if ($resql)
|
||||
print '</a>';
|
||||
}
|
||||
else {
|
||||
print " "; // On n'empeche la suppression car le raprochement ne pourra se faire qu'apr<70>s la date pass<73>e et que l'<27>criture apparaisse bien sur le compte.
|
||||
print " "; // We prevents the deletion because reconciliation can not be achieved until the date has elapsed and that writing appears well on the account.
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -327,6 +327,7 @@ else
|
||||
// Recherche les ecritures pour le releve
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||
$sql.= " b.fk_bordereau,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -373,7 +374,7 @@ else
|
||||
} else {
|
||||
$type_label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
|
||||
}
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').'</td>';
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').($objp->fk_bordereau>0?' ('.$objp->fk_bordereau.')':'').'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
|
||||
@ -103,7 +103,7 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@ -1163,6 +1163,18 @@ if (empty($reshook))
|
||||
$object->fk_facture_source = $_POST['situations'];
|
||||
$object->type = Facture::TYPE_SITUATION;
|
||||
|
||||
if (!empty($origin) && !empty($originid))
|
||||
{
|
||||
$object->origin = $origin;
|
||||
$object->origin_id = $originid;
|
||||
|
||||
foreach ($object->lines as &$line)
|
||||
{
|
||||
$line->origin = $object->origin;
|
||||
$line->origin_id = $line->id;
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
$object->date = $datefacture;
|
||||
$object->note_public = trim($_POST['note_public']);
|
||||
@ -1492,11 +1504,11 @@ if (empty($reshook))
|
||||
$date_end = '';
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc'));
|
||||
$description = dol_htmlcleanlastbr(GETPOST('product_desc') ? GETPOST('product_desc') : GETPOST('desc'));
|
||||
$pu_ht = GETPOST('price_ht');
|
||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$qty = GETPOST('qty');
|
||||
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $vat_rate))
|
||||
@ -2131,7 +2143,7 @@ if ($action == 'create')
|
||||
$opt = $form->selectSituationInvoices(GETPOST('originid'), $socid);
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" value="5"' . (GETPOST('type') == 5 && GETPOST('originid') ? ' checked' : '');
|
||||
if ($opt == ('<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture')) $tmp.=' disabled';
|
||||
if ($opt == ('<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>') || (GETPOST('origin') && GETPOST('origin') != 'facture' && GETPOST('origin') != 'commande')) $tmp.=' disabled';
|
||||
$tmp.= '> ';
|
||||
$text = $tmp.$langs->trans("InvoiceSituationAsk") . ' ';
|
||||
$text .= '<select class="flat" id="situations" name="situations">';
|
||||
@ -2980,7 +2992,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer)
|
||||
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && ! empty($object->brouillon) && $user->rights->facture->creer && empty($conf->global->FAC_FORCE_DATE_VALIDATION))
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinvoicedate&facid=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
@ -3018,6 +3030,96 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '<td rowspan="' . $nbrows . '" colspan="2" valign="top">';
|
||||
|
||||
if ($object->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||
|
||||
if (count($object->tab_previous_situation_invoice) > 0)
|
||||
{
|
||||
//List of previous invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('ListOfPreviousSituationInvoices') . '</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_prev_ht = $total_prev_ttc = 0;
|
||||
$var = true;
|
||||
foreach ($object->tab_previous_situation_invoice as $prev_invoice)
|
||||
{
|
||||
$totalpaye = $prev_invoice->getSommePaiement();
|
||||
$total_prev_ht += $prev_invoice->total_ht;
|
||||
$total_prev_ttc += $prev_invoice->total_ttc;
|
||||
print '<tr '.$bc [$var].'>';
|
||||
print '<td>'.$prev_invoice->getNomUrl(1).'</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right">' . price($prev_invoice->total_ht) . '</td>';
|
||||
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">'.$prev_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
print '<tr '.$bc [$var].'>';
|
||||
print '<td colspan="2" align="right"></td>';
|
||||
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
|
||||
print '<td align="right"><b>' . price($total_prev_ttc) . '</b></td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($object->tab_next_situation_invoice) > 0)
|
||||
{
|
||||
//List of next invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
|
||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_next_ht = $total_next_ttc = 0;
|
||||
|
||||
$var = true;
|
||||
foreach ($object->tab_next_situation_invoice as $next_invoice)
|
||||
{
|
||||
$totalpaye = $next_invoice->getSommePaiement();
|
||||
$total_next_ht += $next_invoice->total_ht;
|
||||
$total_next_ttc += $next_invoice->total_ttc;
|
||||
print '<tr '.$bc [$var].'>';
|
||||
print '<td>'.$next_invoice->getNomUrl(1).'</td>';
|
||||
print '<td></td>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
|
||||
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
|
||||
print '<td align="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
print '<tr '.$bc [$var].'>';
|
||||
print '<td colspan="2" align="right"></td>';
|
||||
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
|
||||
print '<td align="right"><b>' . price($total_next_ttc) . '</b></td>';
|
||||
print '<td width="18"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '</table>';
|
||||
}
|
||||
|
||||
print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||
|
||||
// List of payments already done
|
||||
@ -3576,7 +3678,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($resteapayer == $object->total_ttc && empty($object->paye) && $ventilExportCompta == 0)
|
||||
{
|
||||
if (! $objectidnext && $object->is_last_in_cycle())
|
||||
if (! $objectidnext)
|
||||
{
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
|
||||
|
||||
@ -529,43 +529,6 @@ class FactureRec extends Facture
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rend la facture automatique
|
||||
*
|
||||
* @param User $user User object
|
||||
* @param int $freq Freq
|
||||
* @param string $courant Courant
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function set_auto($user, $freq, $courant)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec ";
|
||||
$sql .= " SET frequency = '".$freq."', last_gen='".$courant."'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$this->frequency = $freq;
|
||||
$this->last_gen = $courant;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
|
||||
@ -123,6 +123,16 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public $situation_final;
|
||||
|
||||
/**
|
||||
* @var array Table of previous situations
|
||||
*/
|
||||
public $tab_previous_situation_invoice=array();
|
||||
|
||||
/**
|
||||
* @var array Table of next situations
|
||||
*/
|
||||
public $tab_next_situation_invoice=array();
|
||||
|
||||
/**
|
||||
* Standard invoice
|
||||
*/
|
||||
@ -595,6 +605,8 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function createFromCurrent($user,$invertdetail=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Charge facture source
|
||||
$facture=new Facture($this->db);
|
||||
|
||||
@ -612,6 +624,9 @@ class Facture extends CommonInvoice
|
||||
$facture->remise_absolue = $this->remise_absolue;
|
||||
$facture->remise_percent = $this->remise_percent;
|
||||
|
||||
$facture->origin = $this->origin;
|
||||
$facture->origin_id = $this->origin_id;
|
||||
|
||||
$facture->lines = $this->lines; // Tableau des lignes de factures
|
||||
$facture->products = $this->lines; // Tant que products encore utilise
|
||||
$facture->situation_counter = $this->situation_counter;
|
||||
@ -641,6 +656,20 @@ class Facture extends CommonInvoice
|
||||
$this->error=$facture->error;
|
||||
$this->errors=$facture->errors;
|
||||
}
|
||||
elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
$this->fetchObjectLinked('', '', $object->id, 'facture');
|
||||
|
||||
foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object)
|
||||
{
|
||||
foreach ($Tfk_object as $fk_object)
|
||||
{
|
||||
$facture->add_object_linked($typeObject, $fk_object);
|
||||
}
|
||||
}
|
||||
|
||||
$facture->add_object_linked('facture', $this->fk_facture_source);
|
||||
}
|
||||
|
||||
return $facid;
|
||||
}
|
||||
@ -923,9 +952,10 @@ class Facture extends CommonInvoice
|
||||
* @param string $ref Reference of invoice
|
||||
* @param string $ref_ext External reference of invoice
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
|
||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $fetch_situation=false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1015,6 +1045,11 @@ class Facture extends CommonInvoice
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($this->type == self::TYPE_SITUATION && $fetch_situation)
|
||||
{
|
||||
$this->fetchPreviousNextSituationInvoice();
|
||||
}
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retrieve all extrafield for invoice
|
||||
@ -1143,6 +1178,36 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch previous and next situations invoices
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function fetchPreviousNextSituationInvoice()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->tab_previous_situation_invoice = array();
|
||||
$this->tab_next_situation_invoice = array();
|
||||
|
||||
$sql = 'SELECT rowid, situation_counter FROM '.MAIN_DB_PREFIX.'facture WHERE rowid <> '.$this->id.' AND entity = '.$conf->entity.' AND situation_cycle_ref = '.(int) $this->situation_cycle_ref.' ORDER BY situation_counter ASC';
|
||||
|
||||
dol_syslog(get_class($this).'::fetchPreviousNextSituationInvoice ', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result && $this->db->num_rows($result) > 0)
|
||||
{
|
||||
while ($objp = $this->db->fetch_object($result))
|
||||
{
|
||||
$invoice = new Facture($this->db);
|
||||
if ($invoice->fetch($objp->rowid) > 0)
|
||||
{
|
||||
if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice;
|
||||
else $this->tab_next_situation_invoice[] = $invoice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update database
|
||||
@ -1738,7 +1803,7 @@ class Facture extends CommonInvoice
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate)))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
dol_syslog(get_class($this)."::validate ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1910,6 +1975,14 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && !$this->is_last_in_cycle())
|
||||
{
|
||||
if (! $this->updatePriceNextInvoice($langs))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Set new ref and define current statut
|
||||
if (! $error)
|
||||
{
|
||||
@ -1950,6 +2023,45 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update price of next invoice
|
||||
*
|
||||
* @param Translate $langs Translate object
|
||||
* @return bool false if KO, true if OK
|
||||
*/
|
||||
function updatePriceNextInvoice(&$langs)
|
||||
{
|
||||
foreach ($this->tab_next_situation_invoice as $next_invoice)
|
||||
{
|
||||
$is_last = $next_invoice->is_last_in_cycle();
|
||||
|
||||
if ($next_invoice->brouillon && $is_last != 1)
|
||||
{
|
||||
$this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref);
|
||||
return false;
|
||||
}
|
||||
|
||||
$next_invoice->brouillon = 1;
|
||||
foreach ($next_invoice->lines as $line)
|
||||
{
|
||||
$result = $next_invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
|
||||
$line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type,
|
||||
$line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent,
|
||||
$line->fk_unit);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
break; // Only the next invoice and not each next invoice
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set draft status
|
||||
*
|
||||
@ -2168,7 +2280,7 @@ class Facture extends CommonInvoice
|
||||
$this->line=new FactureLigne($this->db);
|
||||
|
||||
$this->line->context = $this->context;
|
||||
|
||||
|
||||
$this->line->fk_facture=$this->id;
|
||||
$this->line->label=$label; // deprecated
|
||||
$this->line->desc=$desc;
|
||||
@ -2274,12 +2386,21 @@ class Facture extends CommonInvoice
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
global $mysoc;
|
||||
global $mysoc,$langs;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline rowid=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, type=$type, fk_parent_line=$fk_parent_line pa_ht=$pa_ht, special_code=$special_code fk_unit=$fk_unit", LOG_DEBUG);
|
||||
|
||||
if ($this->brouillon)
|
||||
{
|
||||
if (!$this->is_last_in_cycle() && empty($this->error))
|
||||
{
|
||||
if (!$this->checkProgressLine($rowid, $situation_percent))
|
||||
{
|
||||
if (!$this->error) $this->error=$langs->trans('invoiceLineProgressError');
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
@ -2402,6 +2523,33 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the percent edited is lower of next invoice line
|
||||
*
|
||||
* @param int $idline id of line to check
|
||||
* @param float $situation_percent progress percentage need to be test
|
||||
* @return false if KO, true if OK
|
||||
*/
|
||||
function checkProgressLine($idline, $situation_percent)
|
||||
{
|
||||
$sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd
|
||||
INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid)
|
||||
WHERE fd.fk_prev_id = '.$idline.'
|
||||
AND f.fk_statut <> 0';
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return false;
|
||||
}
|
||||
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
if ($obj === null) return true;
|
||||
else return $situation_percent < $obj->situation_percent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update invoice line with percentage
|
||||
*
|
||||
@ -3183,7 +3331,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$clause = " WHERE";
|
||||
|
||||
@ -3593,10 +3741,12 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function get_prev_sits()
|
||||
{
|
||||
|
||||
global $conf;
|
||||
|
||||
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture';
|
||||
$sql .= ' where situation_cycle_ref = ' . $this->situation_cycle_ref;
|
||||
$sql .= ' and situation_counter < ' . $this->situation_counter;
|
||||
$sql .= ' AND entity = '. ($this->entity > 0 ? $this->entity : $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
$res = array();
|
||||
if ($resql && $resql->num_rows > 0) {
|
||||
@ -3649,9 +3799,11 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function is_last_in_cycle()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (!empty($this->situation_cycle_ref)) {
|
||||
// No point in testing anything if we're not inside a cycle
|
||||
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref;
|
||||
$sql = 'SELECT max(situation_counter) FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_cycle_ref = ' . $this->situation_cycle_ref . ' AND entity = ' . ($this->entity > 0 ? $this->entity : $conf->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql && $resql->num_rows > 0) {
|
||||
|
||||
@ -231,6 +231,7 @@ print '<tr><td class="tdtop">'.$form->editfieldkey("Note",'note',$object->note,$
|
||||
print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->facture->paiement,'textarea');
|
||||
print '</td></tr>';
|
||||
|
||||
$disable_delete = 0;
|
||||
// Bank account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
@ -238,6 +239,11 @@ if (! empty($conf->banque->enabled))
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($object->bank_line);
|
||||
if ($bankline->rappro)
|
||||
{
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
@ -279,7 +285,6 @@ print '</table>';
|
||||
* List of invoices
|
||||
*/
|
||||
|
||||
$disable_delete = 0;
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ' WHERE pf.fk_facture = f.rowid';
|
||||
@ -349,6 +354,7 @@ if ($resql)
|
||||
if ($objp->paye == 1) // If at least one invoice is paid, disable delete
|
||||
{
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
|
||||
}
|
||||
$total = $total + $objp->amount;
|
||||
$i++;
|
||||
@ -394,7 +400,7 @@ if ($user->societe_id == 0 && $action == '')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionRefused" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
* \brief Page for cheque deposits
|
||||
*/
|
||||
|
||||
require('../../../main.inc.php');
|
||||
require '../../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
|
||||
@ -102,6 +102,13 @@ else if ($year > 0)
|
||||
$sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= " ORDER BY $sortfield $sortorder";
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print "$sql";
|
||||
@ -114,7 +121,7 @@ if ($resql)
|
||||
$i = 0;
|
||||
$params='';
|
||||
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num);
|
||||
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="liste">';
|
||||
|
||||
@ -178,6 +178,14 @@ else
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
//print "$sql";
|
||||
@ -195,7 +203,7 @@ if ($resql)
|
||||
$paramlist.=($search_company?"&search_company=".$search_company:"");
|
||||
$paramlist.=($search_amount?"&search_amount=".$search_amount:"");
|
||||
|
||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num,'','title_accountancy.png');
|
||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png');
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -621,6 +621,87 @@ if (! empty($conf->salaries->enabled))
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Expense
|
||||
*/
|
||||
|
||||
if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
$langs->load('trips');
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
$sql.= " AND p.fk_statut>5";
|
||||
|
||||
$column='p.date_valid';
|
||||
|
||||
} else {
|
||||
$sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
$sql.= " AND p.fk_statut=6";
|
||||
|
||||
$column='pe.datep';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("ExpenseReport").'</td></tr>';
|
||||
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
|
||||
$sql.= " GROUP BY p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
$sql.= " ORDER BY p.ref";
|
||||
|
||||
dol_syslog("get expense report outcome");
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=true;
|
||||
if ($num)
|
||||
{
|
||||
while ($obj = $db->fetch_object($result))
|
||||
{
|
||||
$total_ht -= $obj->amount_ht;
|
||||
$total_ttc -= $obj->amount_ttc;
|
||||
$subtotal_ht += $obj->amount_ht;
|
||||
$subtotal_ttc += $obj->amount_ttc;
|
||||
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </td>";
|
||||
|
||||
print "<td>".$langs->trans("ExpenseReport")." <a href=\"".DOL_URL_ROOT."/expensereport/card.php?id=".$obj->rowid."\">".$obj->ref.' ('.$obj->firstname." ".$obj->lastname.")</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount_ht).'</td>';
|
||||
print '<td align="right">'.price(-$obj->amount_ttc).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$var = !$var;
|
||||
print "<tr ".$bc[$var]."><td> </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>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Donation
|
||||
|
||||
@ -521,6 +521,58 @@ if (! empty($conf->salaries->enabled))
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->expensereport->enabled))
|
||||
{
|
||||
$langs->load('trips');
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
$sql.= " AND p.fk_statut>5";
|
||||
|
||||
$column='p.date_valid';
|
||||
|
||||
} else {
|
||||
$sql = "SELECT date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
|
||||
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
|
||||
$sql.= " AND p.fk_statut=6";
|
||||
|
||||
$column='pe.datep';
|
||||
}
|
||||
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get expense report outcome");
|
||||
$result=$db->query($sql);
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
if ($num)
|
||||
{
|
||||
while ($obj = $db->fetch_object($result))
|
||||
{
|
||||
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
|
||||
$decaiss[$obj->dm] += $obj->amount_ht;
|
||||
|
||||
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
|
||||
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Donation get dunning paiement
|
||||
*/
|
||||
|
||||
@ -126,7 +126,7 @@ if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) {
|
||||
$special_report = true;
|
||||
}
|
||||
|
||||
llxHeader('','','','',0,0,'','',$morequerystring);
|
||||
llxHeader('',$langs->trans("VATReport"),'','',0,0,'','',$morequerystring);
|
||||
|
||||
$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
|
||||
@ -104,7 +104,7 @@ foreach($listofparams as $param)
|
||||
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
||||
}
|
||||
|
||||
llxHeader('','','','',0,0,'','',$morequerystring);
|
||||
llxHeader('',$langs->trans("VATReport"),'','',0,0,'','',$morequerystring);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
@ -218,7 +218,7 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contact_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||
|
||||
@ -1953,7 +1953,7 @@ class Contrat extends CommonObject
|
||||
*/
|
||||
function load_board($user,$mode)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$this->from = " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
|
||||
@ -161,7 +161,8 @@ if ($action == 'add')
|
||||
$params,
|
||||
(GETPOST('alwayseditable')?1:0),
|
||||
(GETPOST('perms')?GETPOST('perms'):''),
|
||||
(GETPOST('list')?1:0)
|
||||
(GETPOST('list')?1:0),
|
||||
(GETPOST('ishidden')?1:0)
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -311,7 +312,8 @@ if ($action == 'update')
|
||||
$params,
|
||||
(GETPOST('alwayseditable')?1:0),
|
||||
(GETPOST('perms')?GETPOST('perms'):''),
|
||||
(GETPOST('list')?1:0)
|
||||
(GETPOST('list')?1:0),
|
||||
(GETPOST('ishidden')?1:0)
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@ -168,7 +168,28 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Standard method to get content of a box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function outputBox($head = null, $contents = null)
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
|
||||
// Trick to get result into a var from a function that makes print instead of return
|
||||
ob_start();
|
||||
$result = $this->showBox($head, $contents);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
*Standard method to show a box (usage by boxes not mandatory, a box can still use its own showBox function)
|
||||
*
|
||||
@ -177,7 +198,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function showBox($head, $contents)
|
||||
function showBox($head = null, $contents = null)
|
||||
{
|
||||
global $langs, $user, $conf;
|
||||
|
||||
|
||||
@ -2075,6 +2075,7 @@ abstract class CommonObject
|
||||
|
||||
$sql = 'SELECT rowid, qty, '.$fieldup.' as up, remise_percent, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
|
||||
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type';
|
||||
if ($this->table_element_line == 'facturedet') $sql.= ', situation_percent';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
||||
if ($exclspec)
|
||||
@ -2109,7 +2110,7 @@ abstract class CommonObject
|
||||
if ($forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto'
|
||||
{
|
||||
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
|
||||
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array);
|
||||
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array, (isset($obj->situation_percent) ? $obj->situation_percent : 100));
|
||||
$diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
|
||||
if ($diff)
|
||||
{
|
||||
@ -2383,14 +2384,14 @@ abstract class CommonObject
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$module = $element = $subelement = $objecttype;
|
||||
if ($objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||
if ($objecttype != 'supplier_proposal' && $objecttype != 'order_supplier' && $objecttype != 'invoice_supplier'
|
||||
&& preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||
{
|
||||
$module = $element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
$classpath = $element.'/class';
|
||||
|
||||
// To work with non standard classpath or module name
|
||||
if ($objecttype == 'facture') {
|
||||
$classpath = 'compta/facture/class';
|
||||
@ -2426,7 +2427,10 @@ abstract class CommonObject
|
||||
else if ($objecttype == 'order_supplier') {
|
||||
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
|
||||
}
|
||||
|
||||
else if ($objecttype == 'supplier_proposal') {
|
||||
$classfile = 'supplier_proposal'; $classname = 'SupplierProposal';
|
||||
}
|
||||
|
||||
// Here $module, $classfile and $classname are set
|
||||
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
||||
{
|
||||
@ -2594,6 +2598,7 @@ abstract class CommonObject
|
||||
$error = 0;
|
||||
|
||||
$trigkey='';
|
||||
if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_CLOSE';
|
||||
if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED';
|
||||
if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED';
|
||||
|
||||
@ -4080,6 +4085,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$csstyle='';
|
||||
$class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
|
||||
if (is_array($params) && count($params)>0) {
|
||||
if (array_key_exists('style',$params)) {
|
||||
$csstyle=$params['style'];
|
||||
@ -4087,12 +4093,12 @@ abstract class CommonObject
|
||||
}
|
||||
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
|
||||
{
|
||||
$out .= '<tr '.$csstyle.'>';
|
||||
$out .= '<tr '.$class.$csstyle.'>';
|
||||
$colspan='0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out .= '<tr '.$csstyle.'>';
|
||||
$out .= '<tr '.$class.$csstyle.'>';
|
||||
}
|
||||
// Convert date into timestamp format
|
||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||
@ -4104,7 +4110,8 @@ abstract class CommonObject
|
||||
$label = '<span'.($mode != 'view' ? ' class="fieldrequired"':'').'>'.$label.'</span>';
|
||||
|
||||
$out .= '<td>'.$langs->trans($label).'</td>';
|
||||
$out .='<td'.($colspan?' colspan="'.$colspan.'"':'').'>';
|
||||
$html_id = !empty($this->id) ? $this->element.'_extras_'.$key.'_'.$this->id : '';
|
||||
$out .='<td id="'.$html_id.'" class="'.$this->element.'_extras_'.$key.'" '.($colspan?' colspan="'.$colspan.'"':'').'>';
|
||||
|
||||
switch($mode) {
|
||||
case "view":
|
||||
@ -4193,10 +4200,11 @@ abstract class CommonObject
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* define buy price if not defined
|
||||
/**
|
||||
* Get buy price to use for margin calculation. This function is called when buy price is unknown.
|
||||
* set buy price = sell price if ForceBuyingPriceIfNull configured,
|
||||
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, set pmp as buyprice
|
||||
* else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice
|
||||
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice
|
||||
* else set min buy price as buy price
|
||||
*
|
||||
* @param float $unitPrice product unit price
|
||||
@ -4211,16 +4219,16 @@ abstract class CommonObject
|
||||
|
||||
$buyPrice = 0;
|
||||
|
||||
if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1))
|
||||
if (($unitPrice > 0) && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) // In most cases, test here is false
|
||||
{
|
||||
$buyPrice = $unitPrice * (1 - $discountPercent / 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get PMP
|
||||
// Get cost price for margin calculation
|
||||
if (! empty($fk_product))
|
||||
{
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')
|
||||
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'costprice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$product = new Product($this->db);
|
||||
@ -4230,13 +4238,32 @@ abstract class CommonObject
|
||||
$this->errors[] = 'ErrorProductIdDoesNotExists';
|
||||
return -1;
|
||||
}
|
||||
if (($product->pmp > 0))
|
||||
if ($product->cost_price > 0)
|
||||
{
|
||||
$buyPrice = $product->cost_price;
|
||||
}
|
||||
else if ($product->pmp > 0)
|
||||
{
|
||||
$buyPrice = $product->pmp;
|
||||
}
|
||||
// TODO add option to set PMP of product
|
||||
}
|
||||
else if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1')
|
||||
else if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch($fk_product);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$this->errors[] = 'ErrorProductIdDoesNotExists';
|
||||
return -1;
|
||||
}
|
||||
if ($product->pmp > 0)
|
||||
{
|
||||
$buyPrice = $product->pmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($buyPrice) && isset($conf->global->MARGIN_TYPE) && in_array($conf->global->MARGIN_TYPE, array('1','pmp','costprice')))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
$productFournisseur = new ProductFournisseur($this->db);
|
||||
|
||||
@ -205,6 +205,17 @@ class Conf
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
// Include local constants files and fetch their values to the corresponding database constants
|
||||
if(! empty($this->global->LOCAL_CONSTS_FILES)) {
|
||||
$filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
|
||||
foreach ($filesList as $file) {
|
||||
$file=dol_sanitizeFileName($file);
|
||||
include_once DOL_DOCUMENT_ROOT . "/$file/{$file}_consts.php";
|
||||
foreach ($file2bddconsts as $key=>$value) {
|
||||
$conf->global->$key=constant($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($this->modules);
|
||||
//var_dump($this->modules_parts['theme']);
|
||||
|
||||
@ -331,6 +342,19 @@ class Conf
|
||||
$this->fournisseur->facture=new stdClass();
|
||||
$this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture";
|
||||
$this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp";
|
||||
|
||||
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
|
||||
if (! empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties
|
||||
{
|
||||
$this->supplier_order=new stdClass();
|
||||
$this->supplier_order->enabled=1;
|
||||
$this->supplier_order->dir_output=$rootfordata."/fournisseur/commande";
|
||||
$this->supplier_order->dir_temp=$rootfordata."/fournisseur/commande/temp";
|
||||
$this->supplier_invoice=new stdClass();
|
||||
$this->supplier_invoice->enabled=1;
|
||||
$this->supplier_order->dir_output=$rootfordata."/fournisseur/facture";
|
||||
$this->supplier_order->dir_temp=$rootfordata."/fournisseur/facture/temp";
|
||||
}
|
||||
}
|
||||
|
||||
// Module product/service
|
||||
@ -476,7 +500,14 @@ class Conf
|
||||
$this->adherent->cotisation = new stdClass();
|
||||
$this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
|
||||
}
|
||||
if (isset($this->agenda)) $this->agenda->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
||||
if (isset($this->agenda)) $this->agenda->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
||||
if (isset($this->projet))
|
||||
{
|
||||
$this->projet->warning_delay=(isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE)?$this->global->MAIN_DELAY_PROJECT_TO_CLOSE:7)*24*60*60;
|
||||
$this->projet->task = new StdClass();
|
||||
$this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
|
||||
}
|
||||
|
||||
if (isset($this->commande)) {
|
||||
$this->commande->client = new stdClass();
|
||||
$this->commande->fournisseur = new stdClass();
|
||||
|
||||
@ -61,6 +61,8 @@ class ExtraFields
|
||||
var $error;
|
||||
var $errno;
|
||||
|
||||
var $attribute_hidden;
|
||||
|
||||
public static $type2label=array(
|
||||
'varchar'=>'String',
|
||||
'text'=>'TextLong',
|
||||
@ -98,6 +100,7 @@ class ExtraFields
|
||||
$this->attribute_required = array();
|
||||
$this->attribute_perms = array();
|
||||
$this->attribute_list = array();
|
||||
$this->attribute_hidden = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,9 +119,10 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Into list view by default
|
||||
* @param int $ishidden Is hidden extrafield
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0)
|
||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0)
|
||||
{
|
||||
if (empty($attrname)) return -1;
|
||||
if (empty($label)) return -1;
|
||||
@ -135,7 +139,7 @@ class ExtraFields
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
||||
{
|
||||
// Add declaration of field into table
|
||||
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable, $perms, $list);
|
||||
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden);
|
||||
$err2=$this->errno;
|
||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
|
||||
{
|
||||
@ -243,9 +247,10 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Into list view by default
|
||||
* @param int $ishidden Is hidden extrafield
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0)
|
||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -271,7 +276,7 @@ class ExtraFields
|
||||
$params='';
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list)";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list, ishidden)";
|
||||
$sql.= " VALUES('".$attrname."',";
|
||||
$sql.= " '".$this->db->escape($label)."',";
|
||||
$sql.= " '".$type."',";
|
||||
@ -285,6 +290,7 @@ class ExtraFields
|
||||
$sql.= " '".$alwayseditable."',";
|
||||
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
|
||||
$sql.= " ".$list;
|
||||
$sql.= ", ".$ishidden;
|
||||
$sql.=')';
|
||||
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
@ -389,9 +395,10 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Into list view by default
|
||||
* @param int $ishidden Is hidden extrafield
|
||||
* @return int >0 if OK, <=0 if KO
|
||||
*/
|
||||
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='')
|
||||
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0)
|
||||
{
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||
@ -432,7 +439,7 @@ class ExtraFields
|
||||
{
|
||||
if ($label)
|
||||
{
|
||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list);
|
||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden);
|
||||
}
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -483,12 +490,13 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param int $list Into list view by default
|
||||
* @param int $ishidden Is hidden extrafield
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0)
|
||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0)
|
||||
{
|
||||
global $conf;
|
||||
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list);
|
||||
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden);
|
||||
|
||||
// Clean parameters
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
@ -526,6 +534,7 @@ class ExtraFields
|
||||
$sql.= " alwayseditable,";
|
||||
$sql.= " param,";
|
||||
$sql.= " list";
|
||||
$sql.= ", ishidden";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$attrname."',";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
@ -540,6 +549,7 @@ class ExtraFields
|
||||
$sql.= " '".$alwayseditable."',";
|
||||
$sql.= " '".$param."',";
|
||||
$sql.= " ".$list;
|
||||
$sql.= ", ".$ishidden;
|
||||
$sql.= ")";
|
||||
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
|
||||
$resql2=$this->db->query($sql);
|
||||
@ -585,7 +595,7 @@ class ExtraFields
|
||||
// For avoid conflicts with external modules
|
||||
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
|
||||
|
||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list";
|
||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
|
||||
@ -616,6 +626,7 @@ class ExtraFields
|
||||
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
|
||||
$this->attribute_perms[$tab->name]=$tab->perms;
|
||||
$this->attribute_list[$tab->name]=$tab->list;
|
||||
$this->attribute_hidden[$tab->name]=$tab->ishidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4134,7 +4134,7 @@ class Form
|
||||
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
|
||||
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
|
||||
*
|
||||
* @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date.
|
||||
* @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date (emptydate must be 0).
|
||||
* @param string $prefix Prefix for fields name
|
||||
* @param int $h 1=Show also hours
|
||||
* @param int $m 1=Show also minutes
|
||||
@ -4509,20 +4509,21 @@ class Form
|
||||
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
|
||||
* @param array $array Array with key+value
|
||||
* @param string|string[] $id Preselected key or preselected keys for multiselect
|
||||
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or ' '), <0 to add an empty value with key that is this value.
|
||||
* @param int $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (value is '' or ' ' if 1), <0 to add an empty value with key that is this value.
|
||||
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param int $translate Translate and encode value
|
||||
* @param int $maxlen Length maximum for labels
|
||||
* @param int $disabled Html select box is disabled
|
||||
* @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort
|
||||
* @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $addjscombo Add js combo
|
||||
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set.
|
||||
* @return string HTML select string.
|
||||
* @see multiselectarray
|
||||
*/
|
||||
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0)
|
||||
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -4558,7 +4559,8 @@ class Form
|
||||
{
|
||||
$textforempty=' ';
|
||||
if (! empty($conf->use_javascript_ajax)) $textforempty=' '; // If we use ajaxcombo, we need here to avoid to have an empty element that is too small.
|
||||
$out.='<option value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id==-2?' selected':'').'>'.$textforempty.'</option>'."\n"; // id is -2 because -1 is already "do not contact"
|
||||
if (! is_numeric($show_empty)) $textforempty=$show_empty;
|
||||
$out.='<option class="optiongrey" '.($moreparamonempty?$moreparamonempty.' ':'').'value="'.($show_empty < 0 ? $show_empty : -1).'"'.($id == $show_empty ?' selected':'').'>'.$textforempty.'</option>'."\n";
|
||||
}
|
||||
|
||||
if (is_array($array))
|
||||
@ -4965,13 +4967,13 @@ class Form
|
||||
{
|
||||
$tplpath = $element = $subelement = $objecttype;
|
||||
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||
if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs))
|
||||
{
|
||||
$element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
$tplpath = $element.'/'.$subelement;
|
||||
}
|
||||
|
||||
|
||||
// To work with non standard path
|
||||
if ($objecttype == 'facture') {
|
||||
$tplpath = 'compta/'.$element;
|
||||
@ -4982,7 +4984,6 @@ class Form
|
||||
if (empty($conf->propal->enabled)) continue; // Do not show if module disabled
|
||||
}
|
||||
else if ($objecttype == 'supplier_proposal') {
|
||||
$tplpath = 'comm/'.$element;
|
||||
if (empty($conf->supplier_proposal->enabled)) continue; // Do not show if module disabled
|
||||
}
|
||||
else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
|
||||
@ -4999,7 +5000,7 @@ class Form
|
||||
else if ($objecttype == 'order_supplier') {
|
||||
$tplpath = 'fourn/commande';
|
||||
}
|
||||
|
||||
|
||||
global $linkedObjectBlock;
|
||||
$linkedObjectBlock = $objects;
|
||||
|
||||
@ -5099,7 +5100,68 @@ class Form
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto))
|
||||
if ((in_array('fichinter',$restrictlinksto)) && ! empty($conf->ficheinter->enabled))
|
||||
{
|
||||
$linktoelem.=($linktoelem?' ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedFichinter') . '</a>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#linktoorder").click(function() {
|
||||
jQuery("#orderlist").toggle();
|
||||
jQuery("#linktoorder").toggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
print '<div id="orderlist"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, f.rowid, f.ref";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
|
||||
$sql .= ", " . MAIN_DB_PREFIX . "fichinter as f";
|
||||
$sql .= ' WHERE f.fk_soc = s.rowid';
|
||||
|
||||
$resqlorderlist = $this->db->query($sql);
|
||||
if ($resqlorderlist)
|
||||
{
|
||||
$num = $this->db->num_rows($resqlorderlist);
|
||||
$i = 0;
|
||||
|
||||
print '<br><form action="" method="POST" name="LinkedFichinter">';
|
||||
print '<table class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap"></td>';
|
||||
print '<td align="center">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Company") . '</td>';
|
||||
print '</tr>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
print '<td aling="left">';
|
||||
print '<input type="radio" name="LinkedFichinter" value=' . $objp->rowid . '>';
|
||||
print '<td align="center">' . $objp->ref . '</td>';
|
||||
print '<td>' . $objp->name . '</td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
|
||||
print '</form>';
|
||||
$this->db->free($resqlorderlist);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto))
|
||||
&& ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$linktoelem.=($linktoelem?' ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
|
||||
|
||||
@ -630,7 +630,8 @@ class FormMail extends Form
|
||||
}
|
||||
if ($this->withfile == 2) // Can add other files
|
||||
{
|
||||
$out.= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) $out.= '<input type="file" class="flat" id="addedfile" name="addedfile[]" value="'.$langs->trans("Upload").'" multiple />';
|
||||
else $out.= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
$out.= ' ';
|
||||
$out.= '<input type="submit" class="button" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
|
||||
}
|
||||
|
||||
@ -967,7 +967,7 @@ class FormOther
|
||||
*
|
||||
* @param User $user Object User
|
||||
* @param String $areacode Code of area for pages (0=value for Home page)
|
||||
* @return int <0 if KO, Nb of boxes shown of OK (0 to n)
|
||||
* @return array array('selectboxlist'=>, 'boxactivated'=>, 'boxlist'=>)
|
||||
*/
|
||||
static function printBoxesArea($user,$areacode)
|
||||
{
|
||||
@ -977,14 +977,15 @@ class FormOther
|
||||
|
||||
$confuserzone='MAIN_BOXES_'.$areacode;
|
||||
|
||||
$selectboxlist=$boxlist='';
|
||||
$boxactivated=InfoBox::listBoxes($db,'activated',$areacode,(empty($user->conf->$confuserzone)?null:$user)); // Search boxes of common+user (or common only if user has no specific setup)
|
||||
|
||||
$boxidactivatedforuser=array();
|
||||
foreach($boxactivated as $box)
|
||||
{
|
||||
if (empty($user->conf->$confuserzone) || $box->fk_user == $user->id) $boxidactivatedforuser[$box->id]=$box->id; // We keep only boxes to show for user
|
||||
}
|
||||
|
||||
$selectboxlist='';
|
||||
$arrayboxtoactivatelabel=array();
|
||||
if (! empty($user->conf->$confuserzone))
|
||||
{
|
||||
@ -1011,7 +1012,7 @@ class FormOther
|
||||
$selectboxlist.='<input type="hidden" name="userid" value="'.$user->id.'">';
|
||||
$selectboxlist.='<input type="hidden" name="areacode" value="'.$areacode.'">';
|
||||
$selectboxlist.='<input type="hidden" name="boxorder" value="'.$boxorder.'">';
|
||||
$selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel,'',1);
|
||||
$selectboxlist.=Form::selectarray('boxcombo', $arrayboxtoactivatelabel, '', $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth200onsmartphone', 0, ' disabled hidden selected');
|
||||
if (empty($conf->use_javascript_ajax)) $selectboxlist.=' <input type="submit" class="button" value="'.$langs->trans("AddBox").'">';
|
||||
$selectboxlist.='</form>';
|
||||
}
|
||||
@ -1019,7 +1020,7 @@ class FormOther
|
||||
// Javascript code for dynamic actions
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
$selectboxlist.='<script type="text/javascript" language="javascript">
|
||||
|
||||
// To update list of activated boxes
|
||||
function updateBoxOrder(closing) {
|
||||
@ -1058,8 +1059,8 @@ class FormOther
|
||||
window.location.search=\'mainmenu='.GETPOST("mainmenu").'&leftmenu='.GETPOST('leftmenu').'&action=addbox&boxid=\'+boxid;
|
||||
}
|
||||
});';
|
||||
if (! count($arrayboxtoactivatelabel)) print 'jQuery("#boxcombo").hide();';
|
||||
print '
|
||||
if (! count($arrayboxtoactivatelabel)) $selectboxlist.='jQuery("#boxcombo").hide();';
|
||||
$selectboxlist.='
|
||||
|
||||
jQuery("#left, #right").sortable({
|
||||
/* placeholder: \'ui-state-highlight\', */
|
||||
@ -1084,12 +1085,11 @@ class FormOther
|
||||
|
||||
});'."\n";
|
||||
|
||||
print '</script>'."\n";
|
||||
$selectboxlist.='</script>'."\n";
|
||||
}
|
||||
|
||||
$nbboxactivated=count($boxidactivatedforuser);
|
||||
|
||||
print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes');
|
||||
//print load_fiche_titre(($nbboxactivated?$langs->trans("OtherInformationsBoxes"):''),$selectboxlist,'','','otherboxes');
|
||||
|
||||
if ($nbboxactivated)
|
||||
{
|
||||
@ -1098,13 +1098,13 @@ class FormOther
|
||||
|
||||
$emptybox=new ModeleBoxes($db);
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td class="notopnoleftnoright">'."\n";
|
||||
$boxlist.='<table width="100%" class="notopnoleftnoright">';
|
||||
$boxlist.='<tr><td class="notopnoleftnoright">'."\n";
|
||||
|
||||
print '<div class="fichehalfleft">';
|
||||
$boxlist.='<div class="fichehalfleft">';
|
||||
|
||||
print "\n<!-- Box left container -->\n";
|
||||
print '<div id="left" class="connectedSortable">'."\n";
|
||||
$boxlist.="\n<!-- Box left container -->\n";
|
||||
$boxlist.='<div id="left" class="connectedSortable">'."\n";
|
||||
|
||||
// Define $box_max_lines
|
||||
$box_max_lines=5;
|
||||
@ -1122,7 +1122,7 @@ class FormOther
|
||||
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
|
||||
// Affichage boite key
|
||||
$box->loadBox($box_max_lines);
|
||||
$box->showBox();
|
||||
$boxlist.= $box->outputBox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1131,15 +1131,15 @@ class FormOther
|
||||
$emptybox->box_id='A';
|
||||
$emptybox->info_box_head=array();
|
||||
$emptybox->info_box_contents=array();
|
||||
$emptybox->showBox(array(),array());
|
||||
$boxlist.= $emptybox->outputBox(array(),array());
|
||||
}
|
||||
print "</div>\n";
|
||||
print "<!-- End box left container -->\n";
|
||||
$boxlist.= "</div>\n";
|
||||
$boxlist.= "<!-- End box left container -->\n";
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
$boxlist.= '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
print "\n<!-- Box right container -->\n";
|
||||
print '<div id="right" class="connectedSortable">'."\n";
|
||||
$boxlist.= "\n<!-- Box right container -->\n";
|
||||
$boxlist.= '<div id="right" class="connectedSortable">'."\n";
|
||||
|
||||
$ii=0;
|
||||
foreach ($boxactivated as $key => $box)
|
||||
@ -1153,7 +1153,7 @@ class FormOther
|
||||
//print 'box_order '.$boxactivated[$ii]->box_order.'<br>';
|
||||
// Affichage boite key
|
||||
$box->loadBox($box_max_lines);
|
||||
$box->showBox();
|
||||
$boxlist.= $box->outputBox();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1162,19 +1162,19 @@ class FormOther
|
||||
$emptybox->box_id='B';
|
||||
$emptybox->info_box_head=array();
|
||||
$emptybox->info_box_contents=array();
|
||||
$emptybox->showBox(array(),array());
|
||||
$boxlist.= $emptybox->outputBox(array(),array());
|
||||
}
|
||||
print "</div>\n";
|
||||
print "<!-- End box right container -->\n";
|
||||
$boxlist.= "</div>\n";
|
||||
$boxlist.= "<!-- End box right container -->\n";
|
||||
|
||||
print '</div></div>';
|
||||
print "\n";
|
||||
$boxlist.= '</div></div>';
|
||||
$boxlist.= "\n";
|
||||
|
||||
print "</td></tr>";
|
||||
print "</table>";
|
||||
$boxlist.= "</td></tr>";
|
||||
$boxlist.= "</table>";
|
||||
}
|
||||
|
||||
return count($boxactivated);
|
||||
return array('selectboxlist'=>$nbboxactivated?$selectboxlist:'', 'boxactivated'=>$boxactivated, 'boxlist'=>$boxlist);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -539,9 +539,10 @@ class FormProjets
|
||||
* @param int $showempty Add an empty line
|
||||
* @param int $useshortlabel Use short label
|
||||
* @param int $showallnone Add choice "All" and "None"
|
||||
* @param int $showpercent Show default probability for status
|
||||
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
|
||||
*/
|
||||
function selectOpportunityStatus($htmlname, $preselected=0, $showempty=1, $useshortlabel=0, $showallnone=0)
|
||||
function selectOpportunityStatus($htmlname, $preselected=0, $showempty=1, $useshortlabel=0, $showallnone=0, $showpercent=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -557,7 +558,7 @@ class FormProjets
|
||||
$i = 0;
|
||||
if ($num > 0)
|
||||
{
|
||||
$sellist = '<select class="flat oppstatus" name="'.$htmlname.'">';
|
||||
$sellist = '<select class="flat oppstatus" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if ($showempty) $sellist.= '<option value="-1"></option>';
|
||||
if ($showallnone) $sellist.= '<option value="all">--'.$langs->trans("Alls").'--</option>';
|
||||
if ($showallnone) $sellist.= '<option value="none">--'.$langs->trans("None").'--</option>';
|
||||
@ -565,7 +566,7 @@ class FormProjets
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$sellist .='<option value="'.$obj->rowid.'"';
|
||||
$sellist .='<option value="'.$obj->rowid.'" defaultpercent="'.$obj->percent.'"';
|
||||
if ($obj->rowid == $preselected) $sellist .= ' selected="selected"';
|
||||
$sellist .= '>';
|
||||
if ($useshortlabel)
|
||||
@ -575,7 +576,7 @@ class FormProjets
|
||||
else
|
||||
{
|
||||
$finallabel = ($langs->transnoentitiesnoconv("OppStatus".$obj->code) != "OppStatus".$obj->code ? $langs->transnoentitiesnoconv("OppStatus".$obj->code) : $obj->label);
|
||||
$finallabel.= ' ('.$obj->percent.'%)';
|
||||
if ($showpercent) $finallabel.= ' ('.$obj->percent.'%)';
|
||||
}
|
||||
$sellist .= $finallabel;
|
||||
$sellist .='</option>';
|
||||
|
||||
@ -49,66 +49,86 @@ class FormPropal
|
||||
* @param int $short Use short labels
|
||||
* @param int $excludedraft 0=All status, 1=Exclude draft status
|
||||
* @param int $showempty 1=Add empty line
|
||||
* @param string $mode 'customer', 'supplier'
|
||||
* @return void
|
||||
*/
|
||||
function selectProposalStatus($selected='',$short=0, $excludedraft=0, $showempty=1)
|
||||
function selectProposalStatus($selected='',$short=0, $excludedraft=0, $showempty=1, $mode='customer')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog(get_class($this)."::selectProposalStatus", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
$prefix='';
|
||||
$listofstatus=array();
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
print '<select class="flat" name="propal_statut">';
|
||||
if ($showempty) print '<option value=""> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($excludedraft)
|
||||
{
|
||||
if ($obj->code == 'Draft' || $obj->code == 'PR_DRAFT')
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($selected == $obj->id)
|
||||
{
|
||||
print '<option value="'.$obj->id.'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="'.$obj->id.'">';
|
||||
}
|
||||
$key=$obj->code;
|
||||
if ($langs->trans("PropalStatus".$key.($short?'Short':'')) != "PropalStatus".$key.($short?'Short':''))
|
||||
{
|
||||
print $langs->trans("PropalStatus".$key.($short?'Short':''));
|
||||
}
|
||||
else
|
||||
{
|
||||
$conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Opened','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Billed');
|
||||
if (! empty($conv_to_new_code[$obj->code])) $key=$conv_to_new_code[$obj->code];
|
||||
print ($langs->trans("PropalStatus".$key.($short?'Short':''))!="PropalStatus".$key.($short?'Short':''))?$langs->trans("PropalStatus".$key.($short?'Short':'')):$obj->label;
|
||||
}
|
||||
print '</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
$prefix='SupplierProposalStatus';
|
||||
|
||||
$langs->load("supplier_proposal");
|
||||
$listofstatus=array(0=>array('code'=>'PR_DRAFT'), 1=>array('code'=>'PR_OPEN'), 2=>array('code'=>'PR_SIGNED'), 3=>array('code'=>'PR_NOTSIGNED'), 4=>array('code'=>'PR_CLOSED'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$prefix="PropalStatus";
|
||||
|
||||
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
|
||||
$sql .= " WHERE active = 1";
|
||||
dol_syslog(get_class($this)."::selectProposalStatus", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$listofstatus[$obj->id]=array('id'=>$obj->id,'code'=>$obj->code,'label'=>$obj->label);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<select class="flat" name="propal_statut">';
|
||||
if ($showempty) print '<option value=""> </option>';
|
||||
|
||||
foreach($listofstatus as $key => $obj)
|
||||
{
|
||||
if ($excludedraft)
|
||||
{
|
||||
if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT')
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($selected == $obj['id'])
|
||||
{
|
||||
print '<option value="'.$obj['id'].'" selected>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="'.$obj['id'].'">';
|
||||
}
|
||||
$key=$obj['code'];
|
||||
if ($langs->trans($prefix."PropalStatus".$key.($short?'Short':'')) != $prefix."PropalStatus".$key.($short?'Short':''))
|
||||
{
|
||||
print $langs->trans($prefix."PropalStatus".$key.($short?'Short':''));
|
||||
}
|
||||
else
|
||||
{
|
||||
$conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Opened','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Billed');
|
||||
if (! empty($conv_to_new_code[$obj['code']])) $key=$conv_to_new_code[$obj['code']];
|
||||
print ($langs->trans($prefix.$key.($short?'Short':''))!=$prefix.$key.($short?'Short':''))?$langs->trans($prefix.$key.($short?'Short':'')):$obj['label'];
|
||||
}
|
||||
print '</option>';
|
||||
$i++;
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -229,7 +229,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<span class="error">'.$langs->trans("SmsNoPossibleRecipientFound");
|
||||
print '<span class="error">'.$langs->trans("SmsNoPossibleSenderFound");
|
||||
if (is_object($sms) && ! empty($sms->error)) print ' '.$sms->error;
|
||||
print '</span>';
|
||||
}
|
||||
@ -304,10 +304,10 @@ function limitChars(textarea, limit, infodiv)
|
||||
|
||||
<tr><td>'.$langs->trans("Priority").' :</td><td>
|
||||
<select name="priority" id="valid" class="flat">
|
||||
<option value="0">0</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3" selected>3</option>
|
||||
<option value="0">high</option>
|
||||
<option value="1">medium</option>
|
||||
<option value="2" selected>low</option>
|
||||
<option value="3">veryLow</option>
|
||||
</select></td></tr>
|
||||
|
||||
<tr><td>'.$langs->trans("Type").' :</td><td>
|
||||
|
||||
@ -222,19 +222,18 @@ class Link extends CommonObject
|
||||
/**
|
||||
* Loads all links from database
|
||||
*
|
||||
* @param array $links array of Link objects to fill
|
||||
* @param array $links array of Link objects to fill
|
||||
* @param string $objecttype type of the associated object in dolibarr
|
||||
* @param int $objectid id of the associated object in dolibarr
|
||||
* @param string $sortfield field used to sort
|
||||
* @param string $sortorder sort order
|
||||
* @return 1 if ok, 0 if no records, -1 if error
|
||||
*
|
||||
* */
|
||||
* @return int 1 if ok, 0 if no records, -1 if error
|
||||
**/
|
||||
public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
if ($sortfield) {
|
||||
@ -273,12 +272,36 @@ class Link extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return nb of links
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
* @param string $objecttype Type of the associated object in dolibarr
|
||||
* @param int $objectid Id of the associated object in dolibarr
|
||||
* @return int Nb of links, -1 if error
|
||||
**/
|
||||
public static function count($db, $objecttype, $objectid)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "links";
|
||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) return $obj->nb;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a link from database
|
||||
*
|
||||
* @param int $rowid Id of link to load
|
||||
* @return int 1 if ok, 0 if no record found, -1 if error
|
||||
*
|
||||
**/
|
||||
public function fetch($rowid=null)
|
||||
{
|
||||
@ -333,7 +356,7 @@ class Link extends CommonObject
|
||||
$result=$this->call_trigger('LINK_DELETE',$user);
|
||||
if ($result < 0) return -1;
|
||||
// End call triggers
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Remove link
|
||||
@ -347,7 +370,6 @@ class Link extends CommonObject
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
|
||||
|
||||
if (! $error) {
|
||||
$this->db->commit();
|
||||
|
||||
|
||||
133
htdocs/core/class/utils.class.php
Normal file
133
htdocs/core/class/utils.class.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* 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/core/class/utils.class.php
|
||||
* \ingroup core
|
||||
* \brief File for Utils class
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage utility methods
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
var $db;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Purge files into directory of data files.
|
||||
*
|
||||
* @param string $choice Choice of purge mode ('tempfiles', 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfiles')
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function purgeFiles($choice='tempfilesold')
|
||||
{
|
||||
global $conf, $langs, $dolibarr_main_data_root;
|
||||
|
||||
dol_syslog("Utils::purgeFiles choice=".$choice, LOG_DEBUG);
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$filesarray=array();
|
||||
if (empty($choice)) $choice='tempfilesold';
|
||||
|
||||
if ($choice=='tempfiles' || $choice=='tempfilesold')
|
||||
{
|
||||
// Delete temporary files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"directories",1,'^temp$','','','',2);
|
||||
if ($choice == 'tempfilesold')
|
||||
{
|
||||
$now = dol_now();
|
||||
foreach($filesarray as $key => $val)
|
||||
{
|
||||
if ($val['date'] > ($now - (24 * 3600))) unset($filesarray[$key]); // Discard files not older than 24h
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($choice=='allfiles')
|
||||
{
|
||||
// Delete all files
|
||||
if ($dolibarr_main_data_root)
|
||||
{
|
||||
$filesarray=dol_dir_list($dolibarr_main_data_root,"all",0,'','install\.lock$');
|
||||
}
|
||||
}
|
||||
|
||||
if ($choice=='logfile')
|
||||
{
|
||||
// Define filelog to discard it from purge
|
||||
$filelog='';
|
||||
if (! empty($conf->syslog->enabled))
|
||||
{
|
||||
$filelog=SYSLOG_FILE;
|
||||
$filelog=preg_replace('/DOL_DATA_ROOT/i',DOL_DATA_ROOT,$filelog);
|
||||
}
|
||||
|
||||
$filesarray[]=array('fullname'=>$filelog,'type'=>'file');
|
||||
}
|
||||
|
||||
$count=0;
|
||||
if (count($filesarray))
|
||||
{
|
||||
foreach($filesarray as $key => $value)
|
||||
{
|
||||
//print "x ".$filesarray[$key]['fullname']."<br>\n";
|
||||
if ($filesarray[$key]['type'] == 'dir')
|
||||
{
|
||||
$count+=dol_delete_dir_recursive($filesarray[$key]['fullname']);
|
||||
}
|
||||
elseif ($filesarray[$key]['type'] == 'file')
|
||||
{
|
||||
// If (file that is not logfile) or (if logfile with option logfile)
|
||||
if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile')
|
||||
{
|
||||
$count+=(dol_delete_file($filesarray[$key]['fullname'])?1:0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update cachenbofdoc
|
||||
if (! empty($conf->ecm->enabled) && $choice=='allfiles')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
|
||||
$ecmdirstatic = new EcmDirectory($this->db);
|
||||
$result = $ecmdirstatic->refreshcachenboffile(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($count > 0) $this->output=$langs->trans("PurgeNDirectoriesDeleted", $count);
|
||||
else $this->output=$langs->trans("PurgeNothingToDelete");
|
||||
|
||||
//return $count;
|
||||
return 0; // This function can be called by cron so must return 0 if OK
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 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
|
||||
@ -75,7 +76,6 @@ class DoliDBMysqli extends DoliDB
|
||||
$this->ok = false;
|
||||
$this->error="Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.";
|
||||
dol_syslog(get_class($this)."::DoliDBMysqli : Mysqli PHP functions for using Mysqli driver are not available in this version of PHP. Try to use another driver.",LOG_ERR);
|
||||
return $this->ok;
|
||||
}
|
||||
|
||||
if (! $host)
|
||||
@ -84,7 +84,6 @@ class DoliDBMysqli extends DoliDB
|
||||
$this->ok = false;
|
||||
$this->error=$langs->trans("ErrorWrongHostParameter");
|
||||
dol_syslog(get_class($this)."::DoliDBMysqli : Connect error, wrong host parameters",LOG_ERR);
|
||||
return $this->ok;
|
||||
}
|
||||
|
||||
// Try server connection
|
||||
@ -96,7 +95,6 @@ class DoliDBMysqli extends DoliDB
|
||||
$this->ok = false;
|
||||
$this->error = $this->db->connect_error;
|
||||
dol_syslog(get_class($this) . "::DoliDBMysqli Connect error: " . $this->error, LOG_ERR);
|
||||
return $this->ok;
|
||||
} else {
|
||||
$this->connected = true;
|
||||
$this->ok = true;
|
||||
@ -115,11 +113,9 @@ class DoliDBMysqli extends DoliDB
|
||||
$clientmustbe='';
|
||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
||||
if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1';
|
||||
if ($this->db->character_set_name() != $clientmustbe)
|
||||
{
|
||||
$this->query("SET NAMES '".$clientmustbe."'", $this->db);
|
||||
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
||||
}
|
||||
if ($this->db->character_set_name() != $clientmustbe) {
|
||||
$this->db->set_charset($clientmustbe);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -141,15 +137,11 @@ class DoliDBMysqli extends DoliDB
|
||||
$clientmustbe='';
|
||||
if (preg_match('/UTF-8/i',$conf->file->character_set_client)) $clientmustbe='utf8';
|
||||
if (preg_match('/ISO-8859-1/i',$conf->file->character_set_client)) $clientmustbe='latin1';
|
||||
if ($this->db->character_set_name() != $clientmustbe)
|
||||
{
|
||||
$this->query("SET NAMES '".$clientmustbe."'", $this->db);
|
||||
//$this->query("SET CHARACTER SET ". $this->forcecharset);
|
||||
}
|
||||
if ($this->db->character_set_name() != $clientmustbe) {
|
||||
$this->db->set_charset($clientmustbe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->ok;
|
||||
}
|
||||
|
||||
|
||||
@ -203,7 +195,7 @@ class DoliDBMysqli extends DoliDB
|
||||
*/
|
||||
function getVersion()
|
||||
{
|
||||
return $this->db->get_server_info();
|
||||
return $this->db->server_info;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,7 +205,7 @@ class DoliDBMysqli extends DoliDB
|
||||
*/
|
||||
function getDriverInfo()
|
||||
{
|
||||
return $this->db->get_client_info();
|
||||
return $this->db->client_info;
|
||||
}
|
||||
|
||||
|
||||
@ -381,7 +373,7 @@ class DoliDBMysqli extends DoliDB
|
||||
*/
|
||||
function escape($stringtoencode)
|
||||
{
|
||||
return addslashes($stringtoencode);
|
||||
return $this->db->real_escape_string($stringtoencode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -21,7 +21,8 @@
|
||||
|
||||
/**
|
||||
* addLineBatch
|
||||
*
|
||||
* @deprecated replaced by addDispatchLine and moved to module folder and file fourn/js/lib_dispatch.js
|
||||
*
|
||||
* @param index int number of produt. 0 = first product line
|
||||
*/
|
||||
function addLineBatch(index)
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/js/timepicker.js.php
|
||||
* \file htdocs/core/js/select2_locale.js.php
|
||||
* \brief File that include javascript functions for timepicker
|
||||
*/
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ function agenda_prepare_head()
|
||||
*/
|
||||
function actions_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -446,11 +446,13 @@ function actions_prepare_head($object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->agenda->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if ($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -480,9 +482,9 @@ function calendars_prepare_head($param)
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewCal");
|
||||
$head[$h][2] = 'cardmonth';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewDay");
|
||||
$head[$h][2] = 'cardday';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_week'.($param?'&'.$param:'');
|
||||
@ -490,13 +492,20 @@ function calendars_prepare_head($param)
|
||||
$head[$h][2] = 'cardweek';
|
||||
$h++;
|
||||
|
||||
//$paramday=$param;
|
||||
//if (preg_match('/&month=\d+/',$paramday) && ! preg_match('/&day=\d+/',$paramday)) $paramday.='&day=1';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewDay");
|
||||
$head[$h][2] = 'cardday';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_month'.($param?'&'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewCal");
|
||||
$head[$h][2] = 'cardmonth';
|
||||
$h++;
|
||||
|
||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
if (! empty($conf->global->AGENDA_SHOW_PERTYPE))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/pertype.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewPerType");
|
||||
$head[$h][2] = 'cardpertype';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/peruser.php'.($param?'?'.$param:'');
|
||||
$head[$h][1] = $langs->trans("ViewPerUser");
|
||||
$head[$h][2] = 'cardperuser';
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function bank_prepare_head(Account $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -74,11 +74,13 @@ function bank_prepare_head(Account $object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -177,11 +177,14 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->societe->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function contact_prepare_head(Contact $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
@ -74,11 +74,13 @@ function contact_prepare_head(Contact $object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->societe->dir_output . "/contact/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@
|
||||
*/
|
||||
function contract_prepare_head(Contrat $object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -66,11 +67,13 @@ function contract_prepare_head(Contrat $object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ function donation_admin_prepare_head()
|
||||
*/
|
||||
function donation_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -79,11 +79,13 @@ function donation_prepare_head($object)
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
function expensereport_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -46,11 +46,13 @@ function expensereport_prepare_head($object)
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function fichinter_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("fichinter");
|
||||
|
||||
$h = 0;
|
||||
@ -78,11 +78,13 @@ function fichinter_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -1176,6 +1176,8 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
||||
else $ok=unlink($filename);
|
||||
if ($ok) dol_syslog("Removed file ".$filename, LOG_DEBUG);
|
||||
else dol_syslog("Failed to remove file ".$filename, LOG_WARNING);
|
||||
// TODO Failure to remove can be because file was already removed or because of permission
|
||||
// If error because of not exists, we must can return true but we should return false if this is a permission problem
|
||||
}
|
||||
}
|
||||
else dol_syslog("No files to delete found", LOG_WARNING);
|
||||
@ -1186,7 +1188,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
||||
if ($nophperrors) $ok=@unlink($file_osencoded);
|
||||
else $ok=unlink($file_osencoded);
|
||||
if ($ok) dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG);
|
||||
else dol_syslog("Failed to remove file ".$file_osencoded, LOG_WARNING);
|
||||
else dol_syslog("Failed to remove file ".$file_osencoded, LOG_WARNING);
|
||||
}
|
||||
|
||||
return $ok;
|
||||
@ -1438,58 +1440,73 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
||||
dol_syslog('dol_add_file_process upload_dir='.$upload_dir.' allowoverwrite='.$allowoverwrite.' donotupdatesession='.$donotupdatesession.' savingdocmask='.$savingdocmask, LOG_DEBUG);
|
||||
if (dol_mkdir($upload_dir) >= 0)
|
||||
{
|
||||
// Define $destpath (path to file including filename) and $destfile (only filename)
|
||||
$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
|
||||
$destfile=$_FILES[$varfiles]['name'];
|
||||
|
||||
$savingdocmask = dol_sanitizeFileName($savingdocmask);
|
||||
|
||||
if ($savingdocmask)
|
||||
$TFile = $_FILES[$varfiles];
|
||||
if (!is_array($TFile['name']))
|
||||
{
|
||||
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
||||
$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
||||
foreach ($TFile as $key => &$val)
|
||||
{
|
||||
$val = array($val);
|
||||
}
|
||||
}
|
||||
|
||||
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
||||
if (is_numeric($resupload) && $resupload > 0)
|
||||
|
||||
$nbfile = count($TFile['name']);
|
||||
|
||||
for ($i = 0; $i < $nbfile; $i++)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
|
||||
// Define $destpath (path to file including filename) and $destfile (only filename)
|
||||
$destpath=$upload_dir . "/" . $TFile['name'][$i];
|
||||
$destfile=$TFile['name'][$i];
|
||||
|
||||
$savingdocmask = dol_sanitizeFileName($savingdocmask);
|
||||
|
||||
if ($savingdocmask)
|
||||
{
|
||||
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
$destfile=preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
}
|
||||
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
|
||||
if (is_numeric($resupload) && $resupload > 0)
|
||||
{
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
|
||||
|
||||
if (empty($donotupdatesession))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->add_attached_files($destpath, $destfile, $_FILES[$varfiles]['type']);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
if (empty($donotupdatesession))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]);
|
||||
}
|
||||
if (image_format_supported($destpath) == 1)
|
||||
{
|
||||
// Create small thumbs for image (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
||||
}
|
||||
if (image_format_supported($destpath) == 1)
|
||||
else
|
||||
{
|
||||
// Create small thumbs for image (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
}
|
||||
|
||||
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($resupload < 0) // Unknown error
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
|
||||
}
|
||||
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
|
||||
}
|
||||
else // Known error
|
||||
{
|
||||
setEventMessages($langs->trans($resupload), null, 'errors');
|
||||
$langs->load("errors");
|
||||
if ($resupload < 0) // Unknown error
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
|
||||
}
|
||||
else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
|
||||
}
|
||||
else // Known error
|
||||
{
|
||||
setEventMessages($langs->trans($resupload), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} elseif ($link) {
|
||||
if (dol_mkdir($upload_dir) >= 0) {
|
||||
|
||||
@ -33,7 +33,8 @@
|
||||
*/
|
||||
function facturefourn_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -69,11 +70,13 @@ function facturefourn_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$object->ref;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
@ -96,7 +99,7 @@ function facturefourn_prepare_head($object)
|
||||
*/
|
||||
function ordersupplier_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -141,11 +144,13 @@ function ordersupplier_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ function dol_getprefix()
|
||||
* To link to a module file from a core file, then this function can be used (call by hook / trigger / speciales pages)
|
||||
*
|
||||
* @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
|
||||
* @param string $classname Class name
|
||||
* @param string $classname Class name (deprecated)
|
||||
* @return bool True if load is a success, False if it fails
|
||||
*/
|
||||
function dol_include_once($relpath, $classname='')
|
||||
@ -2994,7 +2994,11 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
|
||||
// Left
|
||||
if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, '', $pictoisfullpath).'</td>';
|
||||
print '<td class="nobordernopadding"><div class="titre">'.$titre.'</div></td>';
|
||||
print '<td class="nobordernopadding"><div class="titre">'.$titre;
|
||||
if (!empty($totalnboflines) && !empty($titre)) {
|
||||
print ' ('.$totalnboflines.')';
|
||||
}
|
||||
print '</div></td>';
|
||||
|
||||
// Center
|
||||
if ($center)
|
||||
|
||||
@ -894,7 +894,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
dol_syslog("functions2::get_next_value", LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
function holiday_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -41,11 +41,13 @@ function holiday_prepare_head($object)
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -33,7 +33,8 @@
|
||||
*/
|
||||
function facture_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -86,11 +87,13 @@ function facture_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function loan_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$tab = 0;
|
||||
$head = array();
|
||||
@ -58,11 +58,13 @@ function loan_prepare_head($object)
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $tab,'loan');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->loan->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$tab][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$tab][2] = 'documents';
|
||||
$tab++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function member_prepare_head(Adherent $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -86,11 +86,13 @@ function member_prepare_head(Adherent $object)
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,1,$object,'member').'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
function commande_prepare_head(Commande $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
|
||||
$langs->load("orders");
|
||||
|
||||
@ -95,11 +95,13 @@ function commande_prepare_head(Commande $object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
function product_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("products");
|
||||
|
||||
$h = 0;
|
||||
@ -132,12 +132,14 @@ function product_prepare_head($object)
|
||||
|
||||
// Attachments
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -34,7 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
*/
|
||||
function project_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -77,11 +78,13 @@ function project_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
@ -251,7 +254,7 @@ function project_admin_prepare_head()
|
||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
||||
* @param string $parent Id of parent project to show (0 to show all)
|
||||
* @param Task[] $lines Array of lines
|
||||
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
||||
* @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature.
|
||||
* @param string $var Color
|
||||
* @param int $showproject Show project columns
|
||||
* @param int $taskrole Array of roles of user for each tasks
|
||||
@ -281,12 +284,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
if ($parent == 0) $level = 0;
|
||||
if ($parent == 0 && $level >= 0) $level = 0; // if $level = -1, we dont' use sublevel recursion, we show all lines
|
||||
|
||||
// Process line
|
||||
// print "i:".$i."-".$lines[$i]->fk_project.'<br>';
|
||||
|
||||
if ($lines[$i]->fk_parent == $parent)
|
||||
if ($lines[$i]->fk_parent == $parent || $level < 0) // if $level = -1, we dont' use sublevel recursion, we show all lines
|
||||
{
|
||||
// Show task line.
|
||||
$showline=1;
|
||||
@ -348,6 +351,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
$projectstatic->id=$lines[$i]->fk_project;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
$projectstatic->public=$lines[$i]->public;
|
||||
$projectstatic->title=$lines[$i]->projectlabel;
|
||||
if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
|
||||
else print $projectstatic->getNomUrl(1,'nolink');
|
||||
//if ($showlineingray) print '</i>';
|
||||
@ -395,7 +399,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
// Date end
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
$taskstatic->projectstatus = $lines[$i]->projectstatus;
|
||||
$taskstatic->progress = $lines[$i]->progress;
|
||||
$taskstatic->fk_statut = $lines[$i]->status;
|
||||
$taskstatic->datee = $lines[$i]->date_end;
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
|
||||
$plannedworkloadoutputformat='allhourmin';
|
||||
@ -416,14 +425,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
//else print '--:--';
|
||||
print '</td>';
|
||||
|
||||
// Progress declared
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->progress != '')
|
||||
{
|
||||
print $lines[$i]->progress.' %';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Time spent
|
||||
print '<td align="right">';
|
||||
if ($showlineingray) print '<i>';
|
||||
@ -443,6 +444,14 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Progress declared
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->progress != '')
|
||||
{
|
||||
print $lines[$i]->progress.' %';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Tick to drag and drop
|
||||
if ($addordertick)
|
||||
{
|
||||
@ -453,9 +462,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
if (! $showlineingray) $inc++;
|
||||
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||
$level--;
|
||||
if ($level >= 0) // Call sublevels
|
||||
{
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||
$level--;
|
||||
}
|
||||
|
||||
$total_projectlinesa_spent += $lines[$i]->duration;
|
||||
$total_projectlinesa_planned += $lines[$i]->planned_workload;
|
||||
if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
|
||||
@ -467,7 +480,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
}
|
||||
}
|
||||
|
||||
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level==0)
|
||||
if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0) && $level <= 0)
|
||||
{
|
||||
print '<tr class="liste_total nodrag nodrop">';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
@ -478,13 +491,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
print '<td align="right" class="nowrap liste_total">';
|
||||
print convertSecondToTime($total_projectlinesa_planned, 'allhourmin');
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right" class="nowrap liste_total">';
|
||||
print convertSecondToTime($total_projectlinesa_spent, 'allhourmin');
|
||||
print '</td>';
|
||||
print '<td align="right" class="nowrap liste_total">';
|
||||
if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned,2).' %';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
if ($addordertick) print '<td class="hideonsmartphone"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -965,12 +978,13 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
|
||||
// Get list of project with calculation on tasks
|
||||
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
|
||||
$sql2.= " p.dateo, p.datee,";
|
||||
$sql2.= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
|
||||
$sql2.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
|
||||
$sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")";
|
||||
$sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount";
|
||||
$sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee";
|
||||
$sql2.= " ORDER BY p.title, p.ref";
|
||||
|
||||
$var=true;
|
||||
@ -1013,12 +1027,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$userAccess = $projectstatic->restrictedProjectArea($user);
|
||||
if ($userAccess >= 0)
|
||||
{
|
||||
$projectstatic->ref=$objp->ref;
|
||||
$projectstatic->statut = $objp->status;
|
||||
$projectstatic->title = $objp->title;
|
||||
$projectstatic->datee = $db->jdate($objp->datee);
|
||||
$projectstatic->dateo = $db->jdate($objp->dateo);
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
$projectstatic->ref=$objp->ref;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
if (! in_array('projectlabel', $hiddenfields)) print ' - '.dol_trunc($objp->title,24);
|
||||
if (! in_array('projectlabel', $hiddenfields)) print '<br>'.dol_trunc($objp->title,24);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($objp->fk_soc > 0)
|
||||
@ -1039,7 +1058,6 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
if ($code) print $langs->trans("OppStatus".$code);
|
||||
print '</td>';
|
||||
}
|
||||
$projectstatic->statut = $objp->status;
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print '<td align="right">'.$objp->nb.'</td>';
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function propal_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("propal");
|
||||
$langs->load("compta");
|
||||
|
||||
@ -89,11 +89,13 @@ function propal_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -48,8 +48,6 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
|
||||
|
||||
if(! empty($varlink)) $varlink = '?'.$varlink;
|
||||
|
||||
if(! empty($varlink)) $varlink = '?'.$varlink;
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
|
||||
$head[$h][1] = $langs->trans("Report");
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
function salaries_prepare_head($object) {
|
||||
|
||||
global $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -43,11 +43,13 @@ function salaries_prepare_head($object) {
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
function supplier_proposal_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
$langs->load("supplier_proposal");
|
||||
$langs->load("compta");
|
||||
|
||||
@ -63,11 +63,13 @@ function supplier_proposal_prepare_head($object)
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->supplier_proposal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
function tax_prepare_head(ChargeSociales $object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
@ -53,11 +53,13 @@ function tax_prepare_head(ChargeSociales $object)
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'tax');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
function user_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$langs->load("users");
|
||||
|
||||
@ -117,11 +117,13 @@ function user_prepare_head($object)
|
||||
|
||||
// Attached files
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->user->dir_output . "/" . $object->id;
|
||||
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ delete from llx_menu where menu_handler=__HANDLER__ and entity=__ENTITY__;
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 10, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('societe|fournisseur', '( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 20, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('product|service', '$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 30, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->fournisseur->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|don|tax|salaries|loan', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read', '', 2, 50, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting|facture|don|tax|salaries|loan', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read', '', 2, 50, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('mailing|export|import|opensurvey', '$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read', '', 2, 90, __ENTITY__);
|
||||
@ -23,7 +23,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/ihm.php?leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 4, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/translation.php?leftmenu=setup', 'Translation', 1, 'admin', '', '', 2, 4, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__);
|
||||
@ -58,7 +58,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 310__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__);
|
||||
-- Home - Module Tools
|
||||
-- Added by ???
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 700__+MAX_llx_menu__, 'home', 'modulesadmintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=modulesadmintools', 'ModulesSystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="modulesadmintools"', __HANDLER__, 'left', 701__+MAX_llx_menu__, 'home', '', 700__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled || $leftmenu=="modulesadmintools"', __HANDLER__, 'left', 702__+MAX_llx_menu__, 'home', '', 700__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=home&leftmenu=modulesadmintools', 'InitAccountancy', 1, 'accountancy', '', '', 2, 0, __ENTITY__);
|
||||
-- Home - Menu users and groups
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
|
||||
@ -109,7 +111,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->supplier_order->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__);
|
||||
|
||||
-- Product - Categories
|
||||
@ -143,10 +145,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&viewstatut=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__);
|
||||
-- Commercial - Supplier's orders
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?action=create&leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5102__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/list.php?leftmenu=orders_suppliers&viewstatut=0', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 5108__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier', 'Statistics', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5100__+MAX_llx_menu__, 'commercial', 'orders_suppliers', 5__+MAX_llx_menu__, '/fourn/commande/index.php?leftmenu=orders_suppliers', 'SuppliersOrders', 0, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5101__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/card.php?action=create&leftmenu=orders_suppliers', 'NewOrder', 1, 'orders', '$user->rights->fournisseur->commande->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5102__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/fourn/commande/list.php?leftmenu=orders_suppliers&viewstatut=0', 'List', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_order->enabled', __HANDLER__, 'left', 5108__+MAX_llx_menu__, 'commercial', '', 5100__+MAX_llx_menu__, '/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier', 'Statistics', 1, 'orders', '$user->rights->fournisseur->commande->lire', '', 2, 7, __ENTITY__);
|
||||
-- Commercial - Contracts
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1400__+MAX_llx_menu__, 'commercial', 'contracts', 5__+MAX_llx_menu__, '/contrat/index.php?leftmenu=contracts', 'Contracts', 0, 'contracts', '$user->rights->contrat->lire', '', 2, 7, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->contrat->enabled', __HANDLER__, 'left', 1401__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/card.php?&action=create&leftmenu=contracts', 'NewContract', 1, 'contracts', '$user->rights->contrat->creer', '', 2, 0, __ENTITY__);
|
||||
@ -160,12 +162,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1501__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/card.php?action=create&leftmenu=ficheinter', 'NewIntervention', 1, 'interventions', '$user->rights->ficheinter->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1502__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/list.php?leftmenu=ficheinter', 'List', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->ficheinter->enabled', __HANDLER__, 'left', 1503__+MAX_llx_menu__, 'commercial', '', 1500__+MAX_llx_menu__, '/fichinter/stats/index.php?leftmenu=ficheinter', 'Statistics', 1, 'interventions', '$user->rights->ficheinter->lire', '', 2, 2, __ENTITY__);
|
||||
-- Accountancy - Supplier invoice
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'accountancy', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/impayees.php?leftmenu=suppliers_bills', 'Unpaid', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->fournisseur->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'accountancy', 'supplier_bills', 6__+MAX_llx_menu__, '/fourn/facture/list.php?leftmenu=suppliers_bills', 'BillsSuppliers', 0, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1601__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/card.php?action=create&leftmenu=suppliers_bills', 'NewBill', 1, 'bills', '$user->rights->fournisseur->facture->creer', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1602__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/impayees.php?leftmenu=suppliers_bills', 'Unpaid', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1603__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/fourn/facture/paiement.php?leftmenu=suppliers_bills', 'Payments', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__);
|
||||
-- Accountancy - Customer invoice
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__);
|
||||
@ -231,7 +234,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
-- Admin
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'home', '', 2400__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'admin', '$user->rights->accounting->fiscalyear', '', 0, 24, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'home', '', 2400__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'admin', '$user->rights->accounting->chartofaccount', '', 0, 25, __ENTITY__);
|
||||
-- Rapports
|
||||
-- Rapports compta simple
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
|
||||
@ -241,6 +244,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
-- Book Keeping
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2720__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 6__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?leftmenu=bookkeeping', 'Bookkeeping', 0, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2721__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2722__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 1, __ENTITY__);
|
||||
-- Fiscal year & Chart of accounts
|
||||
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'accountancy', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__);
|
||||
-- Check deposit
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1711__+MAX_llx_menu__, 'accountancy', 'checks', 14__+MAX_llx_menu__, '/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank', 'MenuChequeDeposits', 0, 'bills', '$user->rights->banque->lire', '', 2, 9, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '! empty($conf->banque->enabled) && (! empty($conf->facture->enabled)) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON)', __HANDLER__, 'left', 1712__+MAX_llx_menu__, 'accountancy', '', 1711__+MAX_llx_menu__, '/compta/paiement/cheque/card.php?leftmenu=checks&action=new', 'NewCheckDeposit', 1, 'compta', '$user->rights->banque->lire', '', 2, 0, __ENTITY__);
|
||||
@ -274,7 +284,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create&mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
-- Tools
|
||||
|
||||
@ -108,48 +108,6 @@ class MenuManager
|
||||
$menuArbo = new Menubase($this->db,'auguria');
|
||||
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu);
|
||||
|
||||
// Modules system tools
|
||||
// TODO Find a way to add parent menu only if child menu exists. For the moment, no other method than hard coded methods.
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->barcode->enabled) // TODO We should enabled module system tools entry without hardcoded test, but when at least one modules bringing such entries are on
|
||||
|| ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS))
|
||||
{
|
||||
if (empty($user->societe_id))
|
||||
{
|
||||
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && ($leftmenu=="modulesadmintools" && $user->admin))
|
||||
{
|
||||
$langs->load("products");
|
||||
$array_menu_product=array(
|
||||
'url'=>"/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools",
|
||||
'titre'=>$langs->trans("ProductVatMassChange"),
|
||||
'enabled'=>($user->admin?true:false),
|
||||
'perms'=>($user->admin?true:false),
|
||||
'fk_mainmenu'=>'home',
|
||||
'fk_leftmenu'=>'modulesadmintools',
|
||||
'fk_menu'=>-1,
|
||||
'mainmenu'=>'home',
|
||||
'leftmenu'=>'modulesadmintools_massvat',
|
||||
'type'=>'left',
|
||||
'position'=>20
|
||||
);
|
||||
array_unshift($tabMenu,$array_menu_product); // add at beginning of array
|
||||
}
|
||||
// Main menu title
|
||||
$array_menu_product=array(
|
||||
'url'=>"/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools",
|
||||
'titre'=>$langs->trans("ModulesSystemTools"),
|
||||
'enabled'=>($user->admin?true:false),
|
||||
'perms'=>($user->admin?true:false),
|
||||
'fk_mainmenu'=>'home',
|
||||
'fk_menu'=>-1,
|
||||
'mainmenu'=>'home',
|
||||
'leftmenu'=>'modulesadmintools',
|
||||
'type'=>'left',
|
||||
'position'=>20
|
||||
);
|
||||
array_unshift($tabMenu,$array_menu_product); // add at beginning of array
|
||||
}
|
||||
}
|
||||
|
||||
$this->tabMenu=$tabMenu;
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/index.php?mainmenu=home&leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", '');
|
||||
$menu->add('/index.php?mainmenu=home&leftmenu=home', $langs->trans("Home"), 0, $showmode, $atarget, "home", '');
|
||||
|
||||
// Third parties
|
||||
$tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
|
||||
@ -114,10 +114,13 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
$menuqualified=0;
|
||||
if (! empty($conf->propal->enabled)) $menuqualified++;
|
||||
if (! empty($conf->commande->enabled)) $menuqualified++;
|
||||
if (! empty($conf->fournisseur->enabled)) $menuqualified++;
|
||||
if (! empty($conf->supplier_order->enabled)) $menuqualified++;
|
||||
if (! empty($conf->contrat->enabled)) $menuqualified++;
|
||||
if (! empty($conf->ficheinter->enabled)) $menuqualified++;
|
||||
$tmpentry=array('enabled'=>$menuqualified, 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), 'module'=>'propal|commande|fournisseur|contrat|ficheinter');
|
||||
$tmpentry=array(
|
||||
'enabled'=>$menuqualified,
|
||||
'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)),
|
||||
'module'=>'propal|commande|supplier_order|contrat|ficheinter');
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
@ -135,9 +138,19 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
|
||||
}
|
||||
|
||||
// Financial
|
||||
$tmpentry=array('enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->don->enabled) || ! empty($conf->tax->enabled) || ! empty($conf->salaries->enabled) || ! empty($conf->fournisseur->enabled) || ! empty($conf->loan->enabled)),
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
|
||||
'module'=>'comptabilite|accounting|facture|don|tax|salaries|loan');
|
||||
$menuqualified=0;
|
||||
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
|
||||
if (! empty($conf->accounting->enabled)) $menuqualified++;
|
||||
if (! empty($conf->facture->enabled)) $menuqualified++;
|
||||
if (! empty($conf->don->enabled)) $menuqualified++;
|
||||
if (! empty($conf->tax->enabled)) $menuqualified++;
|
||||
if (! empty($conf->salaries->enabled)) $menuqualified++;
|
||||
if (! empty($conf->supplier_invoice->enabled)) $menuqualified++;
|
||||
if (! empty($conf->loan->enabled)) $menuqualified++;
|
||||
$tmpentry=array(
|
||||
'enabled'=>$menuqualified,
|
||||
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
|
||||
'module'=>'comptabilite|accounting|facture|supplier_invoice|don|tax|salaries|loan');
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
@ -473,105 +486,113 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
$langs->load("users");
|
||||
|
||||
//if ($user->admin)
|
||||
//{
|
||||
// Home - dashboard
|
||||
$newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("Dashboard"), 0, 1, '', $mainmenu, 'home');
|
||||
|
||||
// Setup
|
||||
$newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup');
|
||||
if (empty($leftmenu) || $leftmenu=="setup")
|
||||
{
|
||||
$langs->load("admin");
|
||||
$langs->load("help");
|
||||
|
||||
// Setup
|
||||
$newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup');
|
||||
if (empty($leftmenu) || $leftmenu=="setup")
|
||||
$warnpicto='';
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
|
||||
{
|
||||
$langs->load("admin");
|
||||
$langs->load("help");
|
||||
|
||||
$warnpicto='';
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto =' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
}
|
||||
$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto,1);
|
||||
$warnpicto='';
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
}
|
||||
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
|
||||
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
|
||||
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
|
||||
if (! in_array($langs->defaultlang,array('en_US')))
|
||||
{
|
||||
$newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
|
||||
}
|
||||
$newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1);
|
||||
$newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1);
|
||||
$newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"),1);
|
||||
$newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
||||
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
|
||||
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"),1);
|
||||
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||
$langs->load("errors");
|
||||
$warnpicto =' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
}
|
||||
$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto,1);
|
||||
$warnpicto='';
|
||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
}
|
||||
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
|
||||
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
|
||||
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
|
||||
}
|
||||
|
||||
// System tools
|
||||
$newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("SystemTools"), 0, $user->admin, '', $mainmenu, 'admintools');
|
||||
if (empty($leftmenu) || preg_match('/^admintools/',$leftmenu))
|
||||
{
|
||||
$langs->load("admin");
|
||||
$langs->load("help");
|
||||
$newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
|
||||
$newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1);
|
||||
$newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1);
|
||||
$newmenu->add("/admin/security_other.php?mainmenu=home", $langs->trans("Security"),1);
|
||||
$newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
||||
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
|
||||
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("Dictionary"),1);
|
||||
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||
}
|
||||
|
||||
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
|
||||
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2);
|
||||
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2);
|
||||
//if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 2);
|
||||
$newmenu->add('/admin/system/browser.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoBrowser'), 1);
|
||||
$newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1);
|
||||
$newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1);
|
||||
$newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1);
|
||||
//if (function_exists('xdebug_is_enabled')) $newmenu->add('/admin/system/xdebug.php', $langs->trans('XDebug'),1);
|
||||
$newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
|
||||
if (function_exists('eaccelerator_info')) $newmenu->add("/admin/tools/eaccelerator.php?mainmenu=home&leftmenu=admintools", $langs->trans("EAccelerator"),1);
|
||||
//$newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"),1);
|
||||
$newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"),1);
|
||||
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"),1);
|
||||
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"),1);
|
||||
$newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"),1);
|
||||
$newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"),1);
|
||||
$newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"),1);
|
||||
$newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('About'), 1);
|
||||
$newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
|
||||
}
|
||||
// System tools
|
||||
$newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("SystemTools"), 0, $user->admin, '', $mainmenu, 'admintools');
|
||||
if (empty($leftmenu) || preg_match('/^admintools/',$leftmenu))
|
||||
{
|
||||
$langs->load("admin");
|
||||
$langs->load("help");
|
||||
|
||||
// Modules system tools
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->barcode->enabled) // TODO We should enabled module system tools entry without hardcoded test, but when at least one modules bringing such entries are on
|
||||
|| ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS)) // Some external modules may need to force to have this entry on.
|
||||
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
|
||||
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Modules'), 2);
|
||||
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('Triggers'), 2);
|
||||
//if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/filecheck.php?mainmenu=home&leftmenu=admintools_info', $langs->trans('FileCheck'), 2);
|
||||
$newmenu->add('/admin/system/browser.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoBrowser'), 1);
|
||||
$newmenu->add('/admin/system/os.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoOS'), 1);
|
||||
$newmenu->add('/admin/system/web.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoWebServer'), 1);
|
||||
$newmenu->add('/admin/system/phpinfo.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoPHP'), 1);
|
||||
//if (function_exists('xdebug_is_enabled')) $newmenu->add('/admin/system/xdebug.php', $langs->trans('XDebug'),1);
|
||||
$newmenu->add('/admin/system/database.php?mainmenu=home&leftmenu=admintools', $langs->trans('InfoDatabase'), 1);
|
||||
if (function_exists('eaccelerator_info')) $newmenu->add("/admin/tools/eaccelerator.php?mainmenu=home&leftmenu=admintools", $langs->trans("EAccelerator"),1);
|
||||
//$newmenu->add("/admin/system/perf.php?mainmenu=home&leftmenu=admintools", $langs->trans("InfoPerf"),1);
|
||||
$newmenu->add("/admin/tools/purge.php?mainmenu=home&leftmenu=admintools", $langs->trans("Purge"),1);
|
||||
$newmenu->add("/admin/tools/dolibarr_export.php?mainmenu=home&leftmenu=admintools", $langs->trans("Backup"),1);
|
||||
$newmenu->add("/admin/tools/dolibarr_import.php?mainmenu=home&leftmenu=admintools", $langs->trans("Restore"),1);
|
||||
$newmenu->add("/admin/tools/update.php?mainmenu=home&leftmenu=admintools", $langs->trans("MenuUpgrade"),1);
|
||||
$newmenu->add("/admin/tools/listevents.php?mainmenu=home&leftmenu=admintools", $langs->trans("Audit"),1);
|
||||
$newmenu->add("/admin/tools/listsessions.php?mainmenu=home&leftmenu=admintools", $langs->trans("Sessions"),1);
|
||||
$newmenu->add('/admin/system/about.php?mainmenu=home&leftmenu=admintools', $langs->trans('About'), 1);
|
||||
$newmenu->add("/support/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
|
||||
}
|
||||
|
||||
// Modules system tools
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled) || ! empty($conf->barcode->enabled) // TODO We should enabled module system tools entry without hardcoded test, but when at least one modules bringing such entries are on
|
||||
|| ! empty($conf->global->MAIN_MENU_ENABLE_MODULETOOLS)) // Some external modules may need to force to have this entry on.
|
||||
{
|
||||
if (empty($user->societe_id))
|
||||
{
|
||||
if (empty($user->societe_id))
|
||||
$newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, $user->admin, '', $mainmenu, 'modulesadmintools');
|
||||
// Special case: This entry can't be embedded into modules because we need it for both module service and products and we don't want duplicate lines.
|
||||
if ((empty($leftmenu) || $leftmenu=="modulesadmintools") && $user->admin)
|
||||
{
|
||||
$newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ModulesSystemTools"), 0, $user->admin, '', $mainmenu, 'modulesadmintools');
|
||||
// Special case: This entry can't be embedded into modules because we need it for both module service and products and we don't want duplicate lines.
|
||||
if ((empty($leftmenu) || $leftmenu=="modulesadmintools") && $user->admin)
|
||||
$langs->load("products");
|
||||
$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$langs->load("products");
|
||||
$newmenu->add("/product/admin/product_tools.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
|
||||
$langs->load("accountancy");
|
||||
$newmenu->add("/accountancy/admin/productaccount.php?mainmenu=home&leftmenu=modulesadmintools", $langs->trans("InitAccountancy"), 1, $user->admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users');
|
||||
if ($user->rights->user->user->lire)
|
||||
{
|
||||
if (empty($leftmenu) || $leftmenu == 'none' || $leftmenu=="users")
|
||||
if (! empty($leftmenu) && $leftmenu=="users")
|
||||
{
|
||||
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/card.php?action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home');
|
||||
$newmenu->add("/user/index.php", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/hierarchy.php", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home');
|
||||
$newmenu->add("/user/index.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("", $langs->trans("Groups"), 1, $user->rights->user->user->lire || $user->admin);
|
||||
$newmenu->add("/user/group/card.php?action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin);
|
||||
$newmenu->add("/user/group/index.php", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin);
|
||||
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin);
|
||||
$newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -708,7 +729,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
|
||||
// Suppliers orders
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
if (! empty($conf->supplier_order->enabled))
|
||||
{
|
||||
$langs->load("orders");
|
||||
$newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers",$langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400);
|
||||
@ -750,6 +771,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
|
||||
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
|
||||
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
|
||||
|
||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
}
|
||||
@ -792,8 +815,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/compta/facture/mergepdftool.php",$langs->trans("MergingPDFTool"),1,$user->rights->facture->lire);
|
||||
}
|
||||
|
||||
// Suppliers
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
|
||||
// Suppliers invoices
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->supplier_invoice->enabled))
|
||||
{
|
||||
$langs->load("bills");
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
|
||||
@ -819,8 +842,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
// if (empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire);
|
||||
}
|
||||
|
||||
// Supplier Orders
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
// Supplier Orders to bill
|
||||
if (! empty($conf->supplier_invoice->enabled))
|
||||
{
|
||||
if (! empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE))
|
||||
{
|
||||
@ -921,7 +944,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
if (empty($leftmenu) || $leftmenu=="dispatch_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
|
||||
if (empty($leftmenu) || $leftmenu=="dispatch_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
|
||||
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
if (! empty($conf->supplier_invoice->enabled))
|
||||
{
|
||||
$newmenu->add("/accountancy/supplier/index.php?leftmenu=dispatch_supplier&mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_supplier');
|
||||
if (empty($leftmenu) || $leftmenu=="dispatch_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
|
||||
@ -1125,7 +1148,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer);
|
||||
$newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
|
||||
$newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire);
|
||||
if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
|
||||
if ($conf->supplier_order->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire);
|
||||
$newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer);
|
||||
}
|
||||
|
||||
@ -1144,53 +1167,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Menu SUPPLIERS
|
||||
*/
|
||||
/*
|
||||
if ($mainmenu == 'suppliers')
|
||||
{
|
||||
$langs->load("suppliers");
|
||||
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
|
||||
|
||||
// Security check
|
||||
$newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
|
||||
$newmenu->add("/societe/list.php?type=f",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
|
||||
$newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire);
|
||||
$newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
|
||||
}
|
||||
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
$langs->load("bills");
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=orders", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'orders');
|
||||
$newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer);
|
||||
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$langs->load("orders");
|
||||
$newmenu->add("/fourn/commande/index.php?leftmenu=suppliers",$langs->trans("Orders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'suppliers');
|
||||
$newmenu->add("/societe/societe.php?leftmenu=supplier", $langs->trans("NewOrder"), 1, $user->rights->fournisseur->commande->creer);
|
||||
$newmenu->add("/fourn/commande/list.php?leftmenu=suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
if (! empty($conf->categorie->enabled))
|
||||
{
|
||||
$langs->load("categories");
|
||||
$newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat');
|
||||
$newmenu->add("/categories/card.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
|
||||
//if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Menu PROJECTS
|
||||
*/
|
||||
@ -1215,7 +1191,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
{
|
||||
// Project affected to user
|
||||
$newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/tasks/list.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/activity/perweek.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
|
||||
|
||||
|
||||
@ -906,17 +906,22 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$label = isset($this->cronjobs[$key]['label'])?$this->cronjobs[$key]['label']:'';
|
||||
$jobtype = isset($this->cronjobs[$key]['jobtype'])?$this->cronjobs[$key]['jobtype']:'';
|
||||
$class = isset($this->cronjobs[$key]['class'])?$this->cronjobs[$key]['class']:'';
|
||||
$objectname = isset($this->cronjobs[$key]['objectname'])?$this->cronjobs[$key]['objectname']:'';
|
||||
$method = isset($this->cronjobs[$key]['method'])?$this->cronjobs[$key]['method']:'';
|
||||
$command = isset($this->cronjobs[$key]['command'])?$this->cronjobs[$key]['command']:'';
|
||||
$parameters = isset($this->cronjobs[$key]['parameters'])?$this->cronjobs[$key]['parameters']:'';
|
||||
$comment = isset($this->cronjobs[$key]['comment'])?$this->cronjobs[$key]['comment']:'';
|
||||
$frequency = isset($this->cronjobs[$key]['frequency'])?$this->cronjobs[$key]['frequency']:'';
|
||||
$unitfrequency = isset($this->cronjobs[$key]['unitfrequency'])?$this->cronjobs[$key]['unitfrequency']:'';
|
||||
|
||||
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
|
||||
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
|
||||
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:'';
|
||||
|
||||
// Search if boxes def already present
|
||||
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
|
||||
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
|
||||
if ($class) $sql.= " AND classesname = '".$this->db->escape($class)."'";
|
||||
if ($objectname) $sql.= " AND objectname = '".$this->db->escape($objectname)."'";
|
||||
if ($method) $sql.= " AND methodename = '".$this->db->escape($method)."'";
|
||||
if ($command) $sql.= " AND command = '".$this->db->escape($command)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
@ -934,22 +939,26 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
|
||||
if (! $err)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, label, jobtype, classesname, methodename, command, params, note, frequency, unitfrequency, entity)";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, label, jobtype, classesname, objectname, methodename, command, params, note, frequency, unitfrequency, priority, status, entity, test)";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->rights_class)."', ";
|
||||
$sql.= "'".$this->db->idate($now)."', ";
|
||||
$sql.= "'".$this->db->idate($now)."', ";
|
||||
$sql.= "'".$this->db->escape($label)."', ";
|
||||
$sql.= "'".$this->db->escape($jobtype)."', ";
|
||||
$sql.= ($class?"'".$this->db->escape($class)."'":"null").",";
|
||||
$sql.= ($objectname?"'".$this->db->escape($objectname)."'":"null").",";
|
||||
$sql.= ($method?"'".$this->db->escape($method)."'":"null").",";
|
||||
$sql.= ($command?"'".$this->db->escape($command)."'":"null").",";
|
||||
$sql.= ($parameters?"'".$this->db->escape($parameters)."'":"null").",";
|
||||
$sql.= ($comment?"'".$this->db->escape($comment)."'":"null").",";
|
||||
$sql.= "'".$this->db->escape($frequency)."', ";
|
||||
$sql.= "'".$this->db->escape($unitfrequency)."', ";
|
||||
$sql.= $conf->entity;
|
||||
$sql.= "'".$this->db->escape($priority)."', ";
|
||||
$sql.= "'".$this->db->escape($status)."', ";
|
||||
$sql.= $conf->entity.",";
|
||||
$sql.= "'".$this->db->escape($test)."'";
|
||||
$sql.= ")";
|
||||
print $sql;
|
||||
|
||||
dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -339,7 +340,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach($tmparray as $key=>$value)
|
||||
@ -407,7 +409,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
@ -428,6 +431,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||
$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user