Merge remote-tracking branch 'upstream/develop' into refactor

This commit is contained in:
Marcos García de La Fuente 2015-09-06 18:57:38 +02:00
commit 9ce8024f1e
877 changed files with 5190 additions and 5110 deletions

View File

@ -3,6 +3,8 @@ languages:
Ruby: false
JavaScript: true
PHP: true
engines:
phpcodesniffer: true
exclude_paths:
- 'build/*'
- 'dev/*'

View File

@ -22,7 +22,7 @@ NuSoap 0.9.5 LGPL 2.1+ Yes
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.6 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.6 LGPL-3+ Yes PDF generation

View File

@ -224,7 +224,7 @@ Dolibarr better:
hook afterLogin or afterLoginFailed instead.
- The trigger USER_CREATE_FROM_CONTACT has been replace with USER_CREATE and property context is now filled
to make difference between creation from contact or not.
- Function get_exdir require now 6 parameters. This is to prepare a future feature.
***** ChangeLog for 3.7.2 compared to 3.7.1 *****
FIX [ bug #2855 ] Wrong translation key in localtax report page
@ -237,6 +237,9 @@ FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead
FIX: Not showing delivery date on rouget pdf
FIX: Not showing task extrafields when creating from left menu
FIX [ bug #3288 ] Tasks box is not properly drawn
FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts
FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights
FIX [ bug #3426 ] Unable to create an invoice from a contract with extrafields
NEW: Created new ContratLigne::insert function
@ -684,6 +687,9 @@ Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter
Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result
Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled
Fix: [ bug #3310 ] OrderLine::fetch, FactureLigne::fetch and PropaleLigne::fetch do not return anything
Fix: [ bug #3206 ] PropaleLigne, OrderLine and FactureLigne given to triggers through update function does not contain all the information
Fix: [ bug #3313 ] Error enabling module with PostgreSQL database
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Script build for hudson CI -->
<project name="dolibarr" default="hudson" basedir=".">
fdfds
<!-- Exclude/ignore paths -->
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />

View File

@ -117,7 +117,7 @@ http://bugs.debian.org/package
severity 123 xxx
##### Update but tracker system
##### Update bug tracker system
To set status of a bug to "pending"
> bts --smtp-host=yoursmtpserver tag 999999 +pending
@ -195,7 +195,7 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER
* Some files are removed from archive by the get-orig-source.sh
* Staying into git root directory, run
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz --debian-branch=[master|jessie] --upstream-branch=[upstream|upstream-3.5.x]
Note: If there was errors solved manually, you may need to make a git commit
@ -208,11 +208,15 @@ Warning: Date must have format reported by "date -R"
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
* We try to build package
> rm -fr ../build-area; git-buildpackage -us -uc
> rm -fr ../build-area;
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
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
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
Note: Package is built into directory ../build-area
Note: To compare 2 packages: debdiff package1.dsc package2.dsc
* 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
@ -220,7 +224,7 @@ Note: If there was errors managed manually, you may need to make a git commit bu
* If ok, you can tag.
> Edit debian/changelog to replace "UNRELEASED" into "unstable", then push
> git-buildpackage --git-tag-only --git-retag
> git-buildpackage --git-tag-only --git-retag --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
> git push --tags
* Compilation is then done by a debian developer and sent
@ -249,7 +253,7 @@ from git clone dir and make link to git.
* If local branch upstream and pristine-tar does not exists, create it
from origin/upstream and origin/pristine.
* If new upstream is available onto sourceforge, launch:
* When new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this.
@ -263,7 +267,7 @@ dolibarr-x.y.z+dfsgw.tgz
(x.y.z = version, w start from 1 and is increased for each new git-import-orig already done)
* Staying into git root directory, run
> git-import-orig -vv ../dolibarr-x.y.z+dfsgw.tgz
> git-import-orig -vv ../dolibarr-x.y.z+dfsgw.tgz --debian-branch=[master|jessie] --upstream-branch=[upstream|upstream-3.5.x]
and enter version when requested with format
x.y.z+dfsgw
(x.y.z = version, w start from 1 and is increased for each new import)
@ -273,8 +277,8 @@ Note: If there was errors solved manually after get-orig-sources.sh, you may nee
* Fix debian/* files used to build package.
Add an entry into debian/changelog
> dch -v x.y.z+dfsgw-v "My comment" will add entry.
For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import)
Then modify changelog to replace "version" or "unstable" with "UNRELEASED".
For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increased for each new import)
Then check/modify changelog to replace "version" or "unstable" with "UNRELEASED".
Then check/modify also the user/date signature:
- Date must have format reported by "date -R"
- Name and email must match value into debian/control file (Entry added here is used by next step).
@ -289,21 +293,24 @@ To update dolibarr debian package when only files into debian has changed
Once files has been prepared, it's time to test:
* Try to build package
> rm -fr ../build-area; git-buildpackage -us -uc
> rm -fr ../build-area;
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
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
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
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
> git push --all ou git push origin --all
> git push --all
* If ok, you can tag.
> Edit debian/changelog to replace "UNRELEASED" into "unstable", then push
> git-buildpackage --git-tag-only --git-retag
> git-buildpackage --git-tag-only --git-retag --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
> git push --tags
@ -321,15 +328,32 @@ http://packages.qa.debian.org
##### Send an unblock request
Use this to move from unstable to testing.
reportbug -B debian
Choose package "release.debian.org"
Then "unblock"
Then name of package "dolibarr"
Fill message, for example:
"Please unblock package dolibarr
A security error CVE-2014-7137 was reported and is fixed into package 3.5.5.
Note that package 3.5.5 was prepared before the CVE was reported and include other fixes, but they are all related to stability or security (other se$
A security error CVE-2015-3935 was reported and is fixed into package 3.5.7.
Note that package 3.5.7 contains not only fixed for bugs reported to debian. It includes other fixes, but they are all related to stability or security,
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
After discussion with ..., it appears that security holes are enough to request this unblock request."
Use this to request an update of a stable package
reportbug -B debian
Choose package "release.debian.org"
Then "unblock"
Then name of package "dolibarr"
Fill message, for example:
"Please unblock package dolibarr
A security error CVE-2015-3935 was reported and is fixed into package 3.5.7.
Note that package 3.5.7 contains not only fixed for bugs reported to debian. It includes other fixes, but they are all related to stability or security,
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
After discussion with ..., it appears that security holes are enough to request this unblock request."

View File

@ -24,7 +24,7 @@ fi
# To convert
if [ "x$1" = "xfix" ]
then
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml"\) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
do
echo "Fix file $fic"
dos2unix $fic

File diff suppressed because one or more lines are too long

View File

@ -145,6 +145,7 @@ if ($result) {
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
print '<br/><br/>';
print '<table class="noborder" width="100%">';

View File

@ -1,10 +1,9 @@
<?PHP
/*
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.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
@ -21,19 +20,19 @@
*/
/**
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.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';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
// Langs
$langs->load("companies");
@ -41,383 +40,355 @@ $langs->load("compta");
$langs->load("main");
$langs->load("accountancy");
// Search & action GETPOST
// search & action GETPOST
$action = GETPOST('action');
$codeventil_buy = GETPOST('codeventil_buy', 'array');
$codeventil_sell = GETPOST('codeventil_sell', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$account_number_buy = GETPOST('account_number_buy');
$chk_prod = GETPOST('chk_prod', 'array');
$account_number_buy = GETPOST('account_number_buy');
$account_number_sell = GETPOST('account_number_sell');
$changeaccount = GETPOST('changeaccount','array');
$changeaccount_buy = GETPOST('changeaccount_buy','array');
$changeaccount_sell = GETPOST('changeaccount_sell','array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$changeaccount = GETPOST('changeaccount', 'array');
$changeaccount_buy = GETPOST('changeaccount_buy', 'array');
$changeaccount_sell = GETPOST('changeaccount_sell', 'array');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount');
$btn_changetype = GETPOST('changetype');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page < 0) $page = 0;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
if ($page < 0)
$page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
//bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
//} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
// $limit = $conf->liste_limit;
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
// } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
// $limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
if (! $sortfield)
$sortfield = "p.ref";
if (! $sortorder)
$sortorder = "ASC";
// sales or purchase
if ($action == 'update') {
if (! empty($btn_changetype)) {
$error = 0;
$accounting_product_modes = array (
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_BUY'
);
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
if (in_array($accounting_product_mode, $accounting_product_modes)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
} else {
$error ++;
}
}
if (! empty($btn_changeaccount)) {
$msg = '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($chk_prod)) {
$accounting = new AccountingAccount($db);
$msg .= '<div><font color="red">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$cpt = 0;
foreach ( $chk_prod as $productid ) {
$accounting_account_id=GETPOST('codeventil_'.$productid);
$result=$accounting->fetch($accounting_account_id,null,1);
if ($result<0) {
//setEventMessage(null, $accounting->errors,'errors');
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
} else {
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " SET accountancy_code_buy = " . $accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
}
$sql .= " WHERE rowid = " . $productid;
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>';
} 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>';
}
}
$cpt ++;
}
} else {
$msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
}
$msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
}
}
// Security check
if ($user->societe_id > 0)
accessforbidden();
// TODO after adding menu
// if (! $user->rights->accounting->ventilation->dispatch)
// accessforbidden();
accessforbidden();
// TODO after adding menu
// if (! $user->rights->accounting->ventilation->dispatch)
// accessforbidden();
$form = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
// Defaut AccountingAccount RowId Product / Service
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
// so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_prodbuy = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
$aarowid_servsell = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_prodsell = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
// TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
$search_ref = '';
$search_label = '';
$search_desc = '';
}
//TODO: modify to update all selected product with a sell account
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_sell")) {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
$sql1 .= " SET p.accountancy_code_sell=" . $account_number_sell;
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
// Debug
// print_r ($sql1);
dol_syslog('accountancy/customer/lines.php::changeaccount product sell sql= ' . $sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
}
}
//TODO: modify to update all selected product with a buy account
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_buy")) {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
$sql1 .= " SET p.accountancy_code_buy=" . $account_number_buy;
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
// Debug
// print_r ($sql1);
dol_syslog('accountancy/customer/lines.php::changeaccount product buy sql= ' . $sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
}
}
// debug move header to top
llxHeader('', $langs->trans("Accounts"));
/*
* View
*/
llxHeader('', $langs->trans("Accounts"));
// For updating account export
print '<script type="text/javascript">
function launch_export() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
//TODO For select box
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
/*
* Action
*/
//TODO
/*
if ($action == 'ventil') {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil_buy) && ! empty($mesCasesCochees)) {
if (! empty($codeventil_sell) && ! empty($mesCasesCochees)) {
} else {
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
}
print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
}
*/
//do we really need to exclude old product not tosell / tobuy ?
//$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
//$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
//$sql .= " WHERE p.accountancy_code_sell ='' AND p.tosell = 1 OR p.accountancy_code_buy ='' AND p.tobuy = 1";
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
//$sql .= " , " . MAIN_DB_PREFIX . "accountingaccount as aa";
$sql .= " WHERE (";
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
//Search on correct pcg version
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
$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 . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
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 . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
} else {
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL ";
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
}
$sql .= ")";
//Add search filter like
// Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '" . $search_ref . "%')";
$sql .= " AND (p.ref like '" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '" . $search_label . "%')";
$sql .= " AND (p.label like '" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (p.description like '%" . $search_desc . "%')";
$sql .= " AND (p.description like '%" . $search_desc . "%')";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
/*
$num_lines = $db->num_rows($result);
$i = 0;
/*
* View
*/
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td>&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder);
print '&nbsp;&nbsp;';
//DEBUG
//print $sql;
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post"><br />';
// print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr>';
print '<td width="33%">';
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
print $langs->trans("Accountancy_code_buy") . ': ' . $form->select_account($account_number_buy, 'account_number_buy', 1,'', 0, 1);
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_buy") . '"/></div>';
print '</td>';
print '<td width="33%">';
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
print $langs->trans("Accountancy_code_sell") . ': ' . $form->select_account($account_number_sell, 'account_number_sell', 1, '', 0, 1);
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_sell") . '"/></div>';
print '</td>';
print '<td width="33%">';
//TODO change button
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
print '</td>';
print '</tr>';
print '</table>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// print '<td align="left">' . $langs->trans("Ref") . '</td>';
// print '<td align="left">' . $langs->trans("Label") . '</td>';
// print '<td align="left">' . $langs->trans("Description") . '</td>';
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);
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
print_liste_field_titre('');
// print_liste_field_titre('');
print '<td align="center" colspan="2">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
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="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="3">&nbsp;</td>';
print '<td align="right" colspan="4" 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 '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
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")).'">';
// print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
// print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '</tr>';
$var = true;
while ( $i < min($num_lines, 250) ) {
$obj = $db->fetch_object($result);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if (empty($compta_prodsell)) {
if ($obj->product_type == 0) {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
} else {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
}
$compta_prodbuy = $obj->accountancy_code_buy;
if (empty($compta_prodbuy)) {
if ($obj->product_type == 0) {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
} else {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
}
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
//debug
print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_prodbuy . ' -- compta_prodbuy_id' . $compta_prodbuy_id . '-- compta_prodsell:' . $compta_prodsell . '-- compta_prodsell_id' . $compta_prodsell_id . '</td>';
print "</tr>";
print "<tr $bc[$var]>";
// Ref produit as link
$product_static->ref = $obj->ref;
$product_static->id = $obj->rowid;
$product_static->type = $obj->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '-&nbsp;';
print '</td>';
print '<td align="left">' . $obj->label . '</td>';
//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;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
//acountingaccount buy
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
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="center">';
print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1);
print '</td>';
//acountingaccount sel
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;
print '<td align="center">';
print $form->select_account($compta_prodsell_id, 'codeventil[]', 1);
print '</td>';
//action edit & select box
print '<td align="center">' . $obj->rowid . '</td>';
print '<td><a href="./card.php?id=' . $obj->rowid . '">';
print img_edit();
print '</a></td>';
//Checkbox select
print '<td align="center">';
print '<input type="checkbox" name="changeaccount[]" value="' . $obj->rowid . '"/></td>';
print "</tr>";
$i ++;
}
$db->free($result);
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('OptionMode') . '</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 "</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 "</table>\n";
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
print "<br>\n";
if (! empty($msg)) {
print $msg;
}
// print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td>&nbsp;';
// print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "p.rowid", "", $param, '', $sortfield, $sortorder);
print '&nbsp;&nbsp;';
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 '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>' . '</td>';
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="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">&nbsp;</td>';
print '<td align="right" 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 '&nbsp;';
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")) . '">';
print '</td>';
print '</tr>';
$var = true;
while ( $i < min($num_lines, 250) ) {
$obj = $db->fetch_object($result);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if ($obj->product_type == 0) {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
} else {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
$compta_prodbuy = $obj->accountancy_code_buy;
if ($obj->product_type == 0) {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
} else {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
print "</tr>";
print "<tr $bc[$var]>";
// Ref produit as link
$product_static->ref = $obj->ref;
$product_static->id = $obj->rowid;
$product_static->type = $obj->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '-&nbsp;';
print '</td>';
print '<td align="left">' . dol_trunc($obj->label, 24) . '</td>';
// 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;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
// acountingaccount buy
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
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
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="center">';
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>';
// 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;
print '<td align="center">';
print $form->select_account($compta_prodsell_id, 'codeventil_'.$product_static->id, 1);
print '</td>';
}
// Checkbox select
print '<td align="center">';
print '<input type="checkbox" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
print "</tr>";
$i ++;
}
print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Change_Account") . '"></div>';
print '</form>';
$db->free($result);
} else {
// print $db->error();
dol_print_error($db);
dol_print_error($db);
}
print "</table></form>";
llxFooter();
$db->close();

View File

@ -61,12 +61,15 @@ class AccountingAccount extends CommonObject
/**
* Load record in memory
*
* @param int $rowid Id
* @param string $account_number Account number
* @return int <0 if KO, >0 if OK
* @param int $rowid Id
* @param string $account_number Account number
* @param int $limittocurentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, >0 if OK
*/
function fetch($rowid = null, $account_number = null)
function fetch($rowid = null, $account_number = null, $limittocurentchart=0)
{
global $conf;
if ($rowid || $account_number) {
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
@ -75,7 +78,9 @@ class AccountingAccount extends CommonObject
} elseif ($account_number) {
$sql .= " account_number = '" . $account_number . "'";
}
if (!empty($limittocurentchart)) {
$sql .=' AND fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')';
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@ -101,7 +106,8 @@ class AccountingAccount extends CommonObject
return 0;
}
} else {
dol_print_error($this->db);
$this->error="Error " . $this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror();
}
}
return -1;

View File

@ -27,10 +27,13 @@
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Langs
$langs->load("bills");
$langs->load("compta");
$langs->load("main");
@ -38,23 +41,23 @@ $langs->load("accountancy");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
//Search Getpost
$search_ref = GETPOST('search_ref','alpha');
$search_invoice = GETPOST('search_invoice','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_account = GETPOST('search_account','alpha');
$search_vat = GETPOST('search_vat','alpha');
//Getpost Order and column and limit page
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
//if ($page == -1) { $page = 0; }
if ($page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
//$limit = $conf->liste_limit;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
@ -62,19 +65,11 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
} else {
$limit = $conf->liste_limit;
}
//$offset = $conf->liste_limit * $page;
$offset = $limit * $page;
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="f.facnumber";
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = " DESC ";
@ -98,6 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_desc='';
$search_amount='';
$search_account='';
$search_vat='';
}
if (is_array($changeaccount) && count($changeaccount) > 0) {
@ -181,6 +177,10 @@ if (strlen(trim($search_amount))) {
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (strlen(trim($search_vat)))
{
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
@ -210,6 +210,7 @@ if ($result) {
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);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
@ -222,6 +223,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
@ -257,6 +259,7 @@ if ($result) {
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . price($objp->tva_tx) . '</td>';
print '<td align="center">' . $codecompta . '</td>';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
@ -275,4 +278,4 @@ if ($result) {
print "</table></form>";
llxFooter();
$db->close();
$db->close();

View File

@ -24,14 +24,13 @@
* \ingroup Accounting Expert
* \brief Ventilation page from customers invoices
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta");
@ -42,24 +41,26 @@ $langs->load("accountancy");
$action = GETPOST('action');
//Select Box
// Select Box
$codeventil = GETPOST('codeventil', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
//Search Getpost
$search_invoice = GETPOST('search_invoice','alpha');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_account = GETPOST('search_account','alpha');
$search_vat = GETPOST('search_vat','alpha');
// Search Getpost
$search_invoice = GETPOST('search_invoice', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
//Getpost Order and column and limit page
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page');
if ($page < 0) $page = 0;
// Getpost Order and column and limit page
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page','int');
if ($page < 0)
$page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
@ -70,7 +71,8 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
}
$offset = $limit * $page;
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
if (! $sortfield)
$sortfield = "f.datef, f.facnumber, l.rowid";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
@ -91,23 +93,23 @@ $aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter"))
{
$search_ref='';
$search_invoice='';
$search_label='';
$search_desc='';
$search_amount='';
$search_account='';
$search_vat='';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
$search_ref = '';
$search_invoice = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
$search_account = '';
$search_vat = '';
}
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
print '<script type="text/javascript">
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
@ -128,7 +130,7 @@ print '<script type="text/javascript">
* Action
*/
if ($action == 'ventil') {
if ($action == 'ventil' && !empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil) && ! empty($mesCasesCochees)) {
print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
@ -139,18 +141,18 @@ if ($action == 'ventil') {
$monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
}
$cpt ++;
}
} else {
@ -163,7 +165,6 @@ if ($action == 'ventil') {
* Customer Invoice lines
*/
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod";
$sql .= " , aa.rowid as aarowid";
@ -177,8 +178,7 @@ $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
// Add search filter like
if (strlen(trim($search_invoice)))
{
if (strlen(trim($search_invoice))) {
$sql .= " AND (f.facnumber like '%" . $search_invoice . "%')";
}
if (strlen(trim($search_ref))) {
@ -190,16 +190,13 @@ if (strlen(trim($search_label))) {
if (strlen(trim($search_desc))) {
$sql .= " AND (l.description like '%" . $search_desc . "%')";
}
if (strlen(trim($search_amount)))
{
if (strlen(trim($search_amount))) {
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
}
if (strlen(trim($search_account)))
{
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (strlen(trim($search_vat)))
{
if (strlen(trim($search_vat))) {
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
}
@ -207,7 +204,7 @@ if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
@ -216,87 +213,86 @@ $result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"],"f.datef","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
print '&nbsp;&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"l.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
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);
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
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);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
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>','','','','','align="center"');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print '</tr>';
// We add search filter
// We add search filter
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre">%<input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" 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="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount. '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" 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 '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td align="right" class="liste_titre" colspan="4">';
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 '&nbsp;';
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")).'">';
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")) . '">';
print '</td>';
print '</tr>';
$facture_static = new Facture($db);
$product_static = new Product($db);
$form = new Form($db);
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$objp->code_sell_l = '';
$objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$code_sell_p_l_differ = '';
$code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if ( ! empty($objp->code_sell)) {
if (! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell;
} else {
$code_sell_p_notset = 'color:red';
if ($objp->type == 1) {
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
elseif ($objp->type == 0) {
} elseif ($objp->type == 0) {
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
}
if ($objp->type_l == 1) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
}
elseif ($objp->type_l == 0) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
}
if ($objp->code_sell_l <> $objp->code_sell_p) $code_sell_p_l_differ = 'color:red';
if ($objp->type_l == 1) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_s;
} elseif ($objp->type_l == 0) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_p;
}
if ($objp->code_sell_l != $objp->code_sell_p)
$code_sell_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
@ -311,21 +307,25 @@ if ($result) {
else
print '&nbsp;';
print '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->total_ht);
print '</td>';
if ($objp->vat_tx_l <> $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
print '<td style="' . $code_vat_differ . '" align="center">';
print price($objp->tva_tx_line);
print '</td>';
print '<td align="center" style="' . $code_sell_p_notset . '">';
if ($objp->code_sell_l == $objp->code_sell_p) {
print $objp->code_sell_l;
} else {
print 'lines='.$objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
print 'lines=' . $objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
}
print '</td>';
print '<td align="center">';
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
@ -336,13 +336,13 @@ if ($result) {
print '</tr>';
$i ++;
}
print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
print '</form>';
} else {
print $db->error();
}
llxFooter();
$db->close();
$db->close();

View File

@ -89,8 +89,8 @@ $idpays = $p[0];
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, ";
$sql .= " ct.accountancy_code_sell as account_tva";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
$sql .= " fd.situation_percent,ct.accountancy_code_sell as account_tva";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
@ -102,16 +102,18 @@ if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
$sql .= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
$sql .= " AND f.type IN (0,1,2,5)";
else
$sql .= " AND f.type IN (0,1,2,3,5)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
}
else {
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
}
$sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
$sql .= " ORDER BY f.datef";
dol_syslog('accountancy/journal/sellsjournal.php:: $sql=' . $sql);
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$tabfac = array ();
@ -143,10 +145,15 @@ if ($result) {
$line = new FactureLigne($db);
$line->fetch($obj->rowid);
$prev_progress = $line->get_prev_progress();
if ($obj->situation_percent == 0) { // Avoid divide by 0
$situation_ratio = 0;
if ($obj->type==Facture::TYPE_SITUATION) {
// Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
$situation_ratio = 1;
}
// Invoice lines

View File

@ -26,11 +26,14 @@
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Langs
$langs->load("compta");
$langs->load("bills");
$langs->load("other");
@ -39,24 +42,45 @@ $langs->load("accountancy");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
//Search Getpost
$search_ref = GETPOST('search_ref','alpha');
$search_invoice = GETPOST('search_invoice','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_account = GETPOST('search_account','alpha');
$search_vat = GETPOST('search_vat','alpha');
//Getpost Order and column and limit page
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
if ($page < 0) $page = 0;
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="f.ref";
if (! $sortorder) $sortorder="DESC";
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION))
{
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
}
else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0)
{
$limit = $conf->liste_limit;
}
else
{
$limit = $conf->liste_limit;
}
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
if (! $sortorder)
{
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0)
{
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -75,6 +99,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_desc='';
$search_amount='';
$search_account='';
$search_vat='';
}
if (is_array($changeaccount) && count($changeaccount) > 0) {
@ -124,9 +149,6 @@ print '<script type="text/javascript">
});
</script>';
/*
* Action
*/
/*
* Supplier Invoice lines
@ -157,6 +179,10 @@ if (strlen(trim($search_amount))) {
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (strlen(trim($search_vat)))
{
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
@ -187,6 +213,7 @@ if ($result) {
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);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
@ -198,11 +225,12 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
print "</td></tr>\n";
$facturefournisseur_static = new FactureFournisseur($db);
$product_static = new Product($db);
@ -234,6 +262,7 @@ if ($result) {
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . price($objp->tva_tx) . '</td>';
print '<td align="center">' . $codeCompta . '</td>';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
@ -253,4 +282,4 @@ if ($result) {
print "</table></form>";
llxFooter();
$db->close();
$db->close();

View File

@ -24,14 +24,13 @@
* \ingroup Accounting Expert
* \brief Ventilation page from suppliers invoices
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta");
@ -41,18 +40,28 @@ $langs->load("main");
$langs->load("accountancy");
$action = GETPOST('action');
// Select Box
$codeventil = GETPOST('codeventil', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
//Should move to top with all GETPOST
// Search Getpost
$search_invoice = GETPOST('search_invoice', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha');
$btn_ventil = GETPOST('ventil', 'alpha');
// Getpost Order and column and limit page
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page');
if ($page < 0) $page = 0;
if ($page < 0)
$page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
@ -62,18 +71,9 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
//End Should move to top with all GETPOST
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.ref will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="l.rowid";
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortfield)
$sortfield = "f.datef, f.ref, l.rowid";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = " DESC ";
@ -88,21 +88,24 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
// Defaut AccountingAccount RowId Product / Service
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
// so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
// TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
$search_ref = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
$search_account = '';
$search_vat = '';
}
/*
@ -110,10 +113,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
*/
llxHeader('', $langs->trans("Ventilation"));
//debug
//print_r($aarowid_s);
//print_r($aarowid_p);
print '<script type="text/javascript">
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
@ -133,31 +133,31 @@ print '<script type="text/javascript">
* Action
*/
if ($action == 'ventil') {
if ($action == 'ventil' && !empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) {
print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$mesCodesVentilChoisis = $codeventil;
$cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) {
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
}
$cpt ++;
}
} else {
@ -170,22 +170,9 @@ if ($action == 'ventil') {
* Supplier Invoice Lines
*
*/
$page = GETPOST('page');
if ($page < 0)
$page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy";
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.tva_tx as tva_tx_line, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod";
$sql .= " , aa.rowid as aarowid";
$sql .= " , f.datef";
$sql .= " , l.product_type as type_l";
@ -195,9 +182,12 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
// Add search filter like
if (strlen(trim($search_invoice))) {
$sql .= " AND (f.ref like '%" . $search_invoice . "%')";
}
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
}
@ -207,11 +197,20 @@ if (strlen(trim($search_label))) {
if (strlen(trim($search_desc))) {
$sql .= " AND (l.description like '%" . $search_desc . "%')";
}
if (strlen(trim($search_amount))) {
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
}
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (strlen(trim($search_vat))) {
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
@ -220,32 +219,49 @@ $result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
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);
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
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>','','','','','align="center"');
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
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);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
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>', '', '', '', '', 'align="center"');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre">%<input type="text" class="flat" size="15" 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="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" 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 '&nbsp;';
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")) . '">';
print '</td>';
print '</tr>';
$facturefourn_static = new FactureFournisseur($db);
$productfourn_static = new ProductFournisseur($db);
$form = new Form($db);
$var = True;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
@ -258,43 +274,43 @@ if ($result) {
$objp->code_buy_p = '';
$objp->aarowid_suggest = '';
$code_buy_p_l_differ = '';
$code_buy_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if ( ! empty($objp->code_buy)) {
if (! empty($objp->code_buy)) {
$objp->code_buy_p = $objp->code_buy;
} else {
$code_buy_p_notset = 'color:red';
if ($objp->type == 1) {
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
}
elseif ($objp->type == 0) {
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
}
if ($objp->type_l == 1) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
}
elseif ($objp->type_l == 0) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
}
if ($objp->type_l == 1) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_s;
} elseif ($objp->type_l == 0) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_p;
}
if ($objp->code_buy_l <> $objp->code_buy_p) $code_buy_p_l_differ = 'color:red';
if ($objp->code_buy_l != $objp->code_buy_p)
$code_buy_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref Invoice
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
// Ref Supplier Invoice
$productfourn_static->ref = $objp->product_ref;
$productfourn_static->id = $objp->product_id;
@ -305,26 +321,32 @@ if ($result) {
else
print '&nbsp;';
print '</td>';
print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->price);
print '</td>';
if ($objp->vat_tx_l != $objp->vat_tx_p)
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
print '<td style="' . $code_vat_differ . '" align="center">';
print price($objp->tva_tx_line);
print '</td>';
print '<td align="center" style="' . $code_buy_p_notset . '">';
//if not same kind of product_type stored in product & facturedt we display both account and let user choose
// if not same kind of product_type stored in product & facturedt we display both account and let user choose
if ($objp->code_buy_l == $objp->code_buy_p) {
print $objp->code_buy_l;
} else {
print 'lines='.$objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
print 'lines=' . $objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
}
print '</td>';
// Colonne choix du compte
print '<td align="center">';
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
@ -332,19 +354,19 @@ if ($result) {
print '<td align="center">' . $objp->rowid . '</td>';
// Colonne choix ligne a ventiler
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid_suggest ? "checked" : "") . '/>';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>';
print "</tr>";
$i ++;
}
print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil" ></div>';
print '</form>';
} else {
print $db->error();
}
llxFooter();
$db->close();
$db->close();

View File

@ -761,7 +761,7 @@ else
// On propose la generation de la vignette si elle n'existe pas
if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo))
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=addthumb&amp;file='.urlencode($mysoc->logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'&nbsp;&nbsp;</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=addthumb&amp;file='.urlencode($mysoc->logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'</a>&nbsp;&nbsp;';
}
else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
{

View File

@ -97,6 +97,12 @@ $modules=array(
'img' => 'user'
)
),
'expensereport' => array(
array(
'code' => 'MAIN_DELAY_EXPENSEREPORTS',
'img' => 'trip'
)
),
);
if ($action == 'update')

View File

@ -899,7 +899,11 @@ if ($id)
else $valuetoshow=$langs->trans("Type");
}
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; }
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') {
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
@ -1055,7 +1059,11 @@ if ($id)
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 ($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"; }

View File

@ -36,6 +36,7 @@ $langs->load("other");
$langs->load("companies");
$langs->load("products");
$langs->load("members");
$langs->load("projects");
if (! $user->admin) accessforbidden();

View File

@ -469,11 +469,11 @@ if ($mode != 'marketplace')
}
else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
{
print '<td align="right" valign="top"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
print '<td align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
}
else
{
print '<td align="right" valign="top"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
print '<td align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
}
}
else
@ -500,7 +500,8 @@ if ($mode != 'marketplace')
print img_picto($langs->trans("Disabled"),'switch_off');
print "</a>\n";
}
print "</td>\n <td>&nbsp;</td>";
print "</td>\n";
print "<td>&nbsp;</td>";
}
print "</tr>\n";

View File

@ -63,11 +63,35 @@ print '<ul>';
print '<li>';
print '<a target="_blank" href="http://www.dolibarr.org/" rel="external">'.$langs->trans("OfficialWebSite").'</a>';
print '</li>';
// If the French language, it displays French website
// Show local site
if (preg_match('/^fr_/i',$langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="http://www.dolibarr.fr/" rel="external">'.$langs->trans("OfficialWebSiteFr").'</a>';
print '<a target="_blank" href="http://www.dolibarr.fr/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("France")).'</a>';
print '</li>';
}
if (preg_match('/^el_/i',$langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="http://www.dolibarr.gr/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Greece")).'</a>';
print '</li>';
}
if (preg_match('/^es_/i',$langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="http://www.dolibarr.es/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Spain")).'</a>';
print '</li>';
}
if (preg_match('/^it_/i',$langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="http://www.dolibarr.it/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Italy")).'</a>';
print '</li>';
}
if (preg_match('/^de_/i',$langs->getDefaultLang()))
{
print '<li>';
print '<a target="_blank" href="http://www.dolibarr.de/" rel="external">'.$langs->trans("OfficialWebSiteLocal", $langs->transnoentitiesnoconv("Germany")).'</a>';
print '</li>';
}
print '<li>';

View File

@ -182,7 +182,8 @@ if ($result)
$formquestion=array();
print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
}
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder);
@ -195,7 +196,6 @@ if ($result)
// Lignes des champs de filtres
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre" width="15%">'.$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).$form->select_date($date_end,'date_end',0,0,0,'',1,0,1).'</td>';
@ -222,7 +222,6 @@ if ($result)
print '</td>';
print "</tr>\n";
print '</form>';
$var=True;
@ -283,7 +282,7 @@ if ($result)
if ($usefilter) print '<tr><td colspan="6">'.$langs->trans("NoEventFoundWithCriteria").'</td></tr>';
else print '<tr><td colspan="6">'.$langs->trans("NoEventOrNoAuditSetup").'</td></tr>';
}
print "</table>";
print "</table></form>";
$db->free($result);
if ($num)

View File

@ -141,7 +141,7 @@ if ($action == 'builddoc')
$result=@include_once $newdir.$generator.'.modules.php';
if ($result) break;
}
// Load barcode class for generating barcode image
$classname = "mod".ucfirst($generator);
$module = new $classname($db);
@ -196,7 +196,7 @@ if ($action == 'builddoc')
// For labels
if ($mode == 'label')
{
$txtforsticker="%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
$textleft=make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT)?$txtforsticker:$conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
$textheader=make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT)?'':$conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
@ -379,7 +379,7 @@ print '</div>';
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' &nbsp; ';
print '<br>';
print '<div class="showforthirdpartyselector">';
print $form->select_company(GETPOST('socid'), 'socid', '', 1);
print $form->select_company(GETPOST('socid'), 'socid', '', 1, 0, 0, array(), 0, 'minwidth300');
print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
print '</div>';

View File

@ -850,8 +850,8 @@ class Categorie extends CommonObject
* fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id
*
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member'). Old
* mode (0, 1, 2, ...) is deprecated.
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member').
* Old mode (0, 1, 2, ...) is deprecated.
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
*
* @return array Array of categories. this->cats and this->motherof are set.
@ -861,12 +861,12 @@ class Categorie extends CommonObject
global $conf, $langs;
// For backward compatibility
if (is_numeric( $type )) {
if (is_numeric($type))
{
// We want to reverse lookup
$map_type = array_flip( $this->MAP_ID );
$map_type = array_flip($this->MAP_ID);
$type = $map_type[$type];
dol_syslog( get_class( $this ) . "::get_full_arbo(): numeric types are deprecated, please use string instead",
LOG_WARNING );
dol_syslog( get_class( $this ) . "::get_full_arbo(): numeric types are deprecated, please use string instead", LOG_WARNING);
}
$this->cats = array();

View File

@ -117,17 +117,14 @@ if ($action == 'update' && $user->rights->categorie->creer)
* View
*/
$form = new Form($db);
llxHeader("","",$langs->trans("Categories"));
print_fiche_titre($langs->trans("ModifCat"));
$object->fetch($id);
$form = new Form($db);
print '<table class="notopnoleft" border="0" width="100%">';
print '<tr><td class="notopnoleft" valign="top" width="30%">';
print "\n";
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
@ -136,6 +133,8 @@ print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
dol_fiche_head('');
print '<table class="border" width="100%">';
// Ref
@ -165,13 +164,15 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
}
print '</table>';
print '<br>';
dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>';
print '</td></tr></table>';
llxFooter();

View File

@ -148,12 +148,13 @@ foreach($fulltree as $key => $val)
$categstatic->ref=$val['label'];
$categstatic->type=$type;
$li=$categstatic->getNomUrl(1,'',60);
$desc=dol_htmlcleanlastbr($val['description']);
$data[] = array(
'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.
'</td><td width="50%">'.dolGetFirstLineOfText($val['description']).'</td>'.
'</td><td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
'</tr></table>'
);
@ -178,7 +179,7 @@ if ($nbofentries > 0)
}
else
{
print '<tr>';
print '<tr '.$bc[0].'>';
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
print '<td valign="middle">';
print $langs->trans("NoCategoryYet");

View File

@ -243,6 +243,8 @@ if ($action == 'add')
$object->percentage = $percentage;
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
$transparency=(GETPOST("transparency")=='on'?1:0);
$listofuserid=array();
if (! empty($_SESSION['assignedtouser'])) $listofuserid=json_decode($_SESSION['assignedtouser'], true);
$i=0;
@ -251,10 +253,10 @@ if ($action == 'add')
if ($i == 0) // First entry
{
if ($value['id'] > 0) $object->userownerid=$value['id'];
$object->transparency = (GETPOST("transparency")=='on'?1:0);
$object->transparency = $transparency;
}
$object->userassigned[$value['id']]=array('id'=>$value['id'], 'transparency'=>(GETPOST("transparency")=='on'?1:0));
$object->userassigned[$value['id']]=array('id'=>$value['id'], 'transparency'=>$transparency);
$i++;
}
@ -436,6 +438,8 @@ if ($action == 'update')
$i++;
}
$object->transparency = $transparency; // We set transparency on event (even if we can also store it on each user, standard says this property is for event)
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
{
if (GETPOST("doneby")) $object->userdoneid=GETPOST("doneby","int");
@ -969,7 +973,7 @@ if ($id > 0)
else if (jQuery("#recurrulefreq").val() == \'WEEKLY\')
{
jQuery(".repeateventBYMONTHDAY").hide();
jQuery(".repeateventBYDAY").show();
jQuery(".repeateventBYDAY").show();
}
else
{
@ -982,7 +986,7 @@ if ($id > 0)
init_repeat();
});
});
</script>';
</script>';
print '</td></tr>';
}
@ -1023,7 +1027,7 @@ if ($id > 0)
}
}
print $form->select_dolusers_forevent(($action=='create'?'add':'update'), 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, 'AND u.statut != 0');
if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked':'').'">'.$langs->trans("Busy");
if (in_array($user->id,array_keys($listofuserid))) print $langs->trans("MyAvailability").': <input id="transparency" type="checkbox" name="transparency"'.($listofuserid[$user->id]['transparency']?' checked':'').'>'.$langs->trans("Busy");
print '</td></tr>';
// Realised by

View File

@ -1044,9 +1044,9 @@ class ActionComm extends CommonObject
* Use $this->id, $this->type_code, $this->label and $this->type_label
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Nombre de caracteres max dans libelle
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option ''=Link to action,'birthday'=Link to contact
* @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto
* @return string Chaine avec URL
*/
@ -1078,7 +1078,8 @@ class ActionComm extends CommonObject
{
$libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:''));
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
$libelleshort=dol_trunc($libelle,$maxlength);
if ($maxlength < 0) $libelleshort=$this->ref;
else $libelleshort=dol_trunc($libelle,$maxlength);
}
if ($withpicto)

View File

@ -801,7 +801,7 @@ $db->close();
/**
* Show event of a particular day for a user
* Show event line of a particular day for a user
*
* @param string $username Login
* @param int $day Day
@ -853,6 +853,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// 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
@ -1021,30 +1023,37 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
}
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) // 1 seul evenement
{
$ids=array_keys($cases1[$h]);
$output = array_slice($cases1[$h], 0, 1);
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color'];
}
else if (count($cases1[$h]) > 1) $color1='222222';
if (count($cases2[$h]) == 1) // 1 seul evenement
{
$ids=array_keys($cases2[$h]);
$output = array_slice($cases2[$h], 0, 1);
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color'];
}
else if (count($cases2[$h]) > 1) $color2='222222';
$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]));
//var_dump($cases1[$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;

View File

@ -1664,7 +1664,7 @@ if ($action == 'create')
// Create an order
if (! empty($conf->commande->enabled) && $object->statut == 2) {
if ($user->rights->commande->creer) {
if ($user->rights->fournisseur->commande->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
}
}
@ -1761,7 +1761,7 @@ if ($action == 'create')
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
dol_print_error($db, $result);
dol_print_error($db, $object->error, $object->errors);
exit();
}
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');

View File

@ -61,15 +61,15 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
* Search form
*/
$var=false;
print '<table class="noborder nohover" width="100%">';
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchRequest").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
print '</tr>';
print "</form></table><br>\n";
print "</table></form><br>\n";
/*

View File

@ -40,10 +40,9 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="m.date_creat";
$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"];
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
$filteremail=$_REQUEST["filteremail"]?$_REQUEST["filteremail"]:'';
$sall=GETPOST("sall","alpha");
$sref=GETPOST("sref","alpha");
$filteremail=GETPOST('filteremail','alpha');
@ -62,8 +61,8 @@ if ($filteremail)
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql.= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity;
$sql.= " AND mc.email = '".$db->escape($filteremail)."'";
if ($sref) $sql.= " AND m.rowid = '".$sref."'";
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'";
if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')";
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="m.rowid";
$sql.= $db->order($sortfield,$sortorder);
@ -74,8 +73,8 @@ else
$sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql.= " WHERE m.entity = ".$conf->entity;
if ($sref) $sql.= " AND m.rowid = '".$sref."'";
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'";
if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')";
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="m.rowid";
$sql.= $db->order($sortfield,$sortorder);
@ -94,9 +93,10 @@ if ($result)
$i = 0;
$param = "&amp;sall=".$sall;
$param = "&amp;sall=".urlencode($sall);
if ($filteremail) $param.='&amp;filteremail='.urlencode($filteremail);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="liste">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
@ -108,14 +108,13 @@ if ($result)
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="sref" value="'.$sref.'" size="6">';
print '<input type="text" class="flat" name="sref" value="'.dol_escape_htmltag($sref).'" size="6">';
print '</td>';
// Title
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="sall" value="'.$sall.'" size="40">';
print '<input type="text" class="flat" name="sall" value="'.dol_escape_htmltag($sall).'" size="40">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
if (! $filteremail) print '<td class="liste_titre">&nbsp;</td>';
@ -123,7 +122,6 @@ if ($result)
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>";
print "</tr>\n";
print '</form>';
$var=True;
@ -177,7 +175,7 @@ if ($result)
print "</tr>\n";
$i++;
}
print "</table>";
print '</table></form>';
$db->free($result);
}
else

View File

@ -2327,7 +2327,7 @@ if ($action == 'create')
if (! $file || ! is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $result);
dol_print_error($db, $object->error, $object->errors);
exit();
}
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');

View File

@ -643,16 +643,16 @@ class Propal extends CommonObject
$price = $pu - $remise;
}
// Update line
$this->line=new PropaleLigne($this->db);
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new PropaleLigne($this->db);
$line->fetch($rowid);
$staticline = clone $line;
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
// Stock previous line records
$staticline=new PropaleLigne($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
{
@ -1062,9 +1062,9 @@ class Propal extends CommonObject
function createFromClone($socid=0)
{
global $db, $user,$langs,$conf,$hookmanager;
dol_include_once('/projet/class.project.class.php');
$this->context['createfromclone']='createfromclone';
$error=0;
@ -1089,16 +1089,16 @@ class Propal extends CommonObject
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$project = new Project($db);
if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) {
if($project->socid <= 0) $this->fk_project = $objFrom->fk_project;
else $this->fk_project = '';
} else {
$this->fk_project = '';
}
$this->fk_delivery_address = '';
}
@ -3107,10 +3107,12 @@ class PropaleLigne extends CommonObjectLine
$this->date_end = $this->db->jdate($objp->date_end);
$this->db->free($result);
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}

View File

@ -63,15 +63,15 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
* Search form
*/
$var=false;
print '<table class="noborder nohover" width="100%">';
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchPropal").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
print '</tr>';
print "</form></table><br>\n";
print "</table></form><br>\n";
/*

View File

@ -283,8 +283,11 @@ foreach ($data as $val)
print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '</tr>';
}
print '<tr height="24">';

View File

@ -54,15 +54,15 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
if (! empty($conf->propal->enabled))
{
$var=false;
print '<table class="noborder nohover" width="100%">';
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
print '</tr>';
print "</form></table><br>\n";
print "</table></form><br>\n";
}
/*

View File

@ -150,7 +150,7 @@ $search_categ = GETPOST('search_categ','int');
// If the internal user must only see his prospect, force searching by him
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// List of avaible states; we'll need that for each lines (quick changing prospect states) and for search bar (filter by prospect state)
// List of available states; we'll need that for each lines (quick changing prospect states) and for search bar (filter by prospect state)
$sts = array(-1,0,1,2,3);
@ -158,6 +158,10 @@ $sts = array(-1,0,1,2,3);
$hookmanager->initHooks(array('prospectlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
@ -171,6 +175,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_datec="";
$search_categ="";
$search_status="";
$search_array_options=array();
}
if ($search_status=='') $search_status=1; // always display active customer first
@ -216,13 +221,14 @@ $sql.= " st.libelle as stcomm_label,";
$sql.= " d.nom as departement";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$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."c_stcomm as st";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
@ -231,7 +237,7 @@ $sql.= " AND s.client IN (2, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = " .$socid;
if ($search_stcomm != '') $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
@ -252,6 +258,19 @@ if ($socname)
$sortfield = "s.nom";
$sortorder = "ASC";
}
// Extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$typ=$extrafields->attribute_type[$tmpkey];
$mode=0;
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
{
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
}
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
@ -265,6 +284,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
}
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
$sql.= $db->plimit($conf->liste_limit+1, $offset);
//print $sql;
dol_syslog('comm/prospect/list.php', LOG_DEBUG);
$resql = $db->query($sql);
@ -298,9 +318,15 @@ if ($resql)
}
if ($search_level_from != '') $param.='&search_level_from='.$search_level_from;
if ($search_level_to != '') $param.='&search_level_to='.$search_level_to;
if ($search_categ != '') $param.='&search_categ='.$search_categ;
if ($search_categ != '') $param.='&search_categ='.urlencode($search_categ);
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
if ($search_status != '') $param.='&search_status='.$search_status;
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
// $param and $urladd should have the same value
$urladd = $param;
@ -346,7 +372,19 @@ if ($resql)
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
// Extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
{
foreach($extrafields->attribute_list as $key => $val)
{
if ($val)
{
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder);
}
}
}
// Hook fields
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -360,13 +398,13 @@ if ($resql)
print '<input type="text" class="flat" name="search_nom" size="10" value="'.$search_nom.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_zipcode" size="10" value="'.$search_zipcode.'">';
print '<input type="text" class="flat" name="search_zipcode" size="6" value="'.$search_zipcode.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_town" size="10" value="'.$search_town.'">';
print '<input type="text" class="flat" name="search_town" size="8" value="'.$search_town.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
print '<input type="text" class="flat" name="search_state" size="10" value="'.$search_state.'">';
print '<input type="text" class="flat" name="search_state" size="8" value="'.$search_state.'">';
print '</td>';
print '<td align="center" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
@ -404,14 +442,29 @@ if ($resql)
{
$arraystcomm[$val['id']]=$val['label'];
}
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, 1);
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2);
print '</td>';
print '<td class="liste_titre" align="center">';
print '&nbsp;';
print '</td>';
$parameters=array();
// Extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
{
foreach($extrafields->attribute_list as $key => $val)
{
if ($val)
{
$crit=$search_array_options['search_options_'.$key];
print '<td class="liste_titre">';
print $extrafields->showInputField($key, $crit, '', '', 'search_', 4);
print '</td>';
}
}
}
// Hook fields
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@ -460,7 +513,7 @@ if ($resql)
print $prospectstatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
print "</td>";
print '<td align="right" class="nowrap">';
print '<td align="center" class="nowrap">';
foreach($prospectstatic->cacheprospectstatus as $key => $val)
{
$titlealt='default';
@ -469,6 +522,21 @@ if ($resql)
}
print '</td>';
// Extrafields
if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
{
foreach($extrafields->attribute_list as $key => $val)
{
if ($val)
{
print '<td>';
$paramkey='options_'.$key;
print $extrafields->showOutputField($key, $obj->$paramkey);
print '</td>';
}
}
}
// Hook fields
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -99,6 +99,13 @@ if ($socid > 0)
$head = societe_prepare_head($objsoc);
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');
@ -119,11 +126,6 @@ if ($socid > 0)
print_fiche_titre($langs->trans("NewRelativeDiscount"),'','');
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<table class="border" width="100%">';
// Nouvelle valeur
@ -136,6 +138,8 @@ if ($socid > 0)
print "</table>";
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
if (! empty($backtopage))
@ -147,8 +151,6 @@ if ($socid > 0)
print "</form>";
dol_fiche_end();
print '<br>';

View File

@ -221,14 +221,14 @@ if ($socid > 0)
*/
$head = societe_prepare_head($objsoc);
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');
print '<table class="border" width="100%">';
// Name
@ -278,6 +278,8 @@ if ($socid > 0)
print "</table>";
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
if (! empty($backtopage))
@ -289,7 +291,6 @@ if ($socid > 0)
print '</form>';
dol_fiche_end();
print '<br>';
@ -329,8 +330,10 @@ if ($socid > 0)
print '<td width="50">&nbsp;</td>';
print '</tr>';
$showconfirminfo=array();
$var = true;
$i = 0 ;
$i = 0;
$num = $db->num_rows($resql);
while ($i < $num)
{
@ -382,24 +385,26 @@ if ($socid > 0)
if ($_GET["action"]=='split' && $_GET['remid'] == $obj->rowid)
{
print "<tr ".$bc[$var].">";
print '<td colspan="8">';
$amount1=price2num($obj->amount_ttc/2,'MT');
$amount2=($obj->amount_ttc-$amount1);
$formquestion=array(
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$obj->rowid, $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($obj->amount_ttc),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
print '</td>';
print '</tr>';
$showconfirminfo['rowid']=$obj->rowid;
$showconfirminfo['amount_ttc']=$obj->amount_ttc;
}
$i++;
}
$db->free($resql);
print "</table>";
if (count($showconfirminfo))
{
$amount1=price2num($showconfirminfo['amount_ttc']/2,'MT');
$amount2=($showconfirminfo['amount_ttc']-$amount1);
$formquestion=array(
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
}
}
else
{

View File

@ -2360,7 +2360,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! $file || ! is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $result);
dol_print_error($db, $object->error, $object->errors);
exit();
}
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');

View File

@ -1112,10 +1112,10 @@ class Commande extends CommonOrder
// get extrafields from original line
$object->fetch_optionals($object->id);
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
@ -2503,16 +2503,16 @@ class Commande extends CommonOrder
$price = ($pu - $remise);
}
// Update line
$this->line=new OrderLine($this->db);
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new OrderLine($this->db);
$line->fetch($rowid);
$staticline = clone $line;
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
// Stock previous line records
$staticline=new OrderLine($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
{
@ -3490,10 +3490,12 @@ class OrderLine extends CommonOrderLine
$this->date_end = $this->db->jdate($objp->date_end);
$this->db->free($result);
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}

View File

@ -62,15 +62,15 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Search customer orders
$var=false;
print '<table class="noborder nohover" width="100%">';
print '<form method="post" action="'.DOL_URL_ROOT.'/commande/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchOrder").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
print '</tr>';
print "</form></table><br>\n";
print "</table></form><br>\n";
/*

View File

@ -292,14 +292,17 @@ foreach ($data as $val)
$year = $val['year'];
while (! empty($year) && $oldyear > $year+1)
{ // If we have empty year
$oldyear--;
print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
$oldyear--;
print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
print '<td align="right">0</td>';
print '<td align="right">0</td>';
print '</tr>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '</tr>';
}
print '<tr height="24">';

View File

@ -371,23 +371,32 @@ if ($id > 0 || ! empty($ref))
/*
* Boutons actions
* Buttons actions
*/
if ($action != 'delete') {
if ($action != 'delete')
{
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro) { // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
if ($object->type != 2 && $object->rappro)
{
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
} else {
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
if ($action != 'addline') {
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
if (empty($conf->accounting->enabled)) {
if ($action != 'addline')
{
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
{
if (empty($conf->accounting->enabled))
{
if ($user->rights->banque->modifier) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
} else {
@ -500,12 +509,13 @@ if ($id > 0 || ! empty($ref))
print '<br>';
}
print '<table class="noborder" width="100%">';
/*
* Affiche tableau des transactions bancaires
* Show list of bank transactions
*/
print '<table class="noborder" width="100%">';
// Ligne de titre tableau des ecritures
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>';
@ -528,11 +538,11 @@ if ($id > 0 || ! empty($ref))
print '<input type="hidden" name="id" value="'.$object->id.'">';
$period_filter .= $langs->trans('From').'&nbsp;'.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1);
$period_filter .= '<BR>'. $langs->trans('to').'&nbsp;'.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1);
$period_filter .= '&nbsp;';
$period_filter .= $langs->trans('to').'&nbsp;'.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1);
print '<tr class="liste_titre">';
print '<td>&nbsp;</td>';
print '<td>'.$period_filter.'</td>';
print '<td colspan="2">'.$period_filter.'</td>';
print '<td>';
//$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...)
$filtertype='';
@ -654,7 +664,8 @@ if ($id > 0 || ! empty($ref))
$label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
if ($objp->fk_type == 'SOLD') $label='&nbsp;';
if ($objp->fk_type == 'CHQ' && $objp->fk_bordereau > 0) {
if ($objp->fk_type == 'CHQ' && $objp->fk_bordereau > 0)
{
dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php');
$bordereaustatic = new RemiseCheque($db);
$bordereaustatic->id = $objp->fk_bordereau;
@ -678,6 +689,7 @@ if ($id > 0 || ! empty($ref))
{
print dol_trunc($objp->label,60);
}
// Add links after description
$links = $object->get_url($objp->rowid);
foreach($links as $key=>$val)

View File

@ -158,7 +158,6 @@ if ($result)
$db->free($result);
}
print "</form>";
/*
* Line to add category
@ -172,9 +171,7 @@ if ($action != 'edit')
print '</tr>';
}
print "</table>";
print "</form>";
print '</table></form>';
llxFooter();

View File

@ -1244,7 +1244,6 @@ class AccountLine extends CommonObject
}
else
{
dol_print_error($this->db);
return -1;
}
}

View File

@ -596,8 +596,7 @@ if ($result)
}
print '</tr>';
print "</table>";
print '</form>';
print '</table></form>';
}
}
@ -610,22 +609,21 @@ print '</div>';
// List of bank categories
print '<br>';
print '<table class="noborder" width="100%">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?rowid='.$rowid.'&amp;id='.$id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="class">';
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Rubriques").'</td><td colspan="2">';
if ($user->rights->banque->modifier)
{
print '<select class="flat" name="cat1">'.$options.'</select>&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
}
print "</tr>";
print "</form>";
print '</tr>';
$sql = "SELECT c.label, c.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c";
@ -650,13 +648,13 @@ if ($result)
{
print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=delete_categ&amp;rowid='.$rowid.'&amp;fk_categ='.$objp->rowid.'">'.img_delete($langs->trans("Remove")).'</a></td>';
}
print "</tr>";
print '</tr>';
$i++;
}
$db->free($result);
}
print "</table>";
print '</table></form>';
llxFooter();

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -43,6 +43,7 @@ if (! $user->rights->banque->consolidate) accessforbidden();
$action=GETPOST('action', 'alpha');
$id=GETPOST('account', 'int');
/*
* Actions
*/
@ -220,7 +221,7 @@ if ($resql)
print "<input type=\"hidden\" name=\"action\" value=\"rappro\">";
print "<input type=\"hidden\" name=\"account\" value=\"".$acct->id."\">";
print $langs->trans("InputReceiptNumber").': ';
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):$objp->num_releve).'" size="10">';
print '<br>';
if ($options)

View File

@ -94,10 +94,10 @@ $banklinestatic=new AccountLine($db);
// Load account
$acct = new Account($db);
$object = new Account($db);
if ($id > 0 || ! empty($ref))
{
$acct->fetch($id, $ref);
$object->fetch($id, $ref);
}
if (empty($num))
@ -107,7 +107,7 @@ if (empty($num))
*/
$sql = "SELECT DISTINCT(b.num_releve) as numr";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.fk_account = ".$acct->id;
$sql.= " WHERE b.fk_account = ".$object->id;
$sql.= " ORDER BY numr DESC";
$sql.= $db->plimit($conf->liste_limit+1,$offset);
@ -120,7 +120,7 @@ if (empty($num))
$i = 0;
// Onglets
$head=bank_prepare_head($acct);
$head=bank_prepare_head($object);
dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account');
print '<table class="border" width="100%">';
@ -130,19 +130,36 @@ if (empty($num))
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($acct, 'ref', $linkback, 1, 'ref');
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '<td colspan="3">'.$object->label.'</td></tr>';
print '</table>';
dol_fiche_end();
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro)
{
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$acct->id, $sortfield, $sortorder,'',$numrows);
print '</div>';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&account=".$object->id, $sortfield, $sortorder,'',$numrows);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -164,13 +181,13 @@ if (empty($num))
}
else
{
print '<tr '.$bc[$var].'><td><a href="releve.php?num='.$objp->numr.'&amp;account='.$acct->id.'">'.$objp->numr.'</a></td>';
print '<tr '.$bc[$var].'><td><a href="releve.php?num='.$objp->numr.'&amp;account='.$object->id.'">'.$objp->numr.'</a></td>';
// Calculate start amount
$sql = "SELECT sum(b.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve < '".$db->escape($objp->numr)."'";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " AND b.fk_account = ".$object->id;
$resql=$db->query($sql);
if ($resql)
{
@ -184,7 +201,7 @@ if (empty($num))
$sql = "SELECT sum(b.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve = '".$db->escape($objp->numr)."'";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " AND b.fk_account = ".$object->id;
$resql=$db->query($sql);
if ($resql)
{
@ -222,7 +239,7 @@ else
$sql = "SELECT DISTINCT(b.num_releve) as num";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve < '".$db->escape($num)."'";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " AND b.fk_account = ".$object->id;
$sql.= " ORDER BY b.num_releve DESC";
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
@ -244,7 +261,7 @@ else
$sql = "SELECT DISTINCT(b.num_releve) as num";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve > '".$db->escape($num)."'";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " AND b.fk_account = ".$object->id;
$sql.= " ORDER BY b.num_releve ASC";
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
@ -265,10 +282,10 @@ else
$found=true;
}
$mesprevnext ="<a href=\"releve.php?rel=prev&amp;num=$num&amp;ve=$ve&amp;account=$acct->id\">".img_previous()."</a> &nbsp;";
$mesprevnext ="<a href=\"releve.php?rel=prev&amp;num=$num&amp;ve=$ve&amp;account=$object->id\">".img_previous()."</a> &nbsp;";
$mesprevnext.= $langs->trans("AccountStatement")." $num";
$mesprevnext.=" &nbsp; <a href=\"releve.php?rel=next&amp;num=$num&amp;ve=$ve&amp;account=$acct->id\">".img_next()."</a>";
print_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$acct->getNomUrl(0),$mesprevnext, 'title_bank.png');
$mesprevnext.=" &nbsp; <a href=\"releve.php?rel=next&amp;num=$num&amp;ve=$ve&amp;account=$object->id\">".img_next()."</a>";
print_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0),$mesprevnext, 'title_bank.png');
print '<br>';
print "<form method=\"post\" action=\"releve.php\">";
@ -291,7 +308,7 @@ else
$sql = "SELECT sum(b.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve < '".$db->escape($num)."'";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " AND b.fk_account = ".$object->id;
$resql=$db->query($sql);
if ($resql)
@ -309,7 +326,7 @@ else
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve='".$db->escape($num)."'";
if (!isset($num)) $sql.= " OR b.num_releve is null";
$sql.= " AND b.fk_account = ".$acct->id;
$sql.= " AND b.fk_account = ".$object->id;
$sql.= " AND b.fk_account = ba.rowid";
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
@ -321,7 +338,7 @@ else
$i = 0;
// Ligne Solde debut releve
print "<tr><td colspan=\"4\"><a href=\"releve.php?num=$num&amp;ve=1&amp;rel=$rel&amp;account=".$acct->id."\">&nbsp;</a></td>";
print "<tr><td colspan=\"4\"><a href=\"releve.php?num=$num&amp;ve=1&amp;rel=$rel&amp;account=".$object->id."\">&nbsp;</a></td>";
print "<td align=\"right\" colspan=\"2\"><b>".$langs->trans("InitialBankBalance")." :</b></td><td align=\"right\"><b>".price($total)."</b></td><td>&nbsp;</td></tr>\n";
while ($i < $numrows)
@ -337,10 +354,10 @@ else
// Date de valeur
print '<td align="center" valign="center" class="nowrap">';
print '<a href="releve.php?action=dvprev&amp;num='.$num.'&amp;account='.$acct->id.'&amp;dvid='.$objp->rowid.'">';
print '<a href="releve.php?action=dvprev&amp;num='.$num.'&amp;account='.$object->id.'&amp;dvid='.$objp->rowid.'">';
print img_previous().'</a> ';
print dol_print_date($db->jdate($objp->dv),"day") .' ';
print '<a href="releve.php?action=dvnext&amp;num='.$num.'&amp;account='.$acct->id.'&amp;dvid='.$objp->rowid.'">';
print '<a href="releve.php?action=dvnext&amp;num='.$num.'&amp;account='.$object->id.'&amp;dvid='.$objp->rowid.'">';
print img_next().'</a>';
print "</td>\n";
@ -353,7 +370,7 @@ else
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').'</td>';
// Description
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$object->id.'">';
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
@ -364,7 +381,7 @@ else
* Ajout les liens (societe, company...)
*/
$newline=1;
$links = $acct->get_url($objp->rowid);
$links = $object->get_url($objp->rowid);
foreach($links as $key=>$val)
{
if (! $newline) print ' - ';
@ -500,7 +517,7 @@ else
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
{
print "<td align=\"center\"><a href=\"ligne.php?rowid=$objp->rowid&amp;account=".$acct->id."\">";
print "<td align=\"center\"><a href=\"ligne.php?rowid=$objp->rowid&amp;account=".$object->id."\">";
print img_edit();
print "</a></td>";
}
@ -522,6 +539,7 @@ else
print "</table></form>\n";
}
$db->close();
llxFooter();
$db->close();

View File

@ -442,7 +442,7 @@ if (empty($reshook))
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db,$result);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
}
else
@ -1421,10 +1421,7 @@ if (empty($reshook))
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
unset($_POST['prod_entry_mode']);
@ -3537,14 +3534,17 @@ else if ($id > 0 || ! empty($ref))
// modified by hook
if (empty($reshook)) {
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
if ($object->statut == 1) {
if ($object->statut == 1)
{
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
$ventilExportCompta = $object->getVentilExportCompta();
if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
if (! $objectidnext && $object->is_last_in_cycle()) {
if ($resteapayer == $object->total_ttc && empty($object->paye) && $ventilExportCompta == 0)
{
if (! $objectidnext && $object->is_last_in_cycle())
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->invoice_advance->unvalidate)))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
} else {
@ -3807,7 +3807,7 @@ else if ($id > 0 || ! empty($ref))
if (! $file || ! is_readable($file)) {
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
dol_print_error($db, $result);
dol_print_error($db, $object->error, $object->errors);
exit();
}
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
@ -3852,6 +3852,7 @@ else if ($id > 0 || ! empty($ref))
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
$formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit['__CONTACTCIVNAME__'] = '';

View File

@ -2345,16 +2345,26 @@ class Facture extends CommonInvoice
$pu_tva = $tabprice[4];
$pu_ttc = $tabprice[5];
// Update line into database
$this->line=new FactureLigne($this->db);
// Old properties: $price, $remise (deprecated)
$price = $pu;
$remise = 0;
if ($remise_percent > 0)
{
$remise = round(($pu * $remise_percent / 100),2);
$price = ($pu - $remise);
}
$price = price2num($price);
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new FactureLigne($this->db);
$line->fetch($rowid);
$staticline = clone $line;
$line->oldline = $staticline;
$this->line = $line;
$this->line->context = $this->context;
// Stock previous line records
$staticline=new FactureLigne($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
{
@ -3866,10 +3876,12 @@ class FactureLigne extends CommonInvoiceLine
$this->fk_prev_id = $objp->fk_prev_id;
$this->db->free($result);
return 1;
}
else
{
dol_print_error($this->db);
return -1;
}
}

View File

@ -636,7 +636,7 @@ else
$i++;
}
}
else print '<tr><td>'.$langs->trans("NoneF").'</td></tr>';
else print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("NoneF").'</td></tr>';
print "</table>";
$db->free($resql);

View File

@ -129,6 +129,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_montant_ht='';
$search_montant_ttc='';
$search_status='';
$day='';
$year='';
$month='';
}
@ -350,7 +351,7 @@ if ($resql)
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right">';
$liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"), '3'=>$langs->trans("Cancel"));
$liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';

View File

@ -56,7 +56,7 @@ if (GETPOST('button_search'))
}
if ($option == 'late') $filter = 'paye:0';
if ($option == 'unpaidall') $filter = 'paye:0';
if ($mode == 'sendremind' && $filter == '') $filter = 'paye:0';
if ($mode == 'sendmassremind' && $filter == '') $filter = 'paye:0';
if ($filter == '') $filter = 'paye:0';
$search_user = GETPOST('search_user','int');
@ -165,10 +165,12 @@ if ($action == 'presend' && GETPOST('sendmail'))
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj2->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
//'__LASTNAME__' => $obj2->lastname,
//'__FIRSTNAME__' => $obj2->firstname,
'__REF__' => $object->ref,
'__FACREF__' => $object->ref, // For backward compatibility
'__REF__' => $object->ref,
'__REFCLIENT__' => $object->thirdparty->name
);
$subject=make_substitutions($subject, $substitutionarray);
$message=make_substitutions($message, $substitutionarray);
$actiontypecode='AC_FAC';
@ -196,7 +198,7 @@ if ($action == 'presend' && GETPOST('sendmail'))
}
else
{
//$result=$mailfile->sendfile();
$result=$mailfile->sendfile();
if ($result)
{
$resultmasssend.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
@ -246,12 +248,11 @@ if ($action == 'presend' && GETPOST('sendmail'))
}
}
else
{
{
$nbignored++;
$langs->load("other");
$resultmasssend.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
dol_syslog('Failed to read file: '.$file);
break ;
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
}
}
}
@ -263,7 +264,7 @@ if ($action == 'presend' && GETPOST('sendmail'))
}
else
{
setEventMessage($langs->trans("NoRemindSent"), 'warnings');
setEventMessage($langs->trans("NoRemindSent"), 'warnings'); // May be object has no generated PDF file
}
}
}
@ -556,9 +557,7 @@ if ($resql)
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
print '<br>';
print_fiche_titre($langs->trans("SendRemind"),'','');
print '<br>';
dol_fiche_head(null, '', $langs->trans("SendRemind"));
$topicmail="MailTopicSendRemindUnpaidInvoices";
$modelmail="facture_relance";
@ -598,7 +597,8 @@ if ($resql)
$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
print $formmail->get_form();
print '<br>'."\n";
dol_fiche_end();
}
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -280,8 +280,11 @@ foreach ($data as $val)
print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '</tr>';
}
print '<tr height="24">';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* 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
@ -610,7 +611,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$chargestatic->lib=$obj->libelle;
$chargestatic->paye=$obj->paye;
print '<td>'.$chargestatic->getNomUrl(1).'</td>';
print '<td align="center">'.dol_print_date($obj->date_ech,'day').'</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_ech),'day').'</td>';
print '<td align="right">'.price($obj->amount).'</td>';
print '<td align="right">'.price($obj->sumpaid).'</td>';
print '<td align="center">'.$chargestatic->getLibStatut(3).'</td>';
@ -974,7 +975,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var]."><td>".dol_print_date($obj->da,"day")."</td>";
print "<tr ".$bc[$var]."><td>".dol_print_date($db->jdate($obj->da),"day")."</td>";
print '<td><a href="action/card.php">'.$obj->libelle.' '.$obj->label.'</a></td></tr>';
$i++;
}

View File

@ -184,7 +184,7 @@ print "<td>".$langs->trans("Account")."</td>";
print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
print "</tr>\n";
$var=true;
$var=false;
$invoicestatic=new FactureFournisseur($db);
$companystatic=new Fournisseur($db);

View File

@ -114,8 +114,13 @@ $sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
else $sql.= " AND f.type IN (0,1,2,3,5)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
}
else {
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
}
$sql.= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " ORDER BY f.rowid";
@ -163,10 +168,15 @@ if ($result)
$line = new FactureLigne($db);
$line->fetch($obj->id);
$prev_progress = $line->get_prev_progress();
if ($obj->situation_percent == 0) { // Avoid divide by 0
$situation_ratio = 0;
if ($obj->type==Facture::TYPE_SITUATION) {
// Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
$situation_ratio = 1;
}
//la ligne facture
@ -205,7 +215,7 @@ print '<td>'.$langs->trans('Account').'</td>';
print '<td>'.$langs->trans('Type').'</td><td align="right">'.$langs->trans('Debit').'</td><td align="right">'.$langs->trans('Credit').'</td>';
print "</tr>\n";
$var=true;
$var=false;
$invoicestatic=new Facture($db);
$companystatic=new Client($db);

View File

@ -88,10 +88,6 @@ if ($action == 'setdate' && $user->rights->banque->cheque)
}
}
/*
* Actions
*/
if ($action == 'setrefext' && $user->rights->banque->cheque)
{
$result = $object->fetch(GETPOST('id','int'));
@ -282,7 +278,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque)
$langs->load("other");
$file=$dir.get_exdir($object->number,2,1,0,$object,'cheque') . GETPOST('file');
$file=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
@ -581,6 +577,7 @@ else
print '</tr>';
// External ref
/* Ext ref are not visible field on standard usage
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -605,7 +602,8 @@ else
print '</td>';
print '</tr>';
*/
print '<tr><td>'.$langs->trans('Account').'</td><td colspan="2">';
print $accountstatic->getNomUrl(1);
print '</td></tr>';
@ -626,7 +624,7 @@ else
print '</table><br>';
// Liste des cheques
// List of cheques
$sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,";
$sql.= " b.dateo as date, b.datec as datec, b.banque,";
$sql.= " p.rowid as pid, ba.rowid as bid, p.statut";
@ -636,7 +634,7 @@ else
$sql.= " WHERE ba.entity IN (".getEntity('bank_account', 1).")";
$sql.= " AND b.fk_type= 'CHQ'";
$sql.= " AND b.fk_bordereau = ".$object->id;
$sql.= " ORDER BY $sortfield $sortorder";
$sql.= $db->order($sortfield, $sortorder);
$resql = $db->query($sql);
if ($resql)
@ -655,7 +653,6 @@ else
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$i=1;
$var=false;
@ -751,7 +748,7 @@ if ($action != 'new')
if ($object->statut == 1)
{
$filename=dol_sanitizeFileName($object->ref);
$filedir=$dir.get_exdir($object->number,2,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
$filedir=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref);
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);

View File

@ -548,7 +548,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charseSupprimert_output=$outputlangs->charset_output;
$result=$docmodel->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
$result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
if ($result > 0)
{
//$outputlangs->charset_output=$sav_charset_output;

View File

@ -28,6 +28,8 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("bills");
$langs->load("compta");
@ -36,6 +38,10 @@ $langs->load("compta");
$facid =GETPOST('facid','int');
$socid =GETPOST('socid','int');
$userid=GETPOST('userid','int');
$day = GETPOST('day','int');
$month = GETPOST('month','int');
$year = GETPOST('year','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture',$facid,'');
@ -66,6 +72,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_amount="";
$search_paymenttype="";
$search_company="";
$day='';
$year='';
$month='';
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
@ -81,6 +90,7 @@ $extrafields = new ExtraFields($db);
llxHeader('', $langs->trans('ListPayment'));
$form=new Form($db);
$formother=new FormOther($db);
if (GETPOST("orphelins"))
{
@ -141,6 +151,19 @@ else
else $sql.= " AND f.fk_user_author = ".$userid;
}
// Search criteria
if ($month > 0)
{
if ($year > 0 && empty($day))
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
else if ($year > 0 && ! empty($day))
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
else
$sql.= " AND date_format(p.datep, '%m') = '".$month."'";
}
else if ($year > 0)
{
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if ($search_ref > 0) $sql .=" AND p.rowid=".$search_ref;
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
@ -194,7 +217,11 @@ if ($resql)
print '<td align="left">';
print '<input class="flat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
$formother->select_year($year?$year:-1,'year',1, 20, 5);
print '</td>';
print '<td align="left">';
print '<input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'">';
print '</td>';

View File

@ -309,7 +309,7 @@ if ($modecompta == 'CREANCES-DETTES')
}
else
{
$sql = "SELECT s.nom, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f";

View File

@ -191,17 +191,18 @@ if ($result)
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Amount
print "<td align=\"right\">".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
print "<td>&nbsp;</td>";
print "<td align=\"right\">".price($obj->amount)."</td>";
print "<td></td>";
print "</tr>\n";
$total = $total + $obj->amount;
$i++;
}
print '<tr class="liste_total"><td colspan="6" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
print "<td>&nbsp;</td></tr>";
print "<td></td></tr>";
print "</table>";

View File

@ -516,9 +516,10 @@ class Contact extends CommonObject
*/
function fetch($id, $user=0, $ref_ext='')
{
dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
global $langs;
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
if (empty($id) && empty($ref_ext))
{
$this->error='BadParameter';
@ -547,7 +548,6 @@ class Contact extends CommonObject
if ($id) $sql.= " WHERE c.rowid = ". $id;
elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{

View File

@ -269,7 +269,7 @@ if ($result)
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="view" value="'.htmlspecialchars($view).'">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';

View File

@ -65,8 +65,8 @@ $v->setPhoneNumber($contact->phone_pro, "PREF;WORK;VOICE");
$v->setPhoneNumber($contact->phone_mobile, "CELL;VOICE");
$v->setPhoneNumber($contact->fax, "WORK;FAX");
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK;POSTAL");
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country_id:''), "WORK");
$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country:''), "WORK;POSTAL");
$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code?$contact->country:''), "WORK");
$v->setEmail($contact->email,'internet,pref');
$v->setNote($contact->note);
@ -78,7 +78,7 @@ if ($company->id)
$v->setURL($company->url, "WORK");
if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "WORK;VOICE");
if (! $contact->fax) $v->setPhoneNumber($company->fax, "WORK;FAX");
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country_code, "WORK;POSTAL");
if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country, "WORK;POSTAL");
if ($company->email != $contact->email) $v->setEmail($company->email,'internet');
// Si contact lie a un tiers non de type "particulier"
if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name);

View File

@ -153,7 +153,9 @@ if ($resql)
if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices");
if ($mode == "5") $title=$langs->trans("ListOfClosedServices");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png');
print '<form method="POST" action="'. $_SERVER["PHP_SELF"] .'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
@ -169,9 +171,6 @@ if ($resql)
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder);
print "</tr>\n";
print '<form method="POST" action="'. $_SERVER["PHP_SELF"] .'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="hidden" name="filter" value="'.$filter.'">';
@ -203,7 +202,6 @@ if ($resql)
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
print '</form>';
$contractstatic=new Contrat($db);
$productstatic=new Product($db);
@ -278,7 +276,7 @@ if ($resql)
}
$db->free($resql);
print "</table>";
print '</table></form>';
}
else

View File

@ -27,6 +27,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@capnetworks.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
@ -17,7 +17,8 @@
/**
* \file htdocs/core/ajax/security.php
* \brief File for return security data
* \brief This ajax component is used to generated has keys for security purposes
* like key to use into URL to protect them.
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
@ -26,6 +27,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1');
require '../../main.inc.php';
@ -33,10 +35,6 @@ require '../../main.inc.php';
* View
*/
// Ajout directives pour resoudre bug IE
//header('Cache-Control: Public, must-revalidate');
//header('Pragma: public');
//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header.
top_httphead();
@ -48,7 +46,7 @@ if (isset($_GET['action']) && ! empty($_GET['action']))
if ($_GET['action'] == 'getrandompassword' && $user->admin)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$generic = $_GET['generic'];
$generic = $_GET['generic'] ? true : false;
echo getRandomPassword($generic);
}
}

View File

@ -105,7 +105,7 @@ class box_contacts extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1),
'text' => ($objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : ''),
'asis' => 1,
);

View File

@ -155,7 +155,6 @@ class box_prospect extends ModeleBoxes
);
}
} else {
dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR);
$this->info_box_contents[0][0] = array(
'td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"),

View File

@ -375,19 +375,19 @@ class CMailFile
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS))
{
dol_include_once('/core/class/hookmanager.class.php');
$hookmanager=new HookManager($db);
$hookmanager->initHooks(array('maildao'));
$reshook=$hookmanager->executeHooks('doactions',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (!empty($reshook))
{
dol_include_once('/core/class/hookmanager.class.php');
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array(
'maildao'
));
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (! empty($reshook))
{
$this->error = "Error in hook maildao doactions " . $reshook;
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
$this->error="Error in hook maildao doactions ".$reshook;
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
return $reshook;
}
return $reshook;
}
// Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')

View File

@ -2159,11 +2159,11 @@ abstract class CommonObject
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
$targettype = (! empty($targettype) ? $targettype : $this->element);
if (empty($sourceid) && empty($targetid))
/*if (empty($sourceid) && empty($targetid))
{
dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERR);
return -1;
}
}*/
// Links between objects are stored in table element_element
$sql = 'SELECT rowid, fk_source, sourcetype, fk_target, targettype';
@ -3277,12 +3277,12 @@ abstract class CommonObject
* Need $this->element & $this->id
*
* @param int $resource_id Resource id
* @param string $resource_element Resource element
* @param string $resource_type 'resource'
* @param int $busy Busy or not
* @param int $mandatory Mandatory or not
* @return int <=0 if KO, >0 if OK
*/
function add_element_resource($resource_id,$resource_element,$busy=0,$mandatory=0)
function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0)
{
$this->db->begin();
@ -3295,7 +3295,7 @@ abstract class CommonObject
$sql.= ", mandatory";
$sql.= ") VALUES (";
$sql.= $resource_id;
$sql.= ", '".$resource_element."'";
$sql.= ", '".$resource_type."'";
$sql.= ", '".$this->id."'";
$sql.= ", '".$this->element."'";
$sql.= ", '".$busy."'";
@ -3470,11 +3470,20 @@ abstract class CommonObject
if (empty($srctemplatepath))
{
$this->error='ErrorGenerationAskedForOdtTemplateWithNoSrcFileFound';
$this->error='ErrorGenerationAskedForOdtTemplateWithSrcFileNotDefined';
return -1;
}
}
if ($obj->type == 'odt' && ! empty($srctemplatepath))
{
if (! dol_is_file($srctemplatepath))
{
$this->error='ErrorGenerationAskedForOdtTemplateWithSrcFileNotFound';
return -1;
}
}
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
@ -3588,6 +3597,11 @@ abstract class CommonObject
{
if (empty($rowid)) $rowid=$this->id;
//To avoid SQL errors. Probably not the better solution though
if (!$this->table_element) {
return 0;
}
if (! is_array($optionsArray))
{
// optionsArray not already loaded, so we load it
@ -3794,7 +3808,7 @@ abstract class CommonObject
*/
function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='')
{
global $_POST, $conf;
global $_POST, $conf, $langs;
$out = '';
@ -3852,7 +3866,7 @@ abstract class CommonObject
if($extrafields->attribute_required[$key])
$label = '<span class="fieldrequired">'.$label.'</span>';
$out .= '<td>'.$label.'</td>';
$out .= '<td>'.$langs->trans($label).'</td>';
$out .='<td'.($colspan?' colspan="'.$colspan.'"':'').'>';
switch($mode) {

View File

@ -110,6 +110,7 @@ class Conf
$this->bank = new stdClass();
$this->notification = new stdClass();
$this->mailing = new stdClass();
$this->expensereport = new stdClass();
}
@ -474,6 +475,7 @@ class Conf
$this->adherent->cotisation = new stdClass();
$this->bank->rappro = new stdClass();
$this->bank->cheque = new stdClass();
$this->expensereport->payment = new stdClass();
$this->actions->warning_delay=(isset($this->global->MAIN_DELAY_ACTIONS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60;
$this->commande->client->warning_delay=(isset($this->global->MAIN_DELAY_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_ORDERS_TO_PROCESS:2)*24*60*60;
$this->commande->fournisseur->warning_delay=(isset($this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS)?$this->global->MAIN_DELAY_SUPPLIER_ORDERS_TO_PROCESS:7)*24*60*60;
@ -486,6 +488,7 @@ class Conf
$this->adherent->cotisation->warning_delay=(isset($this->global->MAIN_DELAY_MEMBERS)?$this->global->MAIN_DELAY_MEMBERS:0)*24*60*60;
$this->bank->rappro->warning_delay=(isset($this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE)?$this->global->MAIN_DELAY_TRANSACTIONS_TO_CONCILIATE:0)*24*60*60;
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
// For modules that want to disable top or left menu
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;

View File

@ -567,7 +567,7 @@ class ExtraFields
/**
* Load array this->attribute_xxx like attribute_label, attribute_type, ...
*
* @param string $elementtype Type of element ('adherent', 'commande', thirdparty', 'facture', 'propal', 'product', ...)
* @param string $elementtype Type of element ('adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...)
* @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED
* @return array Array of attributes for all extra fields
*/
@ -631,13 +631,15 @@ class ExtraFields
/**
* Return HTML string to put an input field into a page
*
* @param string $key Key of attribute
* @param string $value Value to show (for date type it must be in timestamp format)
* @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @return string
* @param string $key Key of attribute
* @param string $value Value to show (for date type it must be in timestamp format)
* @param string $moreparam To add more parametes on html input tag
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @param int $showsize Value for size attribute
* @return string
*/
function showInputField($key,$value,$moreparam='',$keyprefix='')
function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0)
{
global $conf,$langs;
@ -651,24 +653,27 @@ class ExtraFields
$perms=$this->attribute_perms[$key];
$list=$this->attribute_list[$key];
if ($type == 'date')
if (empty($showsize))
{
$showsize=10;
if ($type == 'date')
{
$showsize=10;
}
elseif ($type == 'datetime')
{
$showsize=19;
}
elseif (in_array($type,array('int','double')))
{
$showsize=10;
}
else
{
$showsize=round($size);
if ($showsize > 48) $showsize=48;
}
}
elseif ($type == 'datetime')
{
$showsize=19;
}
elseif (in_array($type,array('int','double')))
{
$showsize=10;
}
else
{
$showsize=round($size);
if ($showsize > 48) $showsize=48;
}
if (in_array($type,array('date','datetime')))
{
$tmp=explode(',',$size);
@ -684,22 +689,22 @@ class ExtraFields
if (! is_object($form)) $form=new Form($this->db);
// TODO Must also support $moreparam
$out = $form->select_date($value, 'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
}
elseif (in_array($type,array('int')))
{
$tmp=explode(',',$size);
$newsize=$tmp[0];
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'varchar')
{
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'text')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
$doleditor=new DolEditor($keysuffix.'options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100);
$out=$doleditor->Create(1);
}
elseif ($type == 'boolean')
@ -710,26 +715,26 @@ class ExtraFields
} else {
$checked=' value="1" ';
}
$out='<input type="checkbox" class="flat" name="options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
$out='<input type="checkbox" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'mail')
{
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="32" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="32" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'phone')
{
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
}
elseif ($type == 'price')
{
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{
if (!empty($value)) {
$value=price($value);
}
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="6" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
}
elseif ($type == 'select')
{
@ -737,10 +742,10 @@ class ExtraFields
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox('options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
$out.='<select class="flat" name="options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
$out.='<option value="0">&nbsp;</option>';
foreach ($param['options'] as $key=>$val )
{
@ -758,10 +763,10 @@ class ExtraFields
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox('options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
}
$out.='<select class="flat" name="options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
$out.='<select class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
if (is_array($param['options']))
{
$param_list=array_keys($param['options']);
@ -907,7 +912,7 @@ class ExtraFields
foreach ($param['options'] as $keyopt=>$val )
{
$out.='<input class="flat" type="checkbox" name="options_'.$key.$keyprefix.'[]" '.($moreparam?$moreparam:'');
$out.='<input class="flat" type="checkbox" name="'.$keysuffix.'options_'.$key.$keyprefix.'[]" '.($moreparam?$moreparam:'');
$out.=' value="'.$keyopt.'"';
if ((is_array($value_arr)) && in_array($keyopt,$value_arr)) {
@ -924,7 +929,7 @@ class ExtraFields
$out='';
foreach ($param['options'] as $keyopt=>$val )
{
$out.='<input class="flat" type="radio" name="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
$out.='<input class="flat" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
$out.=' value="'.$keyopt.'"';
$out.= ($value==$keyopt?'checked':'');
$out.='/>'.$val.'<br>';
@ -1018,7 +1023,7 @@ class ExtraFields
$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
}
}
$out .= '<input class="flat" type="checkbox" name="options_' . $key . $keyprefix . '[]" ' . ($moreparam ? $moreparam : '');
$out .= '<input class="flat" type="checkbox" name="'.$keysuffix.'options_' . $key . $keyprefix . '[]" ' . ($moreparam ? $moreparam : '');
$out .= ' value="' . $obj->rowid . '"';
$out .= 'checked';
@ -1037,7 +1042,7 @@ class ExtraFields
$labeltoshow = '(not defined)';
if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) {
$out .= '<input class="flat" type="checkbox" name="options_' . $key . $keyprefix . '[]" ' . ($moreparam ? $moreparam : '');
$out .= '<input class="flat" type="checkbox" name="'.$keysuffix.'options_' . $key . $keyprefix . '[]" ' . ($moreparam ? $moreparam : '');
$out .= ' value="' . $obj->rowid . '"';
$out .= 'checked';
@ -1050,7 +1055,7 @@ class ExtraFields
$parent = $parentName . ':' . $obj->{$parentField};
}
$out .= '<input class="flat" type="checkbox" name="options_' . $key . $keyprefix . '[]" ' . ($moreparam ? $moreparam : '');
$out .= '<input class="flat" type="checkbox" name="'.$keysuffix.'options_' . $key . $keyprefix . '[]" ' . ($moreparam ? $moreparam : '');
$out .= ' value="' . $obj->rowid . '"';
$out .= ((is_array($value_arr) && in_array($obj->rowid, $value_arr)) ? ' checked ' : '');
@ -1080,7 +1085,7 @@ class ExtraFields
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$out='<input type="text" class="flat" name="options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
}
/* Add comments
@ -1417,14 +1422,16 @@ class ExtraFields
return 0;
}
}
/**
* return array_options array for object by extrafields value (using for data send by forms)
*
* @param array $extralabels $array of extrafields
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @return int 1 if array_options set / 0 if no value
* @param array $extralabels $array of extrafields
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
* @return int 1 if array_options set / 0 if no value
*/
function getOptionalsFromPost($extralabels,$keyprefix='')
function getOptionalsFromPost($extralabels,$keyprefix='',$keysuffix='')
{
global $_POST;
@ -1439,24 +1446,24 @@ class ExtraFields
if (in_array($key_type,array('date','datetime')))
{
// Clean parameters
$value_key=dol_mktime($_POST["options_".$key.$keyprefix."hour"], $_POST["options_".$key.$keyprefix."min"], 0, $_POST["options_".$key.$keyprefix."month"], $_POST["options_".$key.$keyprefix."day"], $_POST["options_".$key.$keyprefix."year"]);
$value_key=dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]);
}
else if (in_array($key_type,array('checkbox')))
{
$value_arr=GETPOST("options_".$key.$keyprefix);
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key=implode($value_arr,',');
}
else if (in_array($key_type,array('price','double')))
{
$value_arr=GETPOST("options_".$key.$keyprefix);
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key=price2num($value_arr);
}
else
{
$value_key=GETPOST("options_".$key.$keyprefix);
$value_key=GETPOST($keysuffix."options_".$key.$keyprefix);
}
$array_options["options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read.
$array_options[$keysuffix."options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read.
}
return $array_options;

View File

@ -2112,7 +2112,7 @@ class Form
$outval.= ' '.$langs->transnoentities("Units");
}
if ($objp->quantity > 1)
if ($objp->quantity >= 1)
{
$opt.=" (".price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outval.=" (".price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
@ -4406,7 +4406,7 @@ 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 '&nbsp;').
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or '&nbsp;'), <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
@ -4455,7 +4455,7 @@ class Form
{
$textforempty=' ';
if (! empty($conf->use_javascript_ajax)) $textforempty='&nbsp;'; // If we use ajaxcombo, we need &nbsp; here to avoid to have an empty element that is too small.
$out.='<option value="-1"'.($id==-1?' selected':'').'>'.$textforempty.'</option>'."\n";
$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_array($array))

View File

@ -179,7 +179,7 @@ class FormActions
elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
else $title=$langs->trans("Actions");
print_titre($title);
print load_fiche_titre($title,'','');
$total = 0; $var=true;
print '<table class="noborder" width="100%">';
@ -196,10 +196,7 @@ class FormActions
foreach($listofactions as $action)
{
$savlabel=$action->label;
$action->label=$action->ref;
$ref=$action->getNomUrl(1);
$action->label=$savlabel;
$ref=$action->getNomUrl(1,-1);
$label=$action->getNomUrl(0,38);
$var=!$var;

View File

@ -225,6 +225,7 @@ class FormMail extends Form
/**
* Get the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
* this->param: Contains more parameteres like email templates info
*
* @param string $addfileaction Name of action when posting file attachments
* @param string $removefileaction Name of action when removing file attachments
@ -252,7 +253,7 @@ class FormMail extends Form
return $hookmanager->resPrint;
}
else
{
{
$out='';
// Define list of attached files
@ -281,14 +282,16 @@ class FormMail extends Form
$model_id=$this->param["models_id"];
}
$arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
//var_dump($arraydefaultmessage);
$out.= "\n<!-- Debut form mail -->\n";
$out.= "\n<!-- Begin form mail -->\n";
if ($this->withform == 1)
{
$out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">'."\n";
$out.= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
$out.= '<input style="display:none" type="submit" id="sendmail" name="sendmail">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
$out.= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
$out.= '<a id="formmail" name="formmail"></a>';
}
foreach ($this->param as $key=>$value)
{
@ -310,7 +313,7 @@ class FormMail extends Form
if (count($modelmail_array)>0)
{
$out.= '<div style="padding: 3px 0 3px 0">'."\n";
$out.= $langs->trans('SelectMailModel').':'.$this->selectarray('modelmailselected', $modelmail_array,$model_id);
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Valid').'" name="modelselected" id="modelselected">';
@ -330,7 +333,7 @@ class FormMail extends Form
{
$help.=$key.' -> '.$langs->trans($val).'<br>';
}
$out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
$out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help);
$out.= "</td></tr>\n";
}
@ -569,7 +572,7 @@ class FormMail extends Form
}
else
{
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. (isset($_POST["subject"])?$_POST["subject"]:($defaulttopic?$defaulttopic:'')) .'" />';
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. ((isset($_POST["subject"]) && ! $_POST['modelselected'])?$_POST["subject"]:($defaulttopic?$defaulttopic:'')) .'" />';
}
$out.= "</td></tr>\n";
}
@ -717,7 +720,7 @@ class FormMail extends Form
if ($this->withform == 1) $out.= '</form>'."\n";
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTER is set
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
if (! empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY))
{
$out.= '<script type="text/javascript" language="javascript">';
@ -733,7 +736,7 @@ class FormMail extends Form
$out.= '</script>';
}
$out.= "<!-- Fin form mail -->\n";
$out.= "<!-- End form mail -->\n";
return $out;
}

View File

@ -303,13 +303,14 @@ class FormOther
* Return select list for categories (to use in form search selectors)
*
* @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
* @param int $showempty Add also an empty line
* @return string Html combo list code
* @see select_all_categories
*/
function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0)
function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0,$showempty=1)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@ -331,7 +332,7 @@ class FormOther
// Print a select with each of them
$moreforfilter.='<select class="flat minwidth100" id="select_categ_'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing
if ($showempty) $moreforfilter.='<option value="0">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs))
{

View File

@ -423,7 +423,7 @@ class FormProjets
* @param string $morecss More CSS
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
*/
function select_element($table_element,$socid=0,$morecss='')
function select_element($table_element, $socid=0, $morecss='')
{
global $conf, $langs;
@ -515,13 +515,14 @@ class FormProjets
/**
* Build a HTML select list of element of same thirdparty to suggest to link them to project
*
* @param string $htmlname HTML name
* @param int $preselected Preselected
* @param int $showempty Add an empty line
* @param int $useshortlabel Use short label
* @return int|string The HTML select list of element or '' if nothing or -1 if KO
* @param string $htmlname HTML name
* @param int $preselected Preselected
* @param int $showempty Add an empty line
* @param int $useshortlabel Use short label
* @param int $showallnone Add choice "All" and "None"
* @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)
function selectOpportunityStatus($htmlname, $preselected=0, $showempty=1, $useshortlabel=0, $showallnone=0)
{
global $conf, $langs;
@ -530,8 +531,6 @@ class FormProjets
$sql.= " WHERE active = 1";
$sql.= " ORDER BY position";
dol_syslog(get_class($this).'::selectOpportunityStatus', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -541,6 +540,8 @@ class FormProjets
{
$sellist = '<select class="flat oppstatus" 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>';
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);

View File

@ -522,7 +522,7 @@ class SMTPs
* @param mixed $_strConfigPath path to config file or VOID
* @return void
*/
function setConfig ( $_strConfigPath = null )
function setConfig($_strConfigPath = null)
{
/**
* Returns constructed SELECT Object string or boolean upon failure
@ -736,7 +736,7 @@ class SMTPs
* @param string $_strTransEncode Content-Transfer-Encoding
* @return void
*/
function setTransEncode ( $_strTransEncode )
function setTransEncode($_strTransEncode)
{
if (array_search($_strTransEncode, $this->_smtpsTransEncodeTypes))
$this->_smtpsTransEncode = $_strTransEncode;
@ -830,7 +830,7 @@ class SMTPs
* @return void
*
*/
function _buildAddrList( $_type, $_addrList )
function _buildAddrList($_type, $_addrList)
{
// Pull existing list
$aryHost = $this->_msgRecipients;

View File

@ -56,7 +56,7 @@ abstract class Stats
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
}
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache';
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
$newmask='0644';
$nowgmt = dol_now();
@ -150,7 +150,7 @@ abstract class Stats
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
}
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache';
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
$newmask='0644';
$nowgmt = dol_now();
@ -276,7 +276,7 @@ abstract class Stats
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
}
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache';
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
$newmask='0644';
$nowgmt = dol_now();
@ -383,11 +383,11 @@ abstract class Stats
$row = $this->db->fetch_object($resql);
$result[$i]['year'] = $row->year;
$result[$i]['nb'] = $row->nb;
if($i>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
if($i>0 && $row->nb) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
$result[$i]['total'] = $row->total;
if($i>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
if($i>0 && $row->total) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
$result[$i]['avg'] = $row->avg;
if($i>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
if($i>0 && $row->avg) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
$i++;
}
$this->db->free($resql);

View File

@ -421,7 +421,11 @@ class Translate
}
}
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
if (! preg_match('/^Format/',$key))
{
//print $str;
$str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
}
if ($maxsize) $str=dol_trunc($str,$maxsize);
@ -497,7 +501,11 @@ class Translate
}
}
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
if (! preg_match('/^Format/',$key))
{
//print $str;
$str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
}
return $str;
}
@ -819,3 +827,8 @@ class Translate
}
}
function warning_handler($errno, $errstr, $errfile, $errline, array $errcontext) {
global $str;
print 'str='.$str;
}

View File

@ -410,6 +410,7 @@ class DoliDBPgsql extends DoliDB
$this->database_name = $name;
pg_set_error_verbosity($this->db, PGSQL_ERRORS_VERBOSE); // Set verbosity to max
}
pg_query($this->db, "set datestyle = 'ISO, YMD';");
return $this->db;
}

View File

@ -124,7 +124,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
{
// Filter on hours
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("WorkingTimeRange").'</td>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>';
print "<td class='nowrap maxwidthonsmartphone'>";
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
if (empty($conf->dol_use_jmobile)) print ' - ';
@ -134,7 +134,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
// Filter on days
print '<tr>';
print '<td class="nowrap">'.$langs->trans("WorkingDaysRange").'</td>';
print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>';
print "<td class='nowrap maxwidthonsmartphone'>";
print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
if (empty($conf->dol_use_jmobile)) print ' - ';

View File

@ -897,7 +897,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
*/
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
{
global $bc,$user;
global $bc,$user,$conf;
// Check parameters
if (! is_object($object)) dol_print_error('','BadParameter');
@ -915,12 +915,22 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
$out.="\n";
$out.='<table width="100%" class="noborder">';
$out.='<tr class="liste_titre">';
$out.='<td colspan="2">';
if($conf->global->AGENDA_USE_EVENT_TYPE) $out.='<td colspan="3">';
else $out.='<td colspan="2">';
if (get_class($object) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&amp;status=todo">';
$out.=$langs->trans("ActionsToDoShort");
if (get_class($object) == 'Societe') $out.='</a>';
$out.='</td>';
$out.='<td colspan="5" align="right">';
if($conf->global->AGENDA_USE_EVENT_TYPE) {
$out.='<td>';
$out.=$langs->trans("Type");
$out.='</td>';
$out.='<td colspan="4" align="right">';
} else {
$out.='<td colspan="5" align="right">';
}
$out.='</td>';
$out.='</tr>';
@ -965,7 +975,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
$var = !$var;
$obj = $db->fetch_object($result);
$actionstatic->fetch($obj->id);
$datep=$db->jdate($obj->dp);
$datep2=$db->jdate($obj->dp2);
@ -999,8 +1009,13 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
// Title of event
//$out.='<td colspan="2">'.dol_trunc($obj->label,40).'</td>';
$out.='<td colspan="2">'.$actionstatic->getNomUrl(1,120).'</td>';
$out.='<td>'.$actionstatic->getNomUrl(1,120).'</td>';
if($conf->global->AGENDA_USE_EVENT_TYPE) {
$out.= '<td>';
$out.=$actionstatic->type;
$out.='</td>';
}
// Contact pour cette action
if (empty($objcon->id) && $obj->fk_contact > 0)
{
@ -1063,7 +1078,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
*/
function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
{
global $bc,$user;
global $bc,$user,$conf;
// Check parameters
if (! is_object($object)) dol_print_error('','BadParameter');
@ -1202,12 +1217,22 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
$out.="\n";
$out.='<table class="noborder" width="100%">';
$out.='<tr class="liste_titre">';
$out.='<td colspan="2">';
if($conf->global->AGENDA_USE_EVENT_TYPE) $out.='<td colspan="3">';
else $out.='<td colspan="2">';
if (get_class($object) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&amp;status=done">';
$out.=$langs->trans("ActionsDoneShort");
if (get_class($object) == 'Societe') $out.='</a>';
$out.='</td>';
$out.='<td colspan="5" align="right">';
if($conf->global->AGENDA_USE_EVENT_TYPE) {
$out.='<td>';
$out.=$langs->trans("Type");
$out.='</td>';
$out.='<td colspan="4" align="right">';
} else {
$out.='<td colspan="5" align="right">';
}
$out.='</td>';
$out.='</tr>';
@ -1215,7 +1240,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
{
$var=!$var;
$out.="<tr ".$bc[$var].">";
$actionstatic->fetch($histo[$key]['id']);
// Champ date
$out.='<td width="120" class="nowrap">';
$out.=dol_print_date($histo[$key]['datestart'],'dayhour');
@ -1251,7 +1276,12 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
$out.=dol_trunc($libelle,120);
}
$out.='</td>';
if($conf->global->AGENDA_USE_EVENT_TYPE) {
$out.='<td>';
$out.=$actionstatic->type;
$out.='</td>';
}
// Title of event
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';

View File

@ -144,7 +144,7 @@ function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
/** Return, in clear text, value of a number of seconds in days, hours and minutes
*
* @param int $iSecond Number of seconds
* @param string $format Output format ('all': total delay days hour:min like "2 days 12:30"", 'allhourmin': total delay hours:min like "60:30", 'allhour': total delay hours without min/sec like "60:30", 'fullhour': total delay hour decimal like "60.5" for 60:30, 'hour': only hours part "12", 'min': only minutes part "30", 'sec': only seconds part, 'month': only month part, 'year': only year part);
* @param string $format Output format ('all': total delay days hour:min like "2 days 12:30", 'allwithouthour': total delay days without hour part like "2 days", 'allhourmin': total delay with format hours:min like "60:30", 'allhour': total delay hours without min/sec like "60:30", 'fullhour': total delay hour decimal like "60.5" for 60:30, 'hour': only hours part "12", 'min': only minutes part "30", 'sec': only seconds part, 'month': only month part, 'year': only year part);
* @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour)
* @param int $lengthOfWeek Length of week (default 7)
* @return string Formated text of duration
@ -157,7 +157,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt
if (empty($lengthOfDay)) $lengthOfDay = 86400; // 1 day = 24 hours
if (empty($lengthOfWeek)) $lengthOfWeek = 7; // 1 week = 7 days
if ($format == 'all' || $format == 'allhour' || $format == 'allhourmin')
if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin')
{
if ($iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US

View File

@ -302,7 +302,7 @@ function dol_getprefix()
*
* @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
* @param string $classname Class name
* @return bool
* @return bool True if load is a success, False if it fails
*/
function dol_include_once($relpath, $classname='')
{
@ -1227,19 +1227,6 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
else
{
dol_print_error('','PHP version must be 5.3+');
/*
$usealternatemethod=false;
if ($year <= 1970) $usealternatemethod=true; // <= 1970
if ($year >= 2038) $usealternatemethod=true; // >= 2038
if ($usealternatemethod || $gm) // Si time gm, seule adodb peut convertir
{
$date=adodb_mktime($hour,$minute,$second,$month,$day,$year,0,$gm);
}
else
{
$date=mktime($hour,$minute,$second,$month,$day,$year);
}*/
return '';
}
}
@ -2015,7 +2002,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $
$tmparray=array(0=>$titlealt);
if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
$title=$tmparray[0];
$alt=empty($tmparray[1])?$tmparray[0]:$tmparray[1]; // Use title for alt if no alt is provided
$alt=empty($tmparray[1])?'':$tmparray[1];
return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup
}
}
@ -2743,8 +2730,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
*
* @param string $title Title to show
* @return string Title to show
* @deprecated Use print_fiche_titre instead
* @see print_fiche_titre
* @deprecated Use load_fiche_titre instead
* @see print_fiche_titre, load_fiche_titre
*/
function print_titre($title)
{
@ -3756,7 +3743,7 @@ function yn($yesno, $case=1, $color=0)
*
* @param string $num Id of object
* @param int $level Level of subdirs to return (1, 2 or 3 levels)
* @param int $alpha Use alpha ref
* @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0).
* @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '')
* @param Object $object Object
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')

View File

@ -1791,10 +1791,10 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent)
/**
* Get an array with properties of an element
*
* @param string $element_type Element type. ex : project_task or object@modulext or object_under@module
* @return array (module, classpath, element, subelement, classfile, classname)
*/
*
* @param string $element_type Element type: 'action', 'facture', 'project_task' or 'object@modulext'...
* @return array (module, classpath, element, subelement, classfile, classname)
*/
function getElementProperties($element_type)
{
// Parse element/subelement (ex: project_task)
@ -1887,15 +1887,15 @@ function getElementProperties($element_type)
}
/**
* Fetch an object with element_type and its id
* Fetch an object from its id and element_type
* Inclusion classes is automatic
*
* @param int $element_id Element id
* @param string $element_type Element type
* @return object || 0 || -1 if error
* @param int $element_id Element id
* @param string $element_type Element type
* @return int|object object || 0 || -1 if error
*/
function fetchObjectByElement($element_id,$element_type) {
function fetchObjectByElement($element_id, $element_type)
{
global $conf;
global $db,$conf;

View File

@ -24,12 +24,12 @@
/**
* Function get content from an URL (use proxy if proxy defined)
*
* @param string $url URL to call.
* @param string $postorget 'POST', 'GET', 'HEAD'
* @param string $param Parameters of URL (x=value1&y=value2)
* @param string $followlocation 1=Follow location, 0=Do not follow
* @param array $addheaders Array of string to add into header. Example: array('Accept: application/xrds+xml', ....)
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
* @param string $url URL to call.
* @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'DELETE'
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED
* @param string $followlocation 1=Follow location, 0=Do not follow
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
*/
function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array())
{
@ -74,7 +74,18 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
else if ($postorget == 'PUT')
{
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as PUT fields
if (! is_array($param)) parse_str($param, $array_param);
else
{
dol_syslog("parameter param must be a string", LOG_WARNING);
$array_param=$param;
}
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields
}
else if ($postorget == 'PUTALREADYFORMATED')
{
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string
}
else if ($postorget == 'HEAD')
{

View File

@ -744,7 +744,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// First line of company infos
$line1=""; $line2=""; $line3=""; $line4="";
if ($showdetails && 1)
if ($showdetails)
{
// Company name
if ($fromcompany->name)
@ -788,7 +788,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$line2.=($line2?" - ":"").$fromcompany->email;
}
}
if (($showdetails && 2) || ($fromcompany->country_code == 'DE'))
if ($showdetails || ($fromcompany->country_code == 'DE'))
{
// Managers
if ($fromcompany->managers)
@ -1692,64 +1692,61 @@ function pdf_getLinkedObjects($object,$outputlangs)
if ($objecttype == 'propal')
{
$outputlangs->load('propal');
$num=count($objects);
for ($i=0;$i<$num;$i++)
foreach($objects as $elementobject)
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
}
}
else if ($objecttype == 'commande')
{
$outputlangs->load('orders');
$num=count($objects);
for ($i=0;$i<$num;$i++)
foreach($objects as $elementobject)
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : '');
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
}
}
else if ($objecttype == 'contrat')
{
$outputlangs->load('contracts');
$num=count($objects);
for ($i=0;$i<$num;$i++)
foreach($objects as $elementobject)
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref);
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs);
}
}
else if ($objecttype == 'shipping')
{
$outputlangs->load('orders');
$outputlangs->load('sendings');
$num=count($objects);
for ($i=0;$i<$num;$i++)
foreach($objects as $elementobject)
{
$objects[$i]->fetchObjectLinked();
$order = $objects[$i]->linkedObjects['commande'][0];
$elementobject->fetchObjectLinked();
$order = $elementobject->linkedObjects['commande'][0];
if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($objects[$i]->ref);
$linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending");
$linkedobjects[$objecttype]['date_value'].= dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
}
else // We show both info of order and shipment
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref);
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
}
}
}

View File

@ -1023,14 +1023,13 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
{
//Add the year filter input
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
print '<table width="100%">';
print '<tr>';
print '<td>'.$langs->trans("Year").'</td>';
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
print '<td style="text-align:right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.'"/>';
print '</form>';
print "</tr>\n";
print '</table>';
print '</table></form>';
}
}

View File

@ -90,7 +90,7 @@ function dol_hash($chain,$type=0)
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));
// No enconding defined
// No particular enconding defined, use default
return md5($chain);
}

View File

@ -439,7 +439,7 @@ function encodedecode_dbpassconf($level=0)
/**
* Return a generated password using default module
*
* @param boolean $generic true=Create generic password (use default crypt function), false=Use the configured password generation module
* @param boolean $generic true=Create generic password (use md5, sha1 depending on setup), false=Use the configured password generation module
* @return string New value for password
*/
function getRandomPassword($generic=false)

View File

@ -94,7 +94,7 @@ function tree_showpad(&$fulltree,$key,$silent=0)
// ------------------------------- Used by menu editor -----------------
// ------------------------------- Used by menu editor, category view, ... -----------------
/**
* Recursive function to output menu tree. <ul id="iddivjstree"><li>...</li></ul>

View File

@ -23,6 +23,9 @@ 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 ('', '$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__);
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', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?leftmenu=setup', 'Boxes', 1, 'admin', '', '', 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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 105__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/menus.php?leftmenu=setup', 'Menus', 1, 'admin', '', '', 2, 3, __ENTITY__);

View File

@ -488,7 +488,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$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','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES')))
if (! in_array($langs->defaultlang,array('en_US')))
{
$newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
}
@ -789,7 +789,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (empty($leftmenu) || ($leftmenu == 'suppliers_bills')) {
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills&amp;search_status=0", $langs->trans("BillShortStatusDraft"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/impayees.php", $langs->trans("BillShortStatusNotPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills&amp;search_status=1", $langs->trans("BillShortStatusNotPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills&amp;search_status=2", $langs->trans("BillShortStatusPaid"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
}
@ -1190,12 +1190,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Project affected to user
$newmenu->add("/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire, '', $mainmenu, 'myprojects');
$newmenu->add("/projet/card.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/list.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/list.php?leftmenu=projects&mode=mine&search_status=1", $langs->trans("List"), 1, $user->rights->projet->lire);
// All project i have permission on
$newmenu->add("/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire && $user->rights->projet->lire, '', $mainmenu, 'projects');
$newmenu->add("/projet/card.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
$newmenu->add("/projet/list.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/list.php?leftmenu=projects&search_status=1", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
$newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
if (empty($conf->global->PROJECT_HIDE_TASKS))

View File

@ -1334,7 +1334,6 @@ print $sql;
$this->db->begin();
//var_dump($this->menu); exit;
foreach ($this->menu as $key => $value)
{
$menu = new Menubase($this->db);
@ -1343,11 +1342,9 @@ print $sql;
if (! $this->menu[$key]['fk_menu'])
{
$menu->fk_menu=0;
//print 'aaa'.$this->menu[$key]['fk_menu'];
}
else
{
//print 'xxx'.$this->menu[$key]['fk_menu'];exit;
$foundparent=0;
$fk_parent=$this->menu[$key]['fk_menu'];
if (preg_match('/^r=/',$fk_parent)) // old deprecated method

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009-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
@ -76,14 +76,15 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
}
/**
* Fonction generant le rapport sur le disque
* Fonction to generate document on disk
*
* @param string $_dir Directory
* @param string $number Number
* @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko
* @param RemiseCheque $object Object RemiseCheque
* @param string $_dir Directory
* @param string $number Number
* @param Translate $outputlangs Lang output object
* @return int 1=ok, 0=ko
*/
function write_file($_dir, $number, $outputlangs)
function write_file($object, $_dir, $number, $outputlangs)
{
global $user,$conf,$langs,$hookmanager;
@ -98,7 +99,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$outputlangs->load("products");
$outputlangs->load("compta");
$dir = $_dir . "/".get_exdir($number,2,1,0,null,'cheque').$number;
$dir = $_dir . "/".get_exdir($number,0,1,0,$object,'cheque').$number;
if (! is_dir($dir))
{

Some files were not shown because too many files have changed in this diff Show More