Merge branch 'develop' into prod-attr
# Conflicts: # htdocs/core/class/html.form.class.php # htdocs/install/mysql/migration/4.0.0-5.0.0.sql
This commit is contained in:
commit
cf0ee36150
16
ChangeLog
16
ChangeLog
@ -26,20 +26,20 @@ Dolibarr better:
|
||||
- The old driver of "mysql" has been removed. Dolibarr use the new one (mysqli) by default.
|
||||
- Remove not used function calculate_byte(). Use dol_print_size() instead.
|
||||
- Function pdf_getTotalQty is now deprecated. Not used by Dolibarr core.
|
||||
- Method commande->deleteline($lineid) has been replaced with commande->deleteline($user, $lineid).
|
||||
- Method expensereport->delete(id, user) has been replaced with ->delete(user)
|
||||
Method warehouse->delete(id) has been replace with ->delete(user)
|
||||
This is to follow good practice to make a fetch on object before deleting it.
|
||||
- The form to add a product to a draft proposal/order/invoice from the product card is hidden by default.
|
||||
- The form to add a product to a draft proposal/order/invoice, from the product card, is hidden by default.
|
||||
It was not commonly used and usage generates some problems (cost price for margin calculation not entered, vat setting).
|
||||
Set constant PRODUCT_ADD_FORM_ADD_TO to retrieve it.
|
||||
- The javascript "datatables" library was used to be provided into Dolibarr sources, but it was not used by application.
|
||||
- The javascript "datatables" library was previously provided into Dolibarr sources, but it was not used by application.
|
||||
So there is no reason to maintain its compatibility with other dolibarr components. If an external module need this
|
||||
library, this external module must embed hte library in his own sources/packages.
|
||||
- Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE
|
||||
- A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters
|
||||
no more required were also removed. Use this new one if you ware using one of them.
|
||||
- Method commande->deleteline($lindeid) has been replaced with commande->deleteline($user, $lineid).
|
||||
|
||||
library, this external module must embed the library in his own sources/packages.
|
||||
- Trigger name SUPPLIER_PROPOSAL_CREATE has been renamed into PROPOSAL_SUPPLIER_CREATE.
|
||||
- A new paramater sqlfilters was introduced to allow filter on any fields int the REST API. Few old parameters,
|
||||
no more required, were also removed. Use this new one if you were using one of them.
|
||||
- The trigger that activate or close a contract line is run on a contract line, not on contract.
|
||||
|
||||
|
||||
***** ChangeLog for 4.0.2 compared to 4.0.1 *****
|
||||
|
||||
@ -1,10 +1,19 @@
|
||||
|
||||
To test upgrade of a lib with composer:
|
||||
* To list packages
|
||||
|
||||
composer update --no-dev --no-autoloader --dry-run ccampbell/chromephp
|
||||
composer show -i
|
||||
|
||||
To upgrade a lib with composer:
|
||||
* To test upgrade of a lib with composer:
|
||||
|
||||
Remove entry in composer.lock
|
||||
Edit composer.json to change version to "x.y.z"
|
||||
composer -v update --root-reqs --no-dev --no-autoloader --dry-run ccampbell/chromephp
|
||||
|
||||
* To upgrade a lib with composer:
|
||||
|
||||
Remove entry in composer.lock
|
||||
Edit composer.json to change version to "x.y.z"
|
||||
composer -v update --root-reqs --no-dev --no-autoloader ccampbell/chromephp
|
||||
|
||||
composer update --no-dev --no-autoloader ccampbell/chromephp
|
||||
|
||||
|
||||
|
||||
@ -73,7 +73,8 @@ Ex: https://alioth.debian.org/users/eldy-guest
|
||||
# msgfmt -v -c -o /dev/null XX.po To have status of translation for language XX
|
||||
|
||||
# To check package integrity
|
||||
# lintian --pedantic -E -I package.deb To test a package
|
||||
# lintian --pedantic -E -I package.deb To test a binary package
|
||||
# lintian --pedantic -E -I package.dsc To test a source package
|
||||
|
||||
# To manipulate packages
|
||||
# dpkg -l List all packages
|
||||
@ -181,8 +182,8 @@ To test a package
|
||||
> cp ../build-area/* /srv/chroot/unstable/tmp
|
||||
> sudo schroot -c name_of_chroot
|
||||
> cd /tmp
|
||||
> lintian --pedantic -E -I dolibarr*.deb
|
||||
> lintian --pedantic -E -I dolibarr*.dsc
|
||||
> lintian --no-tag-display-limit --pedantic -E -I dolibarr*.deb
|
||||
> lintian --no-tag-display-limit --pedantic -E -I dolibarr*.dsc
|
||||
> dpkg -i dolibarr*.deb ou pour avoir des traces: dpkg -D77777 -i dolibarr*.deb
|
||||
> apt-get install -f
|
||||
|
||||
@ -295,12 +296,16 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER
|
||||
* Edit orig.tar.gz file to remove
|
||||
- debian
|
||||
- htdocs/includes/ckeditor
|
||||
- htdocs/includes/jszip
|
||||
- htdocs/includes/jquery/css
|
||||
- htdocs/includes/jquery/js
|
||||
- htdocs/includes/jquery/plugins/flot
|
||||
- htdocs/includes/jquery/plugins/multiselect
|
||||
- htdocs/includes/jquery/plugins/datatables
|
||||
- htdocs/includes/jszip
|
||||
- htdocs/includes/mike42
|
||||
- htdocs/includes/phpexcel or htdocs/includes/phpoffice
|
||||
- htdocs/includes/swiftmailer
|
||||
- htdocs/includes/restler/framework/Luracast/Restler/explorer
|
||||
- htdocs/includes/swiftmailer
|
||||
- htdocs/includes/tcpdf or htdocs/includes/tecnickcom
|
||||
And rename file into
|
||||
dolibarr-x.y.z+dfsgw.tgz
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
# Remove warning, we want to keep both standard and minified sources.
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/*
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jquery/*
|
||||
# This is a textual data file
|
||||
source-is-missing htdocs/includes/mobiledetect/mobiledetectlib/Mobile_Detect.json
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jsgantt/*
|
||||
dolibarr: source-contains-prebuilt-javascript-object htdocs/includes/jstz/*
|
||||
# Those are false positives, the files are their own sources since
|
||||
# they are not minified
|
||||
source-is-missing htdocs/includes/jsgantt/jsgantt.js *
|
||||
source-is-missing htdocs/includes/jquery/plugins/colorpicker/jquery.colorpicker.js *
|
||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2.js *
|
||||
source-is-missing htdocs/includes/jquery/plugins/select2/select2_locale_ar.js *
|
||||
|
||||
@ -1145,6 +1145,9 @@ if ($nboftargetok) {
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
|
||||
@ -1155,6 +1158,10 @@ if ($nboftargetok) {
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
|
||||
"$DESTI/package_rpm_generic/$FILENAMERPMSRC"=>'package_rpm_generic',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
|
||||
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
|
||||
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
"php": ">=5.3.0",
|
||||
"ext-curl": "*",
|
||||
"ccampbell/chromephp": "4.1.0",
|
||||
"ckeditor/ckeditor": "dev-full/stable",
|
||||
"ckeditor/ckeditor": "4.5.9",
|
||||
"mike42/escpos-php": "1.2.1",
|
||||
"mobiledetect/mobiledetectlib": "2.8.17",
|
||||
"phpoffice/phpexcel": "1.8.1",
|
||||
|
||||
1406
composer.lock
generated
1406
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -53,6 +53,7 @@ $langs->load("other");
|
||||
// Get parameters
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$cancel = GETPOST('cancel');
|
||||
$backtopage = GETPOST('backtopage');
|
||||
$myparam = GETPOST('myparam','alpha');
|
||||
|
||||
@ -95,6 +96,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel)
|
||||
{
|
||||
if ($action != 'addlink')
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
|
||||
$action='';
|
||||
}
|
||||
|
||||
// Action to add record
|
||||
if ($action == 'add')
|
||||
{
|
||||
@ -140,11 +153,8 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if ($action == 'update' && GETPOST('cancel')) $action='view';
|
||||
|
||||
// Action to update record
|
||||
if ($action == 'update' && ! GETPOST('cancel'))
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -52,9 +52,13 @@ dol_include_once('/mymodule/class/skeleton_class.class.php');
|
||||
$langs->load("mymodule");
|
||||
$langs->load("other");
|
||||
|
||||
// Get parameters
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$backtopage = GETPOST('backtopage');
|
||||
$myparam = GETPOST('myparam','alpha');
|
||||
|
||||
@ -212,7 +216,7 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (u.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mytable_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")";
|
||||
if ($search_field1) $sql.= natural_search("field1",$search_field1);
|
||||
@ -329,6 +333,7 @@ if (! empty($moreforfilter))
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Fields title
|
||||
@ -531,6 +536,7 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
1
htdocs/.gitignore
vendored
1
htdocs/.gitignore
vendored
@ -22,3 +22,4 @@
|
||||
/cabinetmed*
|
||||
/webmail*
|
||||
/conf/conf.php
|
||||
/subtotal/
|
||||
|
||||
@ -155,19 +155,19 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON aa.account_par
|
||||
$sql .= " WHERE asy.rowid = " . $pcgver;
|
||||
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
$sql .= natural_search("aa.account_number", $search_account);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND aa.label like '%" . $search_label . "%'";
|
||||
$sql .= natural_search("aa.label", $search_label);
|
||||
}
|
||||
if (strlen(trim($search_accountparent))) {
|
||||
$sql .= " AND aa.account_parent like '%" . $search_accountparent . "%'";
|
||||
$sql .= natural_search("aa.account_parent", $search_accountparent);
|
||||
}
|
||||
if (strlen(trim($search_pcgtype))) {
|
||||
$sql .= " AND aa.pcg_type like '%" . $search_pcgtype . "%'";
|
||||
$sql .= natural_search("aa.pcg_type", $search_pcgtype);
|
||||
}
|
||||
if (strlen(trim($search_pcgsubtype))) {
|
||||
$sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
|
||||
$sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -198,11 +198,9 @@ if ($resql) {
|
||||
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy');
|
||||
|
||||
$i = 0;
|
||||
|
||||
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
|
||||
// Box to select active chart of accoun
|
||||
// Box to select active chart of account
|
||||
$var = ! $var;
|
||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||
@ -235,7 +233,7 @@ if ($resql) {
|
||||
print '<a class="butAction" href="./categories.php">' . $langs->trans("ApplyMassCategories") . '</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 '<br><br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -266,9 +264,11 @@ if ($resql) {
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
|
||||
while ( $i < min($num, $limit) ) {
|
||||
$i = 0;
|
||||
while ( $i < min($num, $limit) )
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
|
||||
$accountstatic->id = $obj->rowid;
|
||||
$accountstatic->label = $obj->label;
|
||||
$accountstatic->account_number = $obj->account_number;
|
||||
@ -318,7 +318,7 @@ if ($resql) {
|
||||
|
||||
print "</tr>\n";
|
||||
$var = ! $var;
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -1262,8 +1262,8 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db);
|
||||
|
||||
$formaccountancy = new FormVentilation($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
if ($fieldlist[$field] == 'country')
|
||||
|
||||
@ -329,7 +329,7 @@ if ($result)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
// On sell
|
||||
print '<td class="liste_titre"></td>';
|
||||
|
||||
@ -307,6 +307,8 @@ if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
$num=count($object->lines);
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||
print $formconfirm;
|
||||
@ -448,7 +450,9 @@ foreach ($object->lines as $line ) {
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="6"></td>';
|
||||
if ($num < $limit) print '<td align="left" colspan="6">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left" colspan="6">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print price($total_debit);
|
||||
print '</td>';
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
|
||||
* largely based on the great work of :
|
||||
* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr> largely based on the great work of :
|
||||
* - Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* - Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* - Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
@ -18,7 +17,6 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -72,11 +70,8 @@ $pagenext = $page + 1;
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "t.rowid";
|
||||
|
||||
if (empty($search_date_start)) {
|
||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
}
|
||||
|
||||
if (empty($search_date_start)) $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
||||
if (empty($search_date_end)) $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
||||
|
||||
$object = new BookKeeping($db);
|
||||
|
||||
@ -126,16 +121,17 @@ if (!GETPOST("button_removefilter_x") && !GETPOST("button_removefilter")) // Bot
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_doc_date = '';
|
||||
$search_accountancy_code = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_label_account = '';
|
||||
$search_label_account = '';
|
||||
$search_mvt_label = '';
|
||||
$search_direction = '';
|
||||
$search_ledger_code = '';
|
||||
|
||||
@ -402,7 +402,7 @@ class AccountancyExport
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
|
||||
print '"'.dol_trunc($line->label_compte,40,'right','UTF-8',1).'"' . $this->separator;
|
||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1)."'".$this->separator;
|
||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
||||
print price2num($line->montant).$this->separator;
|
||||
print $line->sens.$this->separator;
|
||||
print $date . $this->separator;
|
||||
|
||||
@ -73,7 +73,7 @@ class BookKeeping extends CommonObject
|
||||
public $id;
|
||||
/**
|
||||
*/
|
||||
public $doc_date = '';
|
||||
public $doc_date;
|
||||
public $doc_type;
|
||||
public $doc_ref;
|
||||
public $fk_doc;
|
||||
@ -184,9 +184,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
||||
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -200,9 +198,7 @@ class BookKeeping extends CommonObject
|
||||
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
|
||||
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sqlnum .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
@ -214,9 +210,7 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sqlnum .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
@ -503,9 +497,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.piece_num";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
if (null !== $ref) {
|
||||
$sql .= ' AND t.ref = ' . '\'' . $ref . '\'';
|
||||
} else {
|
||||
@ -608,10 +600,9 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
@ -721,9 +712,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
@ -817,9 +806,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
@ -1073,9 +1060,7 @@ class BookKeeping extends CommonObject
|
||||
$sql.= " WHERE 1 = 1";
|
||||
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
||||
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
@ -1107,9 +1092,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = "DELETE";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -1180,9 +1163,12 @@ class BookKeeping extends CommonObject
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen() {
|
||||
$this->id = 0;
|
||||
global $user;
|
||||
|
||||
$this->doc_date = '';
|
||||
$now=dol_now();
|
||||
|
||||
$this->id = 0;
|
||||
$this->doc_date = $now;
|
||||
$this->doc_type = '';
|
||||
$this->doc_ref = '';
|
||||
$this->fk_doc = '';
|
||||
@ -1190,11 +1176,11 @@ class BookKeeping extends CommonObject
|
||||
$this->code_tiers = '';
|
||||
$this->numero_compte = '';
|
||||
$this->label_compte = '';
|
||||
$this->debit = '';
|
||||
$this->debit = 99.9;
|
||||
$this->credit = '';
|
||||
$this->montant = '';
|
||||
$this->sens = '';
|
||||
$this->fk_user_author = '';
|
||||
$this->fk_user_author = $user->id;
|
||||
$this->import_key = '';
|
||||
$this->code_journal = '';
|
||||
$this->piece_num = '';
|
||||
@ -1212,9 +1198,7 @@ class BookKeeping extends CommonObject
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1245,9 +1229,7 @@ class BookKeeping extends CommonObject
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1279,9 +1261,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1333,9 +1313,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG);
|
||||
|
||||
@ -1404,9 +1382,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
@ -1472,9 +1448,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||
$sql .= " AND parent.active = 1";
|
||||
$sql .= " AND root.active = 1";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1513,9 +1487,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -30,6 +30,10 @@
|
||||
*/
|
||||
class FormVentilation extends Form
|
||||
{
|
||||
|
||||
private $options_cache = array();
|
||||
|
||||
|
||||
/**
|
||||
* Return select filter with date of transaction
|
||||
*
|
||||
@ -41,9 +45,7 @@ class FormVentilation extends Form
|
||||
$options = array();
|
||||
|
||||
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql .= ' ORDER BY import_key DESC';
|
||||
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG);
|
||||
@ -72,63 +74,76 @@ class FormVentilation extends Form
|
||||
* @param int $select_in selectid value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param string $morecss More css non HTML object
|
||||
* @return string String with HTML select
|
||||
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone') {
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
// TODO Add $options in cache so next call will not execute the request
|
||||
$selected = 0;
|
||||
$options = array();
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
$options = array();
|
||||
if ($usecache && ! empty($this->options_cache[$usecache]))
|
||||
{
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
// Try to guess if we have found default value
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if ($selectid != '' && $selectid == $select_value_in) {
|
||||
//var_dump("Found ".$selectid." ".$select_value_in);
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
$options = $this->options_cache[$usecache];
|
||||
}
|
||||
else
|
||||
{
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$selected = 0;
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
// Try to guess if we have found default value
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if ($selectid != '' && $selectid == $select_value_in) {
|
||||
//var_dump("Found ".$selectid." ".$select_value_in);
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($usecache)
|
||||
{
|
||||
$this->options_cache[$usecache] = $options;
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
$this->db->free($resql);
|
||||
|
||||
return $out;
|
||||
}
|
||||
@ -232,9 +247,7 @@ class FormVentilation extends Form
|
||||
// Auxiliary customer account
|
||||
$sql = "SELECT DISTINCT code_compta, nom ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
|
||||
$sql .= " ORDER BY code_compta";
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -254,9 +267,7 @@ class FormVentilation extends Form
|
||||
// Auxiliary supplier account
|
||||
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
|
||||
$sql .= " ORDER BY code_compta_fournisseur";
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -297,9 +308,7 @@ class FormVentilation extends Form
|
||||
|
||||
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql .= " ORDER BY date_format(doc_date,'%Y')";
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -338,9 +347,7 @@ class FormVentilation extends Form
|
||||
|
||||
$sql = "SELECT DISTINCT code_journal";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql .= " ORDER BY code_journal";
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -80,7 +80,7 @@ if ($action == 'validatehistory') {
|
||||
$sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
$resql = $db->query($sqlclean);
|
||||
|
||||
// Now make the binding
|
||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
@ -136,11 +136,13 @@ if ($action == 'validatehistory') {
|
||||
|
||||
// Now clean
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
|
||||
|
||||
$sql1.= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
@ -169,12 +171,10 @@ print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevye
|
||||
print $langs->trans("DescVentilCustomer") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done into the repair.php script
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
print '</div>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
|
||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||
@ -191,8 +191,16 @@ if ($result) {
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
|
||||
$var = true;
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
@ -213,7 +221,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
@ -239,6 +247,69 @@ if ($resql) {
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
|
||||
@ -38,6 +38,7 @@ $langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
@ -83,7 +84,7 @@ $formventilation = new FormVentilation($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
@ -122,6 +123,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -148,7 +150,7 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, 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 product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
|
||||
@ -251,33 +253,36 @@ if ($result) {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
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("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.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($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" 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="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_country" size="5" value="' . $search_country . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_tavintra" size="5" value="' . $search_tavintra . '"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1);
|
||||
print $searchpitco;
|
||||
@ -291,52 +296,63 @@ if ($result) {
|
||||
$var = ! $var;
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Ref Invoice
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->rowid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
|
||||
// Ref Product
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->product_type;
|
||||
$product_static->label = $objp->product_label;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print ' ';
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td>' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
|
||||
print '<td>';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->fdid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td>' . $objp->country .'</td>';
|
||||
print '<td>' . $objp->tva_intra . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="right"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->fdid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
print $db->lasterror();
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -40,11 +40,16 @@ $langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$action = GETPOST('action');
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
|
||||
// Search Getpost
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
@ -89,6 +94,9 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
@ -101,11 +109,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
// Mass actions
|
||||
$objectclass='Skeleton';
|
||||
$objectlabel='Skeleton';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($massaction == 'ventil') {
|
||||
$msg='';
|
||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($mesCasesCochees)) {
|
||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'</div>';
|
||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||
$msg.='<div class="detail">';
|
||||
$cpt = 0;
|
||||
$ok=0;
|
||||
@ -143,10 +159,10 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
$cpt++;
|
||||
}
|
||||
$msg.='</div>';
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||
//} else {
|
||||
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
||||
}
|
||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -155,12 +171,15 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
// 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, l.product_type as type_l, l.tva_tx as tva_tx_line,";
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype,";
|
||||
$sql .= " l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type as type_l, 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_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
@ -171,25 +190,25 @@ $sql .= " AND product_type <= 2";
|
||||
$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))) {
|
||||
$sql .= " AND (f.facnumber like '%" . $search_invoice . "%')";
|
||||
$sql .= natural_search("f.facnumber",$search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
|
||||
$sql .= natural_search("p.ref",$search_ref);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '%" . $search_label . "%')";
|
||||
$sql .= natural_search("p.label",$search_label);
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||
$sql .= natural_search("l.description",$search_desc);
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||
$sql .= natural_search("l.total_ht",$search_amount,1);
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
$sql .= natural_search("aa.account_number",$search_account);
|
||||
}
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
@ -217,6 +236,16 @@ if ($result) {
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -225,9 +254,9 @@ if ($result) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$center='<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
//$center='<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||
|
||||
@ -235,33 +264,36 @@ if ($result) {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
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("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_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="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
||||
print '</tr>';
|
||||
print "</tr>\n";
|
||||
|
||||
// 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="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" 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="right"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '">%</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1);
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -278,58 +310,64 @@ if ($result) {
|
||||
$objp->code_sell_l = '';
|
||||
$objp->code_sell_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
$code_sell_p_l_differ = '';
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
|
||||
$code_sell_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
|
||||
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) {
|
||||
$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"));
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
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"));
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
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->code_sell_l == -1) $objp->code_sell_l='';
|
||||
|
||||
if (! empty($objp->code_sell)) {
|
||||
$objp->code_sell_p = $objp->code_sell; // Code on product
|
||||
} else {
|
||||
$code_sell_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red';
|
||||
|
||||
// $objp->code_sell_p is now code of product/service
|
||||
// $objp->code_sell_l is now default code of product/service
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Line id
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
// Ref Invoice
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
// Ref Product
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
print '<td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print ' ';
|
||||
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$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 $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->total_ht);
|
||||
@ -342,33 +380,30 @@ if ($result) {
|
||||
print price($objp->tva_tx_line);
|
||||
print '</td>';
|
||||
|
||||
// Accounting account suggested
|
||||
// Current account
|
||||
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
||||
if ($objp->code_sell_l == $objp->code_sell_p) { // Test if there is a difference between code by default and code on product
|
||||
if ($objp->code_sell_l > 0) print $objp->code_sell_l;
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
print $langs->trans("Default") . ' = ' . ($objp->code_sell_l > 0 ? $objp->code_sell_l : $langs->trans("Unknown"));
|
||||
print '<br>';
|
||||
print $langs->trans("Product") . ' = ' . ($objp->code_sell_p > 0 ? $objp->code_sell_p : $langs->trans("Unknown"));
|
||||
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown"));
|
||||
if ($objp->product_id > 0)
|
||||
{
|
||||
print '<br>';
|
||||
print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_sell_p) ? $langs->trans("Unknown") : length_accountg($objp->code_sell_p));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td align="center">';
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1);
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td align="center">' . $objp->rowid . '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print '<input type="checkbox" class="checkforaction" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -130,11 +130,13 @@ if ($action == 'validatehistory') {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
|
||||
|
||||
$sql1.= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
@ -163,29 +165,39 @@ print $langs->trans("DescVentilExpenseReport") . '<br>';
|
||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
print '</div>';
|
||||
//print '</div>';
|
||||
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
@ -195,32 +207,96 @@ $sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false
|
||||
$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " WHERE er.date_create >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_create <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
|
||||
@ -39,6 +39,7 @@ $langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("trips");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
@ -60,7 +61,7 @@ $offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield)
|
||||
$sortfield = "er.date_create, er.ref, erd.rowid";
|
||||
$sortfield = "erd.date, erd.rowid";
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
$sortorder = "DESC";
|
||||
@ -144,7 +145,9 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Expense reports lines
|
||||
*/
|
||||
$sql = "SELECT er.ref, er.rowid as erid, erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, aa.label, aa.account_number, ";
|
||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.date,";
|
||||
$sql .= " aa.label, aa.account_number,";
|
||||
$sql .= " f.id as fees_id, f.label as fees_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
@ -227,27 +230,31 @@ if ($result) {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.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($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_expensereport" size="10" value="' . $search_expensereport . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" 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="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(1);
|
||||
@ -263,17 +270,25 @@ if ($result) {
|
||||
$var = ! $var;
|
||||
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Ref Invoice
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||
|
||||
print '<td>' . dol_trunc($objp->fees_label, 24) . '</td>';
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||
|
||||
print '<td class="tdoverflow">' . $objp->fees_label . '</td>';
|
||||
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td>' . nl2br(dol_trunc($objp->comments, $trunclength)) . '</td>';
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
|
||||
@ -281,8 +296,6 @@ if ($result) {
|
||||
|
||||
print '<td>' . $codeCompta . '</td>';
|
||||
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
@ -292,18 +305,19 @@ if ($result) {
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -40,11 +40,16 @@ $langs->load("other");
|
||||
$langs->load("trips");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$action = GETPOST('action');
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
|
||||
// Search Getpost
|
||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||
@ -65,7 +70,7 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield)
|
||||
$sortfield = "er.date_create, er.ref, erd.rowid";
|
||||
$sortfield = "erd.date, erd.rowid";
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
$sortorder = "DESC";
|
||||
@ -79,16 +84,16 @@ if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
$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
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
@ -100,11 +105,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
$msg='';
|
||||
// Mass actions
|
||||
$objectclass='Skeleton';
|
||||
$objectlabel='Skeleton';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($massaction == 'ventil') {
|
||||
$msg='';
|
||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($mesCasesCochees)) {
|
||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'</div>';
|
||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||
$msg.='<div class="detail">';
|
||||
$mesCodesVentilChoisis = $codeventil;
|
||||
$cpt = 0;
|
||||
@ -112,7 +125,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
$ko=0;
|
||||
|
||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
||||
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
|
||||
$maLigneCourante = explode("_", $maLigneCochee);
|
||||
$monId = $maLigneCourante[0];
|
||||
$monCompte = GETPOST('codeventil'.$monId);
|
||||
@ -133,21 +145,21 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
|
||||
dol_syslog('accountancy/expensereport/list.php:: sql=' . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$ok++;
|
||||
$msg.= '<div><font color="green">' . $langs->trans("LineOfExpenseReport") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$ko++;
|
||||
$msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
$cpt++;
|
||||
}
|
||||
$msg.='</div>';
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||
//} else {
|
||||
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
||||
}
|
||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -155,10 +167,14 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||
|
||||
// Expense report lines
|
||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, ";
|
||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.date,";
|
||||
$sql .= " f.id as fees_id, f.label as fees_label, f.accountancy_code as code_buy,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
@ -170,22 +186,22 @@ $sql .= " WHERE er.fk_statut > 4 AND erd.fk_code_ventilation <= 0";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR f.accountancy_code IS NULL OR f.accountancy_code ='')";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= " AND (er.ref like '%" . $search_expensereport . "%')";
|
||||
$sql .= natural_search("er.ref",$search_expensereport);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (f.label like '%" . $search_label . "%')";
|
||||
$sql .= natural_search("f.label",$search_label);
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (erd.comments like '%" . $search_desc . "%')";
|
||||
$sql .= natural_search("erd.comments",$search_desc);
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND erd.total_ht like '" . $search_amount . "%'";
|
||||
$sql .= natural_search("erd.total_ht",$search_amount,1);
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
$sql .= natural_search("aa.account_number",$search_account);
|
||||
}
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (erd.tva_tx like '" . $search_vat . "%')";
|
||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||
}
|
||||
$sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
@ -213,6 +229,16 @@ if ($result) {
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -221,40 +247,44 @@ if ($result) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$center='<div class="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
//$center='<div class="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
|
||||
print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if ($msg) print $msg.'<br>';
|
||||
print_barre_liste($langs->trans("ExpenseReportLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
print $langs->trans("DescVentilTodoExpenseReport") . '</br><br>';
|
||||
|
||||
if ($msg) print $msg.'<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
// We add search filter
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_expensereport" value="' . $search_expensereport . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(1);
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -262,7 +292,7 @@ if ($result) {
|
||||
$expensereport_static = new ExpenseReport($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
@ -270,22 +300,30 @@ if ($result) {
|
||||
$objp->aarowid_suggest = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Ref Expense report
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Line id
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||
|
||||
// Ref Expense report
|
||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||
|
||||
// Fees label
|
||||
print '<td>';
|
||||
print dol_trunc($objp->fees_label, 24);
|
||||
print $objp->fees_label;
|
||||
print '</td>';
|
||||
|
||||
// Fees description -- Can be null
|
||||
// TODO: we should set a user defined value to adjust user square / wide screen size
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td>' . nl2br(dol_trunc($objp->comments, $trunclength)) . '</td>';
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
@ -296,22 +334,18 @@ if ($result) {
|
||||
print price($objp->tva_tx_line);
|
||||
print '</td>';
|
||||
|
||||
// Accounting account suggested
|
||||
// Current account
|
||||
print '<td align="center">';
|
||||
print length_accountg(html_entity_decode($objp->code_buy));
|
||||
print '</td>';
|
||||
|
||||
// Colonne choix du compte
|
||||
// Suggested accounting account
|
||||
print '<td align="center">';
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1);
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td align="center">' . $objp->rowid . '</td>';
|
||||
|
||||
// Colonne choix ligne a ventiler
|
||||
print '<td align="right">';
|
||||
print '<input type="checkbox" class="checkforaction" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>";
|
||||
@ -319,6 +353,8 @@ if ($result) {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -109,7 +109,7 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||
$sql .= " WHERE ba.rowid=" . $id_bank_account;
|
||||
$sql .= ' AND ba.entity IN ('.getEntity('banque', 0).')'; // We don't share object for accountancy
|
||||
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " ORDER BY b.datev";
|
||||
|
||||
@ -77,7 +77,7 @@ if ($action == 'validatehistory') {
|
||||
$sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
$resql = $db->query($sqlclean);
|
||||
|
||||
// Now make the binding
|
||||
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
@ -130,11 +130,13 @@ if ($action == 'validatehistory') {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
|
||||
|
||||
$sql1.= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND f.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
$sql1.= ")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
@ -163,17 +165,25 @@ print $langs->trans("DescVentilSupplier") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
//print '<div class="inline-block divButAction">';
|
||||
// TODO Remove this. Should be done always.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
print '</div>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
||||
//print '</div>';
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
@ -195,7 +205,7 @@ $sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
@ -221,6 +231,75 @@ if ($resql) {
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(ffd.total_ht),2) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
print '<td align="right"><b>' . price($row[14]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OtherInfo"), '', '');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print "<br>\n";
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
|
||||
@ -39,6 +39,7 @@ $langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
@ -82,7 +83,7 @@ $formventilation = new FormVentilation($db);
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
@ -146,14 +147,15 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Supplier Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, ";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = l.fk_code_ventilation";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||
$sql.= " l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, ";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql.= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql.= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND f.ref like '%" . $search_invoice . "%'";
|
||||
}
|
||||
@ -234,30 +236,34 @@ if ($result) {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
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("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_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="right"', $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($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" 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="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<td class="liste_titre" align="right"></td>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1);
|
||||
print $searchpitco;
|
||||
@ -271,34 +277,46 @@ if ($result) {
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Ref Invoice
|
||||
$facturefournisseur_static->ref = $objp->facnumber;
|
||||
$facturefournisseur_static->id = $objp->facid;
|
||||
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
|
||||
|
||||
// Ref Product
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
|
||||
|
||||
print '<td>';
|
||||
print $objp->invoice_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print ' ';
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
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>' . $codeCompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print '<td align="left">';
|
||||
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
@ -307,17 +325,18 @@ if ($result) {
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
if ($nbtotalofrecords > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -40,11 +40,16 @@ $langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$action = GETPOST('action');
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
// Select Box
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
|
||||
// Search Getpost
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
@ -80,12 +85,7 @@ if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
$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
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
@ -95,10 +95,14 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
||||
* Action
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
@ -106,11 +110,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
// Mass actions
|
||||
$objectclass='Skeleton';
|
||||
$objectlabel='Skeleton';
|
||||
$permtoread = $user->rights->accounting->read;
|
||||
$permtodelete = $user->rights->accounting->delete;
|
||||
$uploaddir = $conf->accounting->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($massaction == 'ventil') {
|
||||
$msg='';
|
||||
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($mesCasesCochees)) {
|
||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($_POST["mesCasesCochees"]).'</div>';
|
||||
$msg = '<div>' . $langs->trans("SelectedLines") . ': '.count($mesCasesCochees).'</div>';
|
||||
$msg.='<div class="detail">';
|
||||
$mesCodesVentilChoisis = $codeventil;
|
||||
$cpt = 0;
|
||||
@ -118,7 +130,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
$ko=0;
|
||||
|
||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
||||
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
|
||||
$maLigneCourante = explode("_", $maLigneCochee);
|
||||
$monId = $maLigneCourante[0];
|
||||
$monCompte = GETPOST('codeventil'.$monId);
|
||||
@ -139,21 +150,21 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
|
||||
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$ok++;
|
||||
$msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$ko++;
|
||||
$msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
$cpt++;
|
||||
}
|
||||
$msg.='</div>';
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||
//} else {
|
||||
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
|
||||
}
|
||||
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
|
||||
}
|
||||
|
||||
|
||||
@ -161,41 +172,45 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, f.datef, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, 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 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account 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 l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND product_type <= 2";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef,";
|
||||
$sql.= " l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.product_type as type_l, 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.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account 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 l.fk_code_ventilation <= 0";
|
||||
$sql.= " AND product_type <= 2";
|
||||
$sql.= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND (f.ref like '%" . $search_invoice . "%')";
|
||||
$sql .= natural_search("f.ref",$search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
|
||||
$sql .= natural_search("p.ref",$search_ref);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '%" . $search_label . "%')";
|
||||
$sql .= natural_search("p.label",$search_label);
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||
$sql .= natural_search("l.description",$search_desc);
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||
$sql .= natural_search("l.total_ht",$search_amount,1);
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
$sql .= natural_search("aa.account_number",$search_account);
|
||||
}
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
@ -223,6 +238,16 @@ if ($result) {
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
//if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -231,42 +256,48 @@ if ($result) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$center='<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
//$center='<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num_lines, 0, 'title_accountancy', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||
|
||||
if ($msg) print $msg.'<br>';
|
||||
|
||||
print $langs->trans("DescVentilTodoCustomer") . '</br><br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
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("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre($langs->trans("ProductLabel"), $_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="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
// 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="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="6" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_vat" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1);
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -275,7 +306,7 @@ if ($result) {
|
||||
$productfourn_static = new ProductFournisseur($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$var = True;
|
||||
$var = true;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
@ -286,60 +317,67 @@ if ($result) {
|
||||
$objp->code_buy_l = '';
|
||||
$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)) {
|
||||
$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->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;
|
||||
$productfourn_static->type = $objp->type;
|
||||
$productfourn_static->label = $objp->product_label;
|
||||
|
||||
$facturefourn_static->ref = $objp->ref;
|
||||
$facturefourn_static->id = $objp->facid;
|
||||
$facturefourn_static->type = $objp->type;
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
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 : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
}
|
||||
if ($objp->code_buy_l == -1) $objp->code_buy_l='';
|
||||
|
||||
if (! empty($objp->code_buy)) {
|
||||
$objp->code_buy_p = $objp->code_buy; // Code on product
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
|
||||
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Line id
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
print $objp->invoice_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
|
||||
|
||||
// Ref product
|
||||
print '<td>';
|
||||
if ($productfourn_static->id)
|
||||
print $productfourn_static->getNomUrl(1);
|
||||
else
|
||||
print ' ';
|
||||
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
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
$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 $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
@ -352,29 +390,24 @@ if ($result) {
|
||||
print price($objp->tva_tx_line);
|
||||
print '</td>';
|
||||
|
||||
// Accounting account suggested
|
||||
// Current account
|
||||
print '<td align="center" style="' . $code_buy_p_notset . '">';
|
||||
if ($objp->code_buy_l == $objp->code_buy_p) { // Test if there is a difference between code by default and code on product
|
||||
if ($objp->code_buy_l > 0) print $objp->code_buy_l;
|
||||
else print $langs->trans("Unknown");
|
||||
} else {
|
||||
print $langs->trans("Default") . ' = ' . ($objp->code_buy_l > 0 ? $objp->code_buy_l : $langs->trans("Unknown"));
|
||||
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown"));
|
||||
if ($objp->product_id > 0)
|
||||
{
|
||||
print '<br>';
|
||||
print $langs->trans("Product") . ' = ' . ($objp->code_buy_p > 0 ? $objp->code_buy_p : $langs->trans("Unknown"));
|
||||
print (($objp->type_l == 1)?$langs->trans("ThisService"):$langs->trans("ThisProduct")) . ' = ' . (empty($objp->code_buy_p) ? $langs->trans("Unknown") : length_accountg($objp->code_buy_p));
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Colonne choix du compte
|
||||
// Suggested accounting account
|
||||
print '<td align="center">';
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1);
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td align="center">' . $objp->rowid . '</td>';
|
||||
|
||||
// Colonne choix ligne a ventiler
|
||||
print '<td align="right">';
|
||||
print '<input type="checkbox" class="checkforaction" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '<input type="checkbox" class="flat checkforselect" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>";
|
||||
@ -382,6 +415,8 @@ if ($result) {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
|
||||
@ -1146,12 +1146,12 @@ class Adherent extends CommonObject
|
||||
$this->birth = $this->db->jdate($obj->birthday);
|
||||
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->morphy = $obj->morphy;
|
||||
|
||||
$this->typeid = $obj->fk_adherent_type;
|
||||
$this->type = $obj->type;
|
||||
$this->need_subscription = ($obj->subscription=='yes'?1:0);
|
||||
$this->type = $obj->type;
|
||||
$this->need_subscription = $obj->subscription;
|
||||
|
||||
$this->user_id = $obj->user_id;
|
||||
$this->user_login = $obj->user_login;
|
||||
|
||||
@ -45,7 +45,7 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
public $cotisation;
|
||||
/**
|
||||
* @var bool Subsription required
|
||||
* @var int Subsription required (0 or 1)
|
||||
* @since 5.0
|
||||
*/
|
||||
public $subscription;
|
||||
|
||||
@ -200,6 +200,7 @@ class Members extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
// Process the status separately because it must be updated using
|
||||
// the validate() and resiliate() methods of the class Adherent.
|
||||
if ($field == 'statut') {
|
||||
|
||||
@ -188,6 +188,7 @@ class Subscriptions extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$subscription->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -375,6 +375,7 @@ if (! empty($moreforfilter))
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
@ -842,6 +843,7 @@ $reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // N
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
print '</form>';
|
||||
|
||||
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1);
|
||||
|
||||
@ -61,7 +61,7 @@ $result=restrictedArea($user,'adherent','','','cotisation');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search="";
|
||||
$search_ref="";
|
||||
@ -154,7 +154,10 @@ if ($result)
|
||||
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
@ -301,6 +304,7 @@ if ($result)
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -68,7 +68,7 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
|
||||
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_lastname="";
|
||||
$search_login="";
|
||||
@ -181,8 +181,11 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
@ -209,6 +212,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -252,7 +256,7 @@ if ($action == 'create')
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -299,13 +303,13 @@ if ($rowid > 0)
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td>';
|
||||
print $form->showrefnav($object, 'rowid', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.dol_escape_htmltag($object->libelle).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.dol_escape_htmltag($object->libelle).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print yn($object->subscription);
|
||||
@ -462,9 +466,16 @@ if ($rowid > 0)
|
||||
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input class="flat" type="hidden" name="rowid" value="'.$rowid.'" size="12"></td>';
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
|
||||
@ -477,9 +488,6 @@ if ($rowid > 0)
|
||||
print "</tr>\n";
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input class="flat" type="hidden" name="rowid" value="'.$rowid.'" size="12"></td>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td class="liste_titre" align="left">';
|
||||
@ -502,7 +510,6 @@ if ($rowid > 0)
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
@ -596,7 +603,9 @@ if ($rowid > 0)
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
if ($num > $conf->liste_limit)
|
||||
{
|
||||
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
|
||||
@ -650,7 +659,7 @@ if ($rowid > 0)
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
|
||||
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -28,7 +28,7 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
@ -370,6 +370,7 @@ print '</td></tr>'."\n";
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
$var=!$var;
|
||||
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
|
||||
print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
@ -384,7 +385,7 @@ print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right" class="nowrap">'."\n";
|
||||
$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), 1);
|
||||
$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_FILTER_STATUS
|
||||
@ -393,7 +394,7 @@ print '<tr '.$bc[$var].'>'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td align="right">'."\n";
|
||||
$formactions->form_select_status_action('agenda',$conf->global->AGENDA_DEFAULT_FILTER_STATUS,1,'AGENDA_DEFAULT_FILTER_STATUS',1,2);
|
||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
|
||||
@ -87,14 +87,14 @@ else if ($action == 'disable_delivery')
|
||||
$dir = DOL_DOCUMENT_ROOT."/core/modules/expedition/";
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader("","");
|
||||
llxHeader("",$langs->trans("SendingsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup');
|
||||
print '<br>';
|
||||
$head = expedition_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("ModuleSetup"), 0, 'sending');
|
||||
dol_fiche_head($head, 'general', $langs->trans("Sendings"), 0, 'sending');
|
||||
|
||||
/*
|
||||
* Formulaire parametres divers
|
||||
|
||||
@ -86,7 +86,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,32,0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -1034,9 +1034,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; }
|
||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); }
|
||||
@ -1052,6 +1052,18 @@ if ($id)
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
if ($fieldlist[$field]=='paper_size') { $valuetoshow=$langs->trans("PaperSize"); }
|
||||
if ($fieldlist[$field]=='orientation') { $valuetoshow=$langs->trans("Orientation"); }
|
||||
if ($fieldlist[$field]=='leftmargin') { $valuetoshow=$langs->trans("LeftMargin"); }
|
||||
if ($fieldlist[$field]=='topmargin') { $valuetoshow=$langs->trans("TopMargin"); }
|
||||
if ($fieldlist[$field]=='spacex') { $valuetoshow=$langs->trans("SpaceX"); }
|
||||
if ($fieldlist[$field]=='spacey') { $valuetoshow=$langs->trans("SpaceY"); }
|
||||
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
|
||||
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
|
||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1211,9 +1223,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); }
|
||||
if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; }
|
||||
if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); }
|
||||
if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); }
|
||||
if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); }
|
||||
if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); }
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); }
|
||||
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; }
|
||||
@ -1229,6 +1241,20 @@ if ($id)
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
if ($fieldlist[$field]=='paper_size') { $valuetoshow=$langs->trans("PaperSize"); }
|
||||
if ($fieldlist[$field]=='orientation') { $valuetoshow=$langs->trans("Orientation"); }
|
||||
if ($fieldlist[$field]=='leftmargin') { $valuetoshow=$langs->trans("LeftMargin"); }
|
||||
if ($fieldlist[$field]=='topmargin') { $valuetoshow=$langs->trans("TopMargin"); }
|
||||
if ($fieldlist[$field]=='spacex') { $valuetoshow=$langs->trans("SpaceX"); }
|
||||
if ($fieldlist[$field]=='spacey') { $valuetoshow=$langs->trans("SpaceY"); }
|
||||
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
|
||||
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
|
||||
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
|
||||
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
|
||||
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
|
||||
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
|
||||
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
|
||||
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
|
||||
@ -215,7 +215,7 @@ $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader("","");
|
||||
llxHeader("",$langs->trans("SendingsSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup');
|
||||
|
||||
@ -638,7 +638,7 @@ if (! empty($conf->banque->enabled))
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE clos = 0";
|
||||
$sql.= " AND courant = 1";
|
||||
$sql.= " AND entity IN (".getEntity('bank_account', 1).")";
|
||||
$sql.= " AND entity IN (".getEntity('bank', 1).")";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -683,7 +683,7 @@ $sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE clos = 0";
|
||||
$sql.= " AND courant = 1";
|
||||
$sql.= " AND entity IN (".getEntity('bank_account', 1).")";
|
||||
$sql.= " AND entity IN (".getEntity('bank', 1).")";
|
||||
$var=True;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -286,23 +286,10 @@ if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>
|
||||
$h = 0;
|
||||
|
||||
$categidx='common'; // Main
|
||||
//if (! empty($categ[$categidx]))
|
||||
//{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
//}
|
||||
|
||||
/*$categidx='expdev';
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
$categidx='expdev';
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3);
|
||||
$head[$h][2] = 'expdev';
|
||||
$h++;
|
||||
}*/
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
|
||||
$categidx='marketplace';
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
@ -314,17 +301,18 @@ $h++;
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
dol_fiche_head($head, $mode, '');
|
||||
|
||||
$var=true;
|
||||
|
||||
if ($mode != 'marketplace')
|
||||
{
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
dol_fiche_head($head, $mode, '');
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
@ -352,7 +340,7 @@ if ($mode != 'marketplace')
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
//print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@ -361,14 +349,18 @@ if ($mode != 'marketplace')
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
//print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<br><br><br><br>';
|
||||
//dol_fiche_end();
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
//print '<br><br><br><br>';
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
// Show list of modules
|
||||
|
||||
print '<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" summary="list_of_modules" id="list_of_modules" >'."\n";
|
||||
|
||||
$oldfamily='';
|
||||
|
||||
@ -380,7 +372,7 @@ if ($mode != 'marketplace')
|
||||
$modName = $filename[$key];
|
||||
$objMod = $modules[$key];
|
||||
$dirofmodule = $dirmod[$key];
|
||||
|
||||
|
||||
$special = $objMod->special;
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
|
||||
@ -393,9 +385,9 @@ if ($mode != 'marketplace')
|
||||
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
|
||||
|
||||
|
||||
// Check filters
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
@ -506,7 +498,7 @@ if ($mode != 'marketplace')
|
||||
$text='';
|
||||
if ($objMod->getDescLong()) $text.='<div class="titre">'.$objMod->getDesc().'</div><br>'.$objMod->getDescLong().'<br>';
|
||||
else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
|
||||
|
||||
|
||||
$textexternal='';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
@ -524,7 +516,7 @@ if ($mode != 'marketplace')
|
||||
if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour');
|
||||
else $text.=$langs->trans("Disabled");
|
||||
$text.='<br>';
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||
{
|
||||
@ -537,7 +529,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
|
||||
{
|
||||
@ -549,7 +541,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
{
|
||||
@ -568,14 +560,14 @@ if ($mode != 'marketplace')
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
|
||||
{
|
||||
@ -587,14 +579,14 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
@ -618,14 +610,14 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
|
||||
{
|
||||
@ -637,7 +629,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
|
||||
{
|
||||
@ -649,29 +641,29 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text.=$langs->trans("DetectionNotPossible");
|
||||
|
||||
|
||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
||||
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
|
||||
|
||||
// Picto warning
|
||||
$version=$objMod->getVersion(0);
|
||||
$versiontrans=$objMod->getVersion(1);
|
||||
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"');
|
||||
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"');
|
||||
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
||||
|
||||
|
||||
// Picto external
|
||||
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: left"');
|
||||
|
||||
|
||||
print $versiontrans;
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
@ -767,9 +759,12 @@ if ($mode != 'marketplace')
|
||||
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_fiche_head($head, $mode, '');
|
||||
|
||||
// Marketplace
|
||||
print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
@ -781,7 +776,7 @@ else
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
$url='https://www.dolistore.com';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
|
||||
print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
print '</tr>';
|
||||
@ -789,18 +784,18 @@ else
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
$url='https://partners.dolibarr.org';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" width="180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
|
||||
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
|
||||
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
||||
print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
//dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
// Show warning about external users
|
||||
if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n";
|
||||
|
||||
|
||||
@ -324,27 +324,6 @@ else
|
||||
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("UseDispatchStatus").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
if (! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
|
||||
print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1,$disabled);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'"'.$disabled.'>';
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
}
|
||||
$found++;
|
||||
|
||||
/*if (! $found)
|
||||
@ -461,11 +440,24 @@ print " <td>".$langs->trans("Other")."</td>\n";
|
||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("UseDispatchStatus").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
|
||||
print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</form>\n";
|
||||
print "</td>\n</tr>\n";
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="60%">'.$langs->trans("UserWarehouseAutoCreate").'</td>';
|
||||
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@ -497,7 +497,7 @@ $var=false;
|
||||
print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'<br>';
|
||||
print $langs->trans("IfSetToYesDontForgetPermission");
|
||||
print '</td><td>';
|
||||
print '<input type="text" size="3" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.$conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED.'">';
|
||||
print '<input type="text" size="6" name="SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED" value="'.$conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED.'">';
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
@ -88,7 +88,7 @@ else
|
||||
{
|
||||
$arraytest=array(
|
||||
'character_set_database'=>array('var'=>'dolibarr_main_db_character_set','valifempty'=>'utf8'),
|
||||
'collation_database'=>array('var'=>'dolibarr_main_db_collation','valifempty'=>'utf8_general_ci')
|
||||
'collation_database'=>array('var'=>'dolibarr_main_db_collation','valifempty'=>'utf8_unicode_ci')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -289,7 +289,7 @@ function backup_tables($outputfile, $tables='*')
|
||||
|
||||
// Print headers and global mysql config vars
|
||||
$sqlhead = '';
|
||||
$sqlhead .= "-- ".$db::LABEL." dump via php
|
||||
$sqlhead .= "-- ".$db::LABEL." dump via php with Dolibarr ".DOL_VERSION."
|
||||
--
|
||||
-- Host: ".$db->db->host_info." Database: ".$db->database_name."
|
||||
-- ------------------------------------------------------
|
||||
|
||||
@ -165,7 +165,7 @@ $sql.= " e.fk_user, e.description,";
|
||||
$sql.= " u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
$sql.= " WHERE e.entity IN (".getEntity('actioncomm', 1).")";
|
||||
$sql.= " WHERE e.entity IN (".getEntity('event', 1).")";
|
||||
if ($date_start > 0) $sql.= " AND e.dateevent >= '".$db->idate($date_start)."'";
|
||||
if ($date_end > 0) $sql.= " AND e.dateevent <= '".$db->idate($date_end)."'";
|
||||
if ($search_code) { $usefilter++; $sql.=natural_search("e.type", $search_code, 0); }
|
||||
|
||||
@ -23,8 +23,7 @@ use Luracast\Restler\Defaults;
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
/**
|
||||
* Class for API
|
||||
*
|
||||
* Class for API REST v1
|
||||
*/
|
||||
class DolibarrApi
|
||||
{
|
||||
@ -55,6 +54,8 @@ class DolibarrApi
|
||||
$this->db = $db;
|
||||
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
|
||||
$this->r = new Restler($production_mode);
|
||||
|
||||
$this->r->setAPIVersion(1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -92,11 +93,38 @@ class DolibarrApi
|
||||
// Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses
|
||||
unset($object->linkedObjects);
|
||||
|
||||
unset($object->lignes); // should be lines
|
||||
unset($object->lignes); // should be ->lines
|
||||
unset($object->oldline);
|
||||
|
||||
unset($object->error);
|
||||
unset($object->errors);
|
||||
|
||||
unset($object->ref_previous);
|
||||
unset($object->ref_next);
|
||||
unset($object->ref_int);
|
||||
|
||||
unset($object->projet); // Should be fk_project
|
||||
unset($object->project); // Should be fk_project
|
||||
unset($object->author); // Should be fk_user_author
|
||||
unset($object->timespent_old_duration);
|
||||
unset($object->timespent_id);
|
||||
unset($object->timespent_duration);
|
||||
unset($object->timespent_date);
|
||||
unset($object->timespent_datehour);
|
||||
unset($object->timespent_withhour);
|
||||
unset($object->timespent_fk_user);
|
||||
unset($object->timespent_note);
|
||||
|
||||
unset($object->statuts);
|
||||
unset($object->statuts_short);
|
||||
unset($object->statuts_logo);
|
||||
unset($object->statuts_long);
|
||||
|
||||
unset($object->element);
|
||||
unset($object->fk_element);
|
||||
unset($object->table_element);
|
||||
unset($object->table_element_line);
|
||||
unset($object->picto);
|
||||
|
||||
// Remove the $oldcopy property because it is not supported by the JSON
|
||||
// encoder. The following error is generated when trying to serialize
|
||||
|
||||
@ -38,11 +38,14 @@ class Login
|
||||
*
|
||||
* @param string $login Username
|
||||
* @param string $password User password
|
||||
* @param int $entity User entity
|
||||
* @param int $reset Reset token
|
||||
* @param int $entity Entity (when multicompany module is used). Empty means 1=first company.
|
||||
* @param int $reset Reset token (0=get current token, 1=ask a new token, meaning that all future access using current token will failed)
|
||||
* @return array Response status and user token
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @url GET /
|
||||
* @url POST /
|
||||
*/
|
||||
public function index($login, $password, $entity=0, $reset=0) {
|
||||
|
||||
|
||||
@ -106,7 +106,16 @@ foreach ($modulesdir as $dir)
|
||||
elseif ($module == 'facture') {
|
||||
$moduledirforclass = 'compta/facture';
|
||||
}
|
||||
|
||||
elseif ($module == 'project') {
|
||||
$moduledirforclass = 'projet';
|
||||
}
|
||||
elseif ($module == 'task') {
|
||||
$moduledirforclass = 'projet';
|
||||
}
|
||||
elseif ($module == 'stock') {
|
||||
$moduledirforclass = 'product/stock';
|
||||
}
|
||||
|
||||
// Defined if module is enabled
|
||||
$enabled=true;
|
||||
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
|
||||
@ -135,7 +144,7 @@ foreach ($modulesdir as $dir)
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
dol_syslog("Found deprecated API classname=".$classname." into ".$dir);
|
||||
dol_syslog("Found deprecated API by index.php: classname=".$classname." into ".$dir." - ".$dir_part.$file_searched);
|
||||
$api->r->addAPIClass($classname, '/');
|
||||
}
|
||||
}
|
||||
@ -145,7 +154,7 @@ foreach ($modulesdir as $dir)
|
||||
require_once $dir_part.$file_searched;
|
||||
if (class_exists($classname))
|
||||
{
|
||||
dol_syslog("Found API classname=".$classname." into ".$dir);
|
||||
dol_syslog("Found API by index.php: classname=".$classname." into ".$dir." - ".$dir_part.$file_searched);
|
||||
$listofapis[] = $classname;
|
||||
}
|
||||
}
|
||||
@ -161,17 +170,14 @@ foreach ($modulesdir as $dir)
|
||||
// shows the classes in the order they are added and it's a mess if they are
|
||||
// not sorted.
|
||||
sort($listofapis);
|
||||
//var_dump($listofapis);
|
||||
foreach ($listofapis as $classname)
|
||||
{
|
||||
$api->r->addAPIClass($classname);
|
||||
}
|
||||
|
||||
// TODO If not found, redirect to explorer
|
||||
|
||||
//var_dump($api);
|
||||
|
||||
// Call API (we suppose we found it)
|
||||
$api->r->handle();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -92,8 +92,11 @@ if ($resql)
|
||||
$param = "";
|
||||
if ($optioncss != '') $param ='&optioncss='.$optioncss;
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
//print "<td> </td>";
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
|
||||
@ -200,6 +203,8 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@ -252,7 +252,7 @@ if ($user->rights->categorie->creer)
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('description',$description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,50);
|
||||
$doleditor=new DolEditor('description',$description,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,ROWS_6,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ class Categories extends DolibarrApi
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as t";
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('categorie', 1).')';
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('category', 1).')';
|
||||
if (!empty($type))
|
||||
{
|
||||
$sql.= ' AND t.type='.array_search($type,Categories::$TYPES);
|
||||
@ -151,7 +151,7 @@ class Categories extends DolibarrApi
|
||||
$obj = $db->fetch_object($result);
|
||||
$category_static = new Categorie($db);
|
||||
if($category_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = parent::_cleanObjectDatas($category_static);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($category_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -204,7 +204,7 @@ class Categories extends DolibarrApi
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')';
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')';
|
||||
$sql.= ' AND s.type='.array_search($type,Categories::$TYPES);
|
||||
$sql.= ' AND s.rowid = sub.fk_categorie';
|
||||
$sql.= ' AND sub.'.$subcol_name.' = '.$item;
|
||||
@ -237,7 +237,7 @@ class Categories extends DolibarrApi
|
||||
$obj = $db->fetch_object($result);
|
||||
$category_static = new Categorie($db);
|
||||
if($category_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = parent::_cleanObjectDatas($category_static);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($category_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -298,6 +298,7 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
|
||||
@ -339,6 +340,26 @@ class Categories extends DolibarrApi
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param Categorie $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*
|
||||
* @todo use an array for properties to clean
|
||||
*
|
||||
*/
|
||||
function _cleanObjectDatas($object) {
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
// Remove the subscriptions because they are handled as a subresource.
|
||||
//unset($object->subscriptions);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
|
||||
@ -121,7 +121,7 @@ class CategoryApi extends DolibarrApi
|
||||
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')';
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')';
|
||||
$sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -200,7 +200,7 @@ class CategoryApi extends DolibarrApi
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')';
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')';
|
||||
$sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES);
|
||||
$sql.= ' AND s.rowid = sub.fk_categorie';
|
||||
$sql.= ' AND sub.'.$subcol_name.' = '.$item;
|
||||
@ -425,6 +425,7 @@ class CategoryApi extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->category->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ print '<tr>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td >';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,ROWS_6,50);
|
||||
$doleditor=new DolEditor('description',$object->description,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,ROWS_6,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -205,7 +205,7 @@ if ($action == 'edit')
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="fieldtitlecreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -285,7 +285,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
|
||||
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -199,7 +199,7 @@ dol_fiche_head($head, 'card', $title, 0, 'category');
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type, $langs->trans('DeleteCategory'), $langs->trans('ConfirmDeleteCategory'), 'confirm_delete', '', '', 1);
|
||||
}
|
||||
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
@ -795,7 +795,7 @@ if ($action == 'create')
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
if(!empty($origin) && !empty($originid))
|
||||
if (!empty($origin) && !empty($originid))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
print '<tr><td>'.$langs->trans("LinkedObject").'</td>';
|
||||
@ -819,7 +819,7 @@ if ($action == 'create')
|
||||
// Description
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90);
|
||||
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1151,7 +1151,7 @@ if ($id > 0)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@ -870,7 +870,7 @@ class ActionComm extends CommonObject
|
||||
|
||||
$sql = "SELECT a.id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('actioncomm', 1).")";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('agenda', 1).")";
|
||||
if (! empty($socid)) $sql.= " AND a.fk_soc = ".$socid;
|
||||
if (! empty($elementtype))
|
||||
{
|
||||
@ -921,7 +921,7 @@ class ActionComm extends CommonObject
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " WHERE a.percent >= 0 AND a.percent < 100";
|
||||
$sql.= " AND a.entity IN (".getEntity('actioncomm', 1).")";
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
|
||||
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
|
||||
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
|
||||
@ -1113,15 +1113,26 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
|
||||
$result='';
|
||||
|
||||
// Set label of typ
|
||||
$labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL');
|
||||
}
|
||||
|
||||
|
||||
$tooltip = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
|
||||
if (! empty($this->ref))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
if (! empty($label))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Title') . ':</b> ' . $label;
|
||||
if (! empty($labeltype))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype;
|
||||
if (! empty($this->location))
|
||||
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
|
||||
|
||||
@ -1129,11 +1140,11 @@ class ActionComm extends CommonObject
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
$linkclose = ' style="background-color:#'.$this->type_color.'"';
|
||||
|
||||
if (empty($notooltip) && $user->rights->propal->lire)
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowSupplierProposal");
|
||||
$label=$langs->trans("ShowAction");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||
@ -1166,13 +1177,13 @@ class ActionComm extends CommonObject
|
||||
if ($withpicto == 2)
|
||||
{
|
||||
$libelle=$label;
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->transnoentities("Action".$this->type_code);
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$labeltype;
|
||||
$libelleshort='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$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;
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=$labeltype;
|
||||
if ($maxlength < 0) $libelleshort=$this->ref;
|
||||
else $libelleshort=dol_trunc($libelle,$maxlength);
|
||||
}
|
||||
@ -1270,7 +1281,7 @@ class ActionComm extends CommonObject
|
||||
// We must filter on assignement table
|
||||
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql.= " WHERE a.fk_action=c.id";
|
||||
$sql.= " AND a.entity IN (".getEntity('actioncomm', 1).")";
|
||||
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
|
||||
foreach ($filters as $key => $value)
|
||||
{
|
||||
if ($key == 'notolderthan' && $value != '') $sql.=" AND a.datep >= '".$this->db->idate($now-($value*24*60*60))."'";
|
||||
|
||||
@ -107,7 +107,7 @@ class AgendaEvents extends DolibarrApi
|
||||
|
||||
$sql = "SELECT t.id as rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('actioncomm', 1).')';
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")";
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
@ -223,6 +223,7 @@ class AgendaEvents extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->expensereport->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -105,9 +105,9 @@ class CActionComm
|
||||
* @param string|int $active 1 or 0 to filter on event state active or not ('' by default = no filter)
|
||||
* @param string $idorcode 'id' or 'code'
|
||||
* @param string $excludetype Type to exclude ('system' or 'systemauto')
|
||||
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type
|
||||
* @param int $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
|
||||
* @param string $morefilter Add more SQL filter
|
||||
* @return mixed Array of all event types if OK, <0 if KO
|
||||
* @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode.
|
||||
*/
|
||||
function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='')
|
||||
{
|
||||
@ -123,7 +123,7 @@ class CActionComm
|
||||
if ($active != '') $sql.=" AND active=".$active;
|
||||
if (! empty($excludetype)) $sql.=" AND type <> '".$excludetype."'";
|
||||
if ($morefilter) $sql.=" AND ".$morefilter;
|
||||
$sql.= " ORDER BY module, position";
|
||||
$sql.= " ORDER BY module, position, type";
|
||||
|
||||
dol_syslog(get_class($this)."::liste_array", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -140,7 +140,7 @@ class CActionComm
|
||||
$qualified=1;
|
||||
|
||||
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
|
||||
if ($qualified && $onlyautoornot && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||
if ($qualified && $onlyautoornot > 0 && preg_match('/^system/',$obj->type) && ! preg_match('/^AC_OTH/',$obj->code)) $qualified=0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||
|
||||
if ($qualified && $obj->module)
|
||||
{
|
||||
@ -155,12 +155,19 @@ class CActionComm
|
||||
if ($qualified)
|
||||
{
|
||||
$code=$obj->code;
|
||||
if ($onlyautoornot && $code == 'AC_OTH') $code='AC_MANUAL';
|
||||
if ($onlyautoornot && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
||||
if ($onlyautoornot > 0 && $code == 'AC_OTH') $code='AC_MANUAL';
|
||||
if ($onlyautoornot > 0 && $code == 'AC_OTH_AUTO') $code='AC_AUTO';
|
||||
$transcode=$langs->trans("Action".$code);
|
||||
$repid[$obj->id] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
||||
$repcode[$obj->code] = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
||||
if ($onlyautoornot && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
|
||||
$label = ($transcode!="Action".$code?$transcode:$langs->trans($obj->label));
|
||||
if ($onlyautoornot == -1 && ! empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/auto/i', $code))
|
||||
{
|
||||
$label=' '.$label;
|
||||
$repid[-99]=$langs->trans("ActionAC_MANUAL");
|
||||
$repcode['AC_NON_AUTO']=$langs->trans("ActionAC_MANUAL");
|
||||
}
|
||||
$repid[$obj->id] = $label;
|
||||
$repcode[$obj->code] = $label;
|
||||
if ($onlyautoornot > 0 && preg_match('/^module/',$obj->type) && $obj->module) $repcode[$obj->code].=' ('.$langs->trans("Module").': '.$obj->module.')';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -450,7 +450,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
|
||||
@ -132,7 +132,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$actioncode='';
|
||||
$search_title='';
|
||||
@ -194,7 +194,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND c.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND c.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND c.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND c.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
@ -313,9 +335,13 @@ if ($resql)
|
||||
|
||||
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
@ -332,11 +358,7 @@ if ($resql)
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
//{
|
||||
print '<td class="liste_titre"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" name="search_type" value="'.$search_type.'"></td>';
|
||||
//}
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
|
||||
print '</td>';
|
||||
@ -345,7 +367,6 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
//print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td></td>';
|
||||
// Action column
|
||||
@ -402,6 +423,7 @@ if ($resql)
|
||||
{
|
||||
if ($actionstatic->type_picto) print img_picto('', $actionstatic->type_picto);
|
||||
else {
|
||||
if ($actionstatic->type_code == 'AC_RDV') print img_picto('', 'object_group').' ';
|
||||
if ($actionstatic->type_code == 'AC_TEL') print img_picto('', 'object_phoning').' ';
|
||||
if ($actionstatic->type_code == 'AC_FAX') print img_picto('', 'object_phoning_fax').' ';
|
||||
if ($actionstatic->type_code == 'AC_EMAIL') print img_picto('', 'object_email').' ';
|
||||
@ -476,7 +498,7 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
@ -365,7 +365,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
|
||||
@ -96,7 +96,6 @@ else
|
||||
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
|
||||
}
|
||||
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
|
||||
|
||||
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
|
||||
if ($dateselect > 0)
|
||||
{
|
||||
@ -373,7 +372,29 @@ if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resour
|
||||
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
$sql.= ' WHERE a.fk_action = ca.id';
|
||||
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
|
||||
if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'";
|
||||
// Condition on actioncode
|
||||
if (! empty($actioncode))
|
||||
{
|
||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_OTH') $sql.= " AND ca.type != 'systemauto'";
|
||||
if ($actioncode == 'AC_OTH_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($actioncode == 'AC_NON_AUTO') $sql.= " AND ca.type != 'systemauto'";
|
||||
elseif ($actioncode == 'AC_ALL_AUTO') $sql.= " AND ca.type = 'systemauto'";
|
||||
else
|
||||
{
|
||||
$sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
|
||||
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
|
||||
|
||||
@ -114,9 +114,13 @@ if ($resql)
|
||||
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td align="center">'.$langs->trans("EventsNb").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Action").'</td>';
|
||||
@ -162,7 +166,7 @@ if ($resql)
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
@ -385,7 +385,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cf.fk_soc = s.rowid";
|
||||
$sql.= " AND cf.fk_statut = 0";
|
||||
$sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")";
|
||||
$sql.= " AND cf.entity IN (".getEntity('commande_fournisseur', 1).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND cf.fk_soc = ".$socid;
|
||||
|
||||
@ -611,7 +611,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
|
||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity IN (".getEntity('contrat', 1).")";
|
||||
$sql.= " AND c.entity IN (".getEntity('contract', 1).")";
|
||||
$sql.= " AND c.fk_product = p.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -333,7 +333,7 @@ if (empty($reshook))
|
||||
dol_syslog("comm/mailing/card.php: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_WARNING);
|
||||
|
||||
$sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql.=" SET statut=-1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
|
||||
$sql.=" SET statut=-1, error_text='".$db->escape($mail->error)."', date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
|
||||
$resql2=$db->query($sql);
|
||||
if (! $resql2)
|
||||
{
|
||||
@ -668,7 +668,15 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewMailing"));
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($object->substitutionarray as $key => $val)
|
||||
{
|
||||
$htmltext.=$key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
$htmltext.='</i>';
|
||||
|
||||
// Print mail form
|
||||
print load_fiche_titre($langs->trans("NewMailing"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic');
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
@ -693,21 +701,16 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||
print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td valign="top"><span class="fieldrequired">'.$langs->trans("MailMessage").'</span><br>';
|
||||
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
|
||||
foreach($object->substitutionarray as $key => $val)
|
||||
{
|
||||
print $key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
print '</i></td>';
|
||||
print '<td>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div style="padding-top: 10px">';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></div>';
|
||||
@ -788,17 +791,24 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
/* print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
*/
|
||||
// Description
|
||||
print '<tr><td>'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
||||
print $form->editfieldval("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
|
||||
print '</td></tr>';
|
||||
|
||||
@ -813,10 +823,12 @@ else
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
/*
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
|
||||
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
|
||||
print'</td></tr>';
|
||||
|
||||
*/
|
||||
|
||||
// Nb of distinct emails
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
@ -987,11 +999,19 @@ else
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($object->substitutionarray as $key => $val)
|
||||
{
|
||||
$htmltext.=$key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
$htmltext.='</i>';
|
||||
|
||||
// Print mail content
|
||||
print load_fiche_titre($langs->trans("EMail"),'','');
|
||||
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic');
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Subject
|
||||
@ -1019,16 +1039,11 @@ else
|
||||
/*print '<tr><td width="15%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
|
||||
print '</td></tr>';*/
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Message
|
||||
print '<tr><td valign="top">'.$langs->trans("MailMessage").'<br>';
|
||||
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
|
||||
foreach($object->substitutionarray as $key => $val)
|
||||
{
|
||||
print $key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
print '</i></td>';
|
||||
print '<td colspan="3" bgcolor="'.($object->bgcolor?(preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor:'white').'">';
|
||||
print '<div style="padding-top: 10px" bgcolor="'.($object->bgcolor?(preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor:'white').'">';
|
||||
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff')
|
||||
{
|
||||
$readonly=1;
|
||||
@ -1038,12 +1053,10 @@ else
|
||||
$doleditor->Create();
|
||||
}
|
||||
else print dol_htmlentitiesbr($object->body);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1051,19 +1064,28 @@ else
|
||||
* Mailing en mode edition
|
||||
*/
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
/*
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
*/
|
||||
|
||||
// Topic
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
// From
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
|
||||
// To
|
||||
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto,0,0,0,0,1).'</td></tr>';
|
||||
|
||||
@ -1100,21 +1122,29 @@ else
|
||||
|
||||
|
||||
|
||||
print "\n";
|
||||
print "<br>\n";
|
||||
|
||||
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
|
||||
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
|
||||
foreach($object->substitutionarray as $key => $val)
|
||||
{
|
||||
$htmltext.=$key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
$htmltext.='</i>';
|
||||
|
||||
// Print mail content
|
||||
print load_fiche_titre($langs->trans("EMail"),'','');
|
||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic');
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Subject
|
||||
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$object->sujet.'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';
|
||||
|
||||
$trackid=''; // TODO To avoid conflicts with 2 mass emailing, we should set a trackid here, even if we use another one into email header.
|
||||
dol_init_file_process($upload_dir, $trackid);
|
||||
@ -1159,23 +1189,17 @@ else
|
||||
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Message
|
||||
print '<tr><td valign="top">'.$langs->trans("MailMessage").'<br>';
|
||||
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
|
||||
foreach($object->substitutionarray as $key => $val)
|
||||
{
|
||||
print $key.' = '.$langs->trans($val).'<br>';
|
||||
}
|
||||
print '</i></td>';
|
||||
print '<td colspan="3">';
|
||||
print '<div style="padding-top: 10px">';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,120);
|
||||
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
@ -38,16 +38,17 @@ $langs->load("mails");
|
||||
if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden();
|
||||
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="email";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$rowid=GETPOST('rowid','int');
|
||||
@ -178,17 +179,24 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
/*
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
*/
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from,0,0,0,0,1).'</td></tr>';
|
||||
|
||||
@ -197,10 +205,10 @@ if ($object->fetch($id) >= 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
|
||||
/* print '<tr><td>'.$langs->trans("Status").'</td><td colspan="3">'.$object->getLibStatut(4);
|
||||
if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')';
|
||||
print '</td></tr>';
|
||||
|
||||
*/
|
||||
// Nb of distinct emails
|
||||
print '<tr><td>';
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
@ -230,14 +238,22 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"),1):''), 'title_generic');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("RecipientSelectionModules").'</td>';
|
||||
print '<td class="liste_titre" align="center">'.$langs->trans("NbOfUniqueEMails").'</td>';
|
||||
print '<td class="liste_titre" align="left">'.$langs->trans("Filter").'</td>';
|
||||
print '<td class="liste_titre" align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
//print '<table class="noborder" width="100%">';
|
||||
print '<div class="tagtable centpercent liste_titre_bydiv" id="tablelines">';
|
||||
|
||||
//print '<tr class="liste_titre">';
|
||||
print '<div class="tagtr liste_titre">';
|
||||
//print '<td class="liste_titre">'.$langs->trans("RecipientSelectionModules").'</td>';
|
||||
print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
|
||||
//print '<td class="liste_titre" align="center">'.$langs->trans("NbOfUniqueEMails").'</td>';
|
||||
print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>';
|
||||
//print '<td class="liste_titre" align="left">'.$langs->trans("Filter").'</td>';
|
||||
print '<div class="tagtd" align="left">'.$langs->trans("Filter").'</div>';
|
||||
//print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<div class="tagtd"> </div>';
|
||||
//print "</tr>\n";
|
||||
print '</div>';
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$var=true;
|
||||
@ -295,19 +311,28 @@ if ($object->fetch($id) >= 0)
|
||||
if ($qualified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
//print '<tr '.$bc[$var].'>';
|
||||
// print '<div '.$bctag[$var].'>';
|
||||
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
print '<form name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
|
||||
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div '.$bctag[$var].'>';
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
//print '<td>';
|
||||
print '<div class="tagtd">';
|
||||
if (empty($obj->picto)) $obj->picto='generic';
|
||||
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto).' '.$obj->getDesc();
|
||||
print '</td>';
|
||||
|
||||
print img_object($langs->trans("Module").': '.get_class($obj),$obj->picto);
|
||||
print ' ';
|
||||
print $obj->getDesc();
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
try {
|
||||
$nbofrecipient=$obj->getNbOfRecipients('');
|
||||
}
|
||||
@ -316,7 +341,8 @@ if ($object->fetch($id) >= 0)
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
//print '<td align="center">';
|
||||
print '<div class="tagtd center">';
|
||||
if ($nbofrecipient >= 0)
|
||||
{
|
||||
print $nbofrecipient;
|
||||
@ -325,45 +351,58 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
print $langs->trans("Error").' '.img_error($obj->error);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
try {
|
||||
$filter=$obj->formFilter();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
if ($filter) print $filter;
|
||||
else print $langs->trans("None");
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
//print '<td align="left">';
|
||||
print '<div class="tagtd" align="left">';
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
try {
|
||||
$filter=$obj->formFilter();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
dol_syslog($e->getMessage(), LOG_ERR);
|
||||
}
|
||||
if ($filter) print $filter;
|
||||
else print $langs->trans("None");
|
||||
}
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
//print '<td align="right">';
|
||||
print '<div class="tagtd" align="right">';
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
print '<input type="submit" class="button" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="submit" class="button disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
//print $langs->trans("MailNoChangePossible");
|
||||
print " ";
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
//print '</td>';
|
||||
print '</div>';
|
||||
|
||||
if ($allowaddtarget) print '</form>';
|
||||
|
||||
print "</tr>\n";
|
||||
else print '</div>';
|
||||
|
||||
//print "</tr>\n";
|
||||
// print '</div>'."\n";
|
||||
}
|
||||
}
|
||||
} // End foreach dir
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
//print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
// List of selected targets
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type";
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.fk_mailing=".$object->id;
|
||||
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
||||
@ -441,15 +480,15 @@ if ($object->fetch($id) >= 0)
|
||||
print '<tr class="liste_titre">';
|
||||
// EMail
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_email" size="14" value="'.$search_email.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
// Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_lastname" size="12" value="'.$search_lastname.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
|
||||
print '</td>';
|
||||
// Firstname
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_firstname" size="10" value="'.$search_firstname.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
// Other
|
||||
print '<td class="liste_titre">';
|
||||
@ -468,10 +507,10 @@ if ($object->fetch($id) >= 0)
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print $formmailing->selectDestinariesStatus($search_dest_status,'search_dest_status',1);
|
||||
print '</td>';
|
||||
//Search Icon
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
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" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -480,9 +519,10 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
if ($num)
|
||||
{
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
@ -537,7 +577,7 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
print '<td align="center">'.$obj->date_envoi.'</td>';
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $object::libStatutDest($obj->statut,2);
|
||||
print $object::libStatutDest($obj->statut,2,$obj->error_text);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -33,7 +33,8 @@ class Mailing extends CommonObject
|
||||
{
|
||||
public $element='mailing';
|
||||
public $table_element='mailing';
|
||||
|
||||
public $picto='email';
|
||||
|
||||
var $titre;
|
||||
var $sujet;
|
||||
var $body;
|
||||
@ -577,12 +578,14 @@ class Mailing extends CommonObject
|
||||
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
* TODO Add class mailin_target.class.php
|
||||
*
|
||||
* @param int $statut Id statut
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param strin $desc Desc error
|
||||
* @return string Label
|
||||
*/
|
||||
static public function libStatutDest($statut,$mode=0)
|
||||
static public function libStatutDest($statut,$mode=0,$desc='')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('mails');
|
||||
@ -597,28 +600,28 @@ class Mailing extends CommonObject
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc);
|
||||
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||
|
||||
@ -56,10 +56,10 @@ 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("SearchAMailing").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size="18"></td>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat inputsearch" name="sref"></td>';
|
||||
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td class="nowrap">';
|
||||
print $langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print $langs->trans("Other").':</td><td><input type="text" class="flat inputsearch" name="sall"></td>';
|
||||
|
||||
print "</table></form><br>\n";
|
||||
|
||||
|
||||
@ -43,24 +43,33 @@ llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:M
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$mil = new Mailing($db);
|
||||
$object = new Mailing($db);
|
||||
|
||||
if ($mil->fetch($_REQUEST["id"]) >= 0)
|
||||
if ($object->fetch($_REQUEST["id"]) >= 0)
|
||||
{
|
||||
$head = emailing_prepare_head($mil);
|
||||
$head = emailing_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
$mil->user_creation=$mil->user_creat;
|
||||
$mil->date_creation=$mil->date_creat;
|
||||
$mil->user_validation=$mil->user_valid;
|
||||
$mil->date_validation=$mil->date_valid;
|
||||
dol_print_object_info($mil);
|
||||
print '</td></tr></table>';
|
||||
$morehtmlright='';
|
||||
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
|
||||
|
||||
print '<div class="underbanner clearboth"></div><br>';
|
||||
|
||||
//print '<table width="100%"><tr><td>';
|
||||
$object->user_creation=$object->user_creat;
|
||||
$object->date_creation=$object->date_creat;
|
||||
$object->user_validation=$object->user_valid;
|
||||
$object->date_validation=$object->date_valid;
|
||||
dol_print_object_info($object, 0);
|
||||
//print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -111,8 +111,18 @@ if ($result)
|
||||
if ($filteremail) $param.='&filteremail='.urlencode($filteremail);
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder);
|
||||
@ -193,7 +203,9 @@ if ($result)
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table></form>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@ -797,7 +797,7 @@ if (empty($reshook))
|
||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
$tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1828,7 +1828,7 @@ if ($action == 'create')
|
||||
// Remise dispo de type non avoir
|
||||
$filter = 'fk_facture_source IS NULL';
|
||||
print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter);
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter, 0, '', 1);
|
||||
}
|
||||
}
|
||||
if ($absolute_creditnote) {
|
||||
@ -2404,7 +2404,7 @@ if ($action == 'create')
|
||||
|
||||
$var = true;
|
||||
|
||||
print $formfile->showdocuments('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
|
||||
print $formfile->showdocuments('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||
|
||||
@ -396,6 +396,7 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -3310,8 +3310,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
|
||||
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,';
|
||||
$sql.= ' pt.fk_unit,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
|
||||
$sql.= ' p.description as product_desc,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.description as product_desc, p.tobatch as product_tobatch,';
|
||||
$sql.= ' p.entity,';
|
||||
$sql.= ' pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
|
||||
@ -3342,6 +3341,7 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->product_tobatch = $obj->product_tobatch;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type; // deprecated
|
||||
$this->lines[$i]->product_type = $obj->product_type;
|
||||
$this->lines[$i]->qty = $obj->qty;
|
||||
@ -3681,7 +3681,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0;
|
||||
if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0;
|
||||
if (empty($this->multicurrency_total_vat)) $this->multicurrency_total_vat=0;
|
||||
if (empty($this->multicurrency_total_tva)) $this->multicurrency_total_tva=0;
|
||||
if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0;
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
|
||||
@ -556,6 +556,7 @@ if ($resql)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Fields title
|
||||
@ -1003,6 +1004,7 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
|
||||
@ -35,27 +35,44 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("propal");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
$ilink++;
|
||||
$var=!$var;
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("Proposal"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td align="center"></td>
|
||||
<td align="center"></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
||||
@ -44,9 +44,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/order.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
if (! empty($conf->propal->enabled))
|
||||
require DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
@ -103,7 +103,6 @@ $permissiondellink = $user->rights->commande->creer; // Used by the include of
|
||||
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -114,8 +113,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel) $action='';
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
if ($action != 'addlink')
|
||||
{
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
if ($id > 0 || ! empty($ref)) $ret = $object->fetch($id,$ref);
|
||||
$action='';
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
@ -749,7 +758,7 @@ if (empty($reshook))
|
||||
$pu_ht = price($prodcustprice->lines [0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines [0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
$tva_tx = $prodcustprice->lines [0]->tva_tx;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1744,7 +1753,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
@ -2038,7 +2047,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
} else {
|
||||
// Remise dispo de type remise fixe (not credit note)
|
||||
print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount);
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filterabsolutediscount, 0, '', 1);
|
||||
}
|
||||
}
|
||||
if ($absolute_creditnote) {
|
||||
@ -2227,7 +2236,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Origin
|
||||
// Source reason (why we have an ordrer)
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Source');
|
||||
@ -2241,12 +2250,26 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
} else {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
|
||||
}
|
||||
// Removed because using dictionary is an admin feature, not a user feature. There is already the "star" to show info to admin users.
|
||||
// This is to avoid too heavy screens and have an uniform look and feel for all screens.
|
||||
// print '</td><td>';
|
||||
// print '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=22&origin=order&originid='.$object->id.'">'.$langs->trans("DictionarySource").'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO Order mode (how we receive order). Not yet implemented
|
||||
/*
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('SourceMode');
|
||||
print '</td>';
|
||||
if ($action != 'editinputmode')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinputmode&id=' . $object->id . '">' . img_edit($langs->trans('SetInputMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editinputmode') {
|
||||
$form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1);
|
||||
} else {
|
||||
$form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
$tmparray=$object->getTotalWeightVolume();
|
||||
$totalWeight=$tmparray['weight'];
|
||||
$totalVolume=$tmparray['volume'];
|
||||
@ -2503,13 +2526,13 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfProductsLines() > 0) {
|
||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) {
|
||||
if ($user->rights->expedition->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expedition/shipment.php?id=' . $object->id . '">' . $langs->trans('ShipProduct') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/expedition/shipment.php?id=' . $object->id . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('ShipProduct') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")) . '">' . $langs->trans('ShipProduct') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,6 +432,7 @@ class CommandeApi extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -371,7 +371,7 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
|
||||
if ($updateRes == 1) {
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id);
|
||||
}
|
||||
return false;
|
||||
@ -399,6 +399,7 @@ class Orders extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public $availability;
|
||||
|
||||
public $demand_reason_id;
|
||||
public $demand_reason_id; // Source reason. Why we receive order (after a phone campaign, ...)
|
||||
public $demand_reason_code;
|
||||
public $address;
|
||||
public $date; // Date commande
|
||||
@ -123,14 +123,14 @@ class Commande extends CommonOrder
|
||||
* @see date
|
||||
*/
|
||||
public $date_commande;
|
||||
public $date_livraison; // Date livraison souhaitee
|
||||
public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
|
||||
public $fk_remise_except;
|
||||
public $remise_percent;
|
||||
public $remise_absolue;
|
||||
public $info_bits;
|
||||
public $rang;
|
||||
public $special_code;
|
||||
public $source; // Origin of order
|
||||
public $source; // Order mode. How we received order (by phone, by email, ...)
|
||||
public $extraparams=array();
|
||||
|
||||
public $linked_objects=array();
|
||||
@ -875,54 +875,70 @@ class Commande extends CommonOrder
|
||||
$this->ref = $initialref;
|
||||
|
||||
// Add object linked
|
||||
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||
{
|
||||
foreach($this->linked_objects as $origin => $origin_id)
|
||||
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked($origin, $origin_id);
|
||||
if (! $ret)
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
$originforcontact = $origin;
|
||||
$originidforcontact = $origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($db);
|
||||
$exp->fetch($origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
{
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
$originidforcontact = $value->id;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $this->db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
{
|
||||
foreach($tmp_origin_id as $origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked($origin, $origin_id);
|
||||
if (! $ret)
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||
{
|
||||
$origin_id = $tmp_origin_id;
|
||||
$ret = $this->add_object_linked($origin, $origin_id);
|
||||
if (! $ret)
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||
{
|
||||
$originforcontact = $this->origin;
|
||||
$originidforcontact = $this->origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($db);
|
||||
$exp->fetch($this->origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
{
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
$originidforcontact = $value->id;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $this->db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -1741,7 +1757,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
|
||||
$sql.= ' l.fk_unit,';
|
||||
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,';
|
||||
$sql.= ' p.weight, p.weight_units, p.volume, p.volume_units';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
||||
@ -1801,6 +1817,7 @@ class Commande extends CommonOrder
|
||||
$line->libelle = $objp->product_label;
|
||||
$line->product_label = $objp->product_label;
|
||||
$line->product_desc = $objp->product_desc;
|
||||
$line->product_tobatch = $objp->product_tobatch;
|
||||
$line->fk_product_type = $objp->fk_product_type; // Produit ou service
|
||||
$line->fk_unit = $objp->fk_unit;
|
||||
|
||||
@ -3765,7 +3782,7 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,';
|
||||
$sql.= ' cd.fk_unit,';
|
||||
$sql.= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc, p.tobatch as product_tobatch,';
|
||||
$sql.= ' cd.date_start, cd.date_end';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
@ -3810,7 +3827,8 @@ class OrderLine extends CommonOrderLine
|
||||
$this->libelle = $objp->product_libelle; // deprecated
|
||||
$this->product_label = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
$this->product_tobatch = $objp->product_tobatch;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
@ -3828,6 +3846,7 @@ class OrderLine extends CommonOrderLine
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -845,7 +845,8 @@ if ($resql)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
@ -1421,9 +1422,8 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
print '<br />';
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
//print '<br>'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'<br>';
|
||||
|
||||
@ -24,41 +24,60 @@
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("orders");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
$ilink++;
|
||||
$var=!$var;
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right">
|
||||
<?php
|
||||
// For now, shipments must stay linked to order, so link is not deletable
|
||||
if($object->element != 'shipping') {
|
||||
?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("CustomerOrder"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right">
|
||||
<?php
|
||||
// For now, shipments must stay linked to order, so link is not deletable
|
||||
if($object->element != 'shipping') {
|
||||
?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td align="center"></td>
|
||||
<td align="center"></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -32,6 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width',768);
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',200);
|
||||
|
||||
$id=GETPOST('account')?GETPOST('account','alpha'):GETPOST('id');
|
||||
$ref=GETPOST('ref');
|
||||
|
||||
@ -53,6 +56,12 @@ else
|
||||
$year_end=$year_start+2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("IOMonthlyReporting");
|
||||
$helpurl = "";
|
||||
llxHeader('',$title,$helpurl);
|
||||
@ -276,10 +285,6 @@ if ($result < 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Definition de $width et $height
|
||||
$width = 480;
|
||||
$height = 300;
|
||||
|
||||
// Calcul de $min et $max
|
||||
$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -374,8 +379,8 @@ else
|
||||
$px1->SetMaxValue($px1->GetCeilMaxValue()<0?0:$px1->GetCeilMaxValue());
|
||||
$px1->SetMinValue($px1->GetFloorMinValue()>0?0:$px1->GetFloorMinValue());
|
||||
$px1->SetTitle($title);
|
||||
$px1->SetWidth($width);
|
||||
$px1->SetHeight($height);
|
||||
$px1->SetWidth($WIDTH);
|
||||
$px1->SetHeight($HEIGHT);
|
||||
$px1->SetType(array('line','line','line'));
|
||||
$px1->SetShading(3);
|
||||
$px1->setBgColor('onglet');
|
||||
@ -461,8 +466,8 @@ else
|
||||
$px2->SetMaxValue($px2->GetCeilMaxValue()<0?0:$px2->GetCeilMaxValue());
|
||||
$px2->SetMinValue($px2->GetFloorMinValue()>0?0:$px2->GetFloorMinValue());
|
||||
$px2->SetTitle($title);
|
||||
$px2->SetWidth($width);
|
||||
$px2->SetHeight($height);
|
||||
$px2->SetWidth($WIDTH);
|
||||
$px2->SetHeight($HEIGHT);
|
||||
$px2->SetType(array('line','line','line'));
|
||||
$px2->SetShading(3);
|
||||
$px2->setBgColor('onglet');
|
||||
|
||||
@ -526,6 +526,9 @@ if ($page >= $nbtotalofpages)
|
||||
if ($page < 0) $page = 0;
|
||||
}
|
||||
|
||||
// If not account defined $mode_balance_ok=false
|
||||
if (empty($account)) $mode_balance_ok=false;
|
||||
// If a search is done $mode_balance_ok=false
|
||||
if (! empty($search_ref)) $mode_balance_ok=false;
|
||||
if (! empty($req_nb)) $mode_balance_ok=false;
|
||||
if (! empty($type)) $mode_balance_ok=false;
|
||||
@ -674,7 +677,7 @@ if ($resql)
|
||||
}
|
||||
|
||||
|
||||
/// ajax adjust value date
|
||||
/// ajax to adjust value date with plus and less picto
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
@ -725,18 +728,18 @@ if ($resql)
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('DateOperationShort').' : ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('From') . ' ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= ' - ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
//$moreforfilter .= ' - ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter .= $langs->trans('DateValueShort').' : ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('From') . ' ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('From') . ' ';
|
||||
$moreforfilter .= $form->select_date($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= ' - ';
|
||||
$moreforfilter .= '<div class="nowrap inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
//$moreforfilter .= ' - ';
|
||||
$moreforfilter .= '<div class="nowrap'.($conf->browser->layout=='phone'?' centpercent':'').' inline-block">'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'</div>';
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
$parameters=array();
|
||||
@ -754,7 +757,8 @@ if ($resql)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
@ -878,6 +882,12 @@ if ($resql)
|
||||
// If we are in a situation where we need/can show balance, we calculate the start of balance
|
||||
if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok)
|
||||
{
|
||||
if (! $account)
|
||||
{
|
||||
dol_print_error('', 'account is not defined but $mode_balance_ok is true');
|
||||
exit;
|
||||
}
|
||||
|
||||
//Loop on each record
|
||||
$sign = 1;
|
||||
$i = 0;
|
||||
@ -1080,7 +1090,7 @@ if ($resql)
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv),"day")."</span>";
|
||||
print ' ';
|
||||
print '<span>';
|
||||
print '<span class="inline-block">';
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
print img_edit_remove() . "</a> ";
|
||||
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&account='.$objp->bankid.'&rowid='.$objp->rowid.'">';
|
||||
@ -1286,6 +1296,8 @@ if ($resql)
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
|
||||
print '</form>';
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
@ -388,7 +388,7 @@ if ($action == 'create')
|
||||
print '<td colspan="3">';
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -840,11 +840,11 @@ else
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
|
||||
print '<td><input size="30" type="text" class="flat" name="label" value="'.(isset($_POST["label"])?$_POST["label"]:$object->label).'"></td></tr>';
|
||||
print '<td><input type="text" class="flat minwidth300" name="label" value="'.(isset($_POST["label"])?$_POST["label"]:$object->label).'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
$formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$object->type),"type");
|
||||
print '</td></tr>';
|
||||
|
||||
@ -852,7 +852,7 @@ else
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
|
||||
print '<input type="hidden" value="'.$object->currency_code.'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
$selectedcode=$object->currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
|
||||
@ -862,8 +862,8 @@ else
|
||||
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray("clos", $object->status,(isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
print $form->selectarray("clos", $object->status, (isset($_POST["clos"])?$_POST["clos"]:$object->clos));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
@ -874,13 +874,13 @@ else
|
||||
$object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||
print '<td>';
|
||||
print '<td class="maxwidth200onsmartphone">';
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
|
||||
if ($selectedcode)
|
||||
{
|
||||
print $formcompany->select_state(isset($_POST["account_state_id"])?$_POST["account_state_id"]:$object->state_id,$selectedcode,'account_state_id');
|
||||
@ -909,7 +909,7 @@ else
|
||||
|
||||
// Web
|
||||
print '<tr><td>'.$langs->trans("Web").'</td>';
|
||||
print '<td><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$object->url).'">';
|
||||
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$object->url).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Tags-Categories
|
||||
@ -931,7 +931,7 @@ else
|
||||
print '<td>';
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$object->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_4,'95%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1020,22 +1020,22 @@ else
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$object->iban.'"></td></tr>';
|
||||
print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.$object->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.'"></td></tr>';
|
||||
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
|
||||
print $object->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td><input size="30" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
|
||||
print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
|
||||
print $object->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ class Account extends CommonObject
|
||||
|
||||
$this->status = array(
|
||||
self::STATUS_OPEN => $langs->trans("StatusAccountOpened"),
|
||||
self::STATUS_CLOSED => $langs->trans("StatusAccountOpened")
|
||||
self::STATUS_CLOSED => $langs->trans("StatusAccountClosed")
|
||||
);
|
||||
}
|
||||
|
||||
@ -848,6 +848,7 @@ class Account extends CommonObject
|
||||
$sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
|
||||
$sql.= " ba.account_number, ba.accountancy_journal, ba.currency_code,";
|
||||
$sql.= " ba.min_allowed, ba.min_desired, ba.comment,";
|
||||
$sql.= " ba.datec as date_creation, ba.tms as date_update,";
|
||||
$sql.= ' c.code as country_code, c.label as country,';
|
||||
$sql.= ' d.code_departement as state_code, d.nom as state';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
@ -903,6 +904,9 @@ class Account extends CommonObject
|
||||
$this->min_desired = $obj->min_desired;
|
||||
$this->comment = $obj->comment;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_update = $this->db->jdate($obj->date_update);
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
@ -910,7 +914,6 @@ class Account extends CommonObject
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -1221,8 +1224,9 @@ class Account extends CommonObject
|
||||
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
$langs->load("accountancy");
|
||||
$label .= '<br><b>' . $langs->trans('AccountAccounting') . ':</b> ' . $this->account_number;
|
||||
$label .= '<br><b>' . $langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
|
||||
$label .= '<br><b>' . $langs->trans('AccountancyJournal') . ':</b> ' . $this->accountancy_journal;
|
||||
}
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
|
||||
@ -70,7 +70,7 @@ class BankAccounts extends DolibarrApi
|
||||
}
|
||||
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('banque', 1).')';
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('bank_account', 1).')';
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
@ -185,6 +185,7 @@ class BankAccounts extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$account->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
@ -82,9 +83,10 @@ $fieldstosearchall = array(
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'b.ref'=>array('label'=>$langs->trans("BankAccounts"), 'checked'=>1),
|
||||
'accountype'=>array('label'=>$langs->trans("AccountType"), 'checked'=>1),
|
||||
'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
|
||||
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled),
|
||||
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
|
||||
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
@ -137,7 +139,7 @@ $title=$langs->trans('BankAccounts');
|
||||
// Load array of financial accounts (opened by default)
|
||||
$accounts = array();
|
||||
|
||||
$sql = "SELECT rowid, label, courant, rappro";
|
||||
$sql = "SELECT rowid, label, courant, rappro, account_number, datec as date_creation, tms as date_update";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
@ -272,8 +274,9 @@ if (! empty($moreforfilter))
|
||||
}
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Fields title
|
||||
@ -282,9 +285,8 @@ if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titr
|
||||
if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -301,6 +303,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'],$_SERVER["PHP_SELF"],"b.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'],$_SERVER["PHP_SELF"],"b.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -333,6 +339,12 @@ if (! empty($arrayfields['b.number']['checked']))
|
||||
print '<input class="flat" size="6" type="text" name="search_number" value="'.$search_number.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Number
|
||||
if (! empty($arrayfields['b.account_number']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Transactions to reconcile
|
||||
if (! empty($arrayfields['toreconcile']['checked']))
|
||||
{
|
||||
@ -390,7 +402,10 @@ if (! empty($arrayfields['b.clos']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
// Balance
|
||||
print '<td></td>';
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
@ -400,28 +415,62 @@ print '</tr>';
|
||||
|
||||
|
||||
|
||||
$total = array(); $found = 0;
|
||||
$total = array(); $found = 0; $i=0;
|
||||
$var=true;
|
||||
foreach ($accounts as $key=>$type)
|
||||
{
|
||||
//if ($type == 1)
|
||||
//{
|
||||
$found++;
|
||||
$found++;
|
||||
|
||||
$acc = new Account($db);
|
||||
$acc->fetch($key);
|
||||
$acc = new Account($db);
|
||||
$acc->fetch($key);
|
||||
|
||||
$var = !$var;
|
||||
$solde = $acc->solde(1);
|
||||
$var = !$var;
|
||||
$solde = $acc->solde(1);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.ref']['checked']))
|
||||
{
|
||||
print '<td class="titlefield">'.$acc->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['b.label']['checked']))
|
||||
{
|
||||
print '<td>'.$acc->label.'</td>';
|
||||
print '<td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account type
|
||||
if (! empty($arrayfields['accountype']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $acc->type_lib[$acc->type];
|
||||
print '</td>';
|
||||
print '<td>'.$acc->number.'</td>';
|
||||
print '<td align="center">';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Number
|
||||
if (! empty($arrayfields['b.number']['checked']))
|
||||
{
|
||||
print '<td>'.$acc->number.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account number
|
||||
if (! empty($arrayfields['b.account_number']['checked']))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
print '<td>'.length_accountg($acc->account_number).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Transactions to reconcile
|
||||
if (! empty($arrayfields['toreconcile']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($acc->rappro)
|
||||
{
|
||||
$result=$acc->load_board($user,$acc->id);
|
||||
@ -433,38 +482,111 @@ foreach ($accounts as $key=>$type)
|
||||
}
|
||||
}
|
||||
else print $langs->trans("FeatureDisabled");
|
||||
print '</td>';
|
||||
// Status
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
print '<td';
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
if ($align) print ' align="'.$align.'"';
|
||||
print '>';
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['b.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($acc->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['b.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($acc->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Statut
|
||||
if (! empty($arrayfields['b.clos']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$acc->getLibStatut(5).'</td>';
|
||||
//
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bankentries.php?id='.$acc->id.'">'.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).'</a>';
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$acc->id.'">'.price($solde, 0, $langs, 0, 0, -1, $acc->currency_code).'</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];
|
||||
$totalarray['totalbalance'] += $solde;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
|
||||
$total[$acc->currency_code] += $solde;
|
||||
//}
|
||||
$total[$acc->currency_code] += $solde;
|
||||
|
||||
$i++;
|
||||
}
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="'.$totalarray['nbfield'].'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totalbalancefield']))
|
||||
{
|
||||
print '<tr class="liste_total"><td colspan="6" class="liste_total">'.$langs->trans("Total").' '.$key.'</td><td align="right" class="liste_total">'.price($solde, 0, $langs, 0, 0, -1, $key).'</td><td></td></tr>';
|
||||
print '<tr class="liste_total">';
|
||||
$i=0;
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totalbalancefield'] == $i) print '<td align="right">'.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $key).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "</div>";
|
||||
|
||||
print "</form>";
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -134,7 +134,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$sql.= " cs.rowid, cs.libelle, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total,";
|
||||
$sql.= " pc.rowid as pid, pc.datep, pc.amount as totalpaye, pc.num_paiement as num_payment, pc.fk_bank,";
|
||||
$sql.= " pct.code as payment_code,";
|
||||
$sql.= " ba.rowid as bid, ba.label as blabel";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid";
|
||||
@ -205,6 +205,10 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->ref=$obj->bref;
|
||||
$accountstatic->number=$obj->bnumber;
|
||||
$accountstatic->accountancy_number=$obj->account_number;
|
||||
$accountstatic->accountancy_journal=$obj->accountancy_journal;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
@ -249,8 +253,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
|
||||
print load_fiche_titre($langs->trans("VATPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm";
|
||||
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,";
|
||||
$sql.= " pct.code as payment_code,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."tva as pv";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
|
||||
$sql.= " WHERE pv.entity = ".$conf->entity;
|
||||
if ($year > 0)
|
||||
{
|
||||
@ -273,6 +282,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
@ -295,15 +306,45 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
$tva_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$tva_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
|
||||
// Type payment
|
||||
print '<td>';
|
||||
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||
print $obj->num_payment.'</td>';
|
||||
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->ref=$obj->bref;
|
||||
$accountstatic->number=$obj->bnumber;
|
||||
$accountstatic->accountancy_number=$obj->account_number;
|
||||
$accountstatic->accountancy_journal=$obj->accountancy_journal;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Paid
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
@ -426,8 +467,14 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
|
||||
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, u.salary as current_salary";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,";
|
||||
$sql.= " pct.code as payment_code,";
|
||||
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('user',1).")";
|
||||
$sql.= " AND u.rowid = s.fk_user";
|
||||
if ($year > 0)
|
||||
@ -449,6 +496,8 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
$var=1;
|
||||
@ -470,13 +519,40 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
|
||||
$sal_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
// Date
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
|
||||
// Type payment
|
||||
print '<td>';
|
||||
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
|
||||
print $obj->num_payment.'</td>';
|
||||
|
||||
// Account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->fk_bank > 0)
|
||||
{
|
||||
//$accountstatic->fetch($obj->fk_bank);
|
||||
$accountstatic->id=$obj->bid;
|
||||
$accountstatic->ref=$obj->bref;
|
||||
$accountstatic->number=$obj->bnumber;
|
||||
$accountstatic->accountancy_number=$obj->account_number;
|
||||
$accountstatic->accountancy_journal=$obj->accountancy_journal;
|
||||
$accountstatic->label=$obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Paid
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td colspan="6">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print "</tr>";
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ if ($action == 'create')
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8,'90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
@ -291,7 +291,7 @@ if ($action == 'create')
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
@ -376,7 +376,7 @@ else if ($id)
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print "</td></tr>";
|
||||
@ -387,7 +387,7 @@ else if ($id)
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
@ -1454,7 +1454,7 @@ if (empty($reshook))
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Remise dispo de type remise fixe (not credit note)
|
||||
$filter='fk_facture_source IS NULL';
|
||||
print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount);
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id',$soc->id, $absolute_discount, $filter, $resteapayer, ' - '.$addabsolutediscount, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Remise dispo de type avoir
|
||||
$filter='fk_facture_source IS NOT NULL';
|
||||
if (! $absolute_discount) print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer);
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filter, $resteapayer, '', 1);
|
||||
}
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote)
|
||||
|
||||
@ -232,6 +232,7 @@ class InvoiceApi extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->invoice->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -229,6 +229,7 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->invoice->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
@ -409,7 +409,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||
{
|
||||
if (is_array($tmp_origin_id)) // New baheviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
{
|
||||
foreach($tmp_origin_id as $origin_id)
|
||||
{
|
||||
@ -431,44 +431,44 @@ class Facture extends CommonInvoice
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||
{
|
||||
$originforcontact = $origin;
|
||||
$originidforcontact = $origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($this->db);
|
||||
$exp->fetch($origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
{
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
$originidforcontact = $value->id;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $this->db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||
{
|
||||
$originforcontact = $this->origin;
|
||||
$originidforcontact = $this->origin_id;
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($this->db);
|
||||
$exp->fetch($this->origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
{
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
{
|
||||
$originforcontact = 'commande';
|
||||
$originidforcontact = $value->id;
|
||||
break; // We take first one
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||
|
||||
$resqlcontact = $this->db->query($sqlcontact);
|
||||
if ($resqlcontact)
|
||||
{
|
||||
while($objcontact = $this->db->fetch_object($resqlcontact))
|
||||
{
|
||||
//print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
|
||||
$this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
|
||||
}
|
||||
}
|
||||
else dol_print_error($resqlcontact);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert lines of invoices into database
|
||||
@ -999,11 +999,12 @@ class Facture extends CommonInvoice
|
||||
* @param int $short 1=Return just URL
|
||||
* @param string $moretitle Add more text to title tooltip
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $addlinktonotes 1=Add link to notes
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0)
|
||||
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
global $langs, $conf, $user, $form;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
@ -1058,6 +1059,21 @@ class Facture extends CommonInvoice
|
||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$linkstart.($max?dol_trunc($this->ref,$max):$this->ref).$linkend;
|
||||
|
||||
if ($addlinktonotes)
|
||||
{
|
||||
$txttoshow=($user->societe_id>0?$this->note_public:$this->note_private);
|
||||
if ($txttoshow)
|
||||
{
|
||||
$notetoshow=$langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow,1);
|
||||
$result.=' <span class="note inline-block">';
|
||||
$result.='<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">'.img_picto('','object_generic').'</a>';
|
||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
||||
//$result.='</a>';
|
||||
$result.='</span>';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -1614,7 +1630,7 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* Delete invoice
|
||||
*
|
||||
* @param User $user User to delete.
|
||||
* @param User $user User making the deletion.
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@ -2821,7 +2837,8 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function deleteline($rowid)
|
||||
{
|
||||
|
||||
global $user;
|
||||
|
||||
dol_syslog(get_class($this)."::deleteline rowid=".$rowid, LOG_DEBUG);
|
||||
|
||||
if (! $this->brouillon)
|
||||
@ -2847,13 +2864,14 @@ class Facture extends CommonInvoice
|
||||
}
|
||||
|
||||
$line=new FactureLigne($this->db);
|
||||
|
||||
|
||||
$line->context = $this->context;
|
||||
|
||||
// For triggers
|
||||
$line->fetch($rowid);
|
||||
|
||||
if ($line->delete() > 0)
|
||||
$result = $line->fetch($rowid);
|
||||
if (! ($result > 0)) dol_print_error($db, $line->error, $line->errors);
|
||||
|
||||
if ($line->delete($user) > 0)
|
||||
{
|
||||
$result=$this->update_price(1);
|
||||
|
||||
@ -4208,13 +4226,13 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
|
||||
$sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
|
||||
$sql.= ' fd.fk_code_ventilation,';
|
||||
$sql.= ' fd.fk_unit,';
|
||||
$sql.= ' fd.fk_unit, fd.fk_user_author, fd.fk_user_modif,';
|
||||
$sql.= ' fd.situation_percent, fd.fk_prev_id,';
|
||||
$sql.= ' fd.multicurrency_subprice,';
|
||||
$sql.= ' fd.multicurrency_total_ht,';
|
||||
$sql.= ' fd.multicurrency_total_tva,';
|
||||
$sql.= ' fd.multicurrency_total_ttc,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
|
||||
$sql.= ' , fd.multicurrency_subprice';
|
||||
$sql.= ' , fd.multicurrency_total_ht';
|
||||
$sql.= ' , fd.multicurrency_total_tva';
|
||||
$sql.= ' , fd.multicurrency_total_ttc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||
$sql.= ' WHERE fd.rowid = '.$rowid;
|
||||
@ -4261,7 +4279,9 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$this->product_label = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
$this->fk_user_modif = $objp->fk_user_modif;
|
||||
$this->fk_user_author = $objp->fk_user_author;
|
||||
|
||||
$this->situation_percent = $objp->situation_percent;
|
||||
$this->fk_prev_id = $objp->fk_prev_id;
|
||||
|
||||
@ -4276,6 +4296,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -4361,8 +4382,8 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
|
||||
$sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,';
|
||||
$sql.= ' situation_percent, fk_prev_id,';
|
||||
$sql.= ' fk_unit';
|
||||
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||
$sql.= ' fk_unit, fk_user_author, fk_user_modif,';
|
||||
$sql.= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||
$sql.= ')';
|
||||
$sql.= " VALUES (".$this->fk_facture.",";
|
||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
||||
@ -4393,9 +4414,11 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= " ".price2num($this->total_ttc).",";
|
||||
$sql.= " ".price2num($this->total_localtax1).",";
|
||||
$sql.= " ".price2num($this->total_localtax2);
|
||||
$sql .= ", " . $this->situation_percent;
|
||||
$sql .= ", " . $this->fk_prev_id;
|
||||
$sql .= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql.= ", " . $this->situation_percent;
|
||||
$sql.= ", " . $this->fk_prev_id;
|
||||
$sql.= ", ".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".$user->id;
|
||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||
$sql.= ", ".price2num($this->multicurrency_subprice);
|
||||
@ -4581,6 +4604,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||
$sql.= ", situation_percent=" . $this->situation_percent;
|
||||
$sql.= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql.= ", fk_user_modif =".$user->id;
|
||||
|
||||
// Multicurrency
|
||||
$sql.= ", multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
|
||||
@ -4628,8 +4652,9 @@ class FactureLigne extends CommonInvoiceLine
|
||||
|
||||
/**
|
||||
* Delete line in database
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* TODO Add param User $user and notrigger (see skeleton)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
|
||||
@ -40,6 +40,7 @@ if (! empty($conf->projet->enabled)) {
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('compta');
|
||||
$langs->load('admin');
|
||||
|
||||
// Security check
|
||||
$id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'));
|
||||
@ -504,7 +505,7 @@ if (empty($reshook))
|
||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||
$prod->tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
$tva_tx = $prodcustprice->lines[0]->tva_tx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -711,11 +712,11 @@ if (empty($reshook))
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
{
|
||||
// Get extra fields
|
||||
foreach ($extralabelsline as $key => $value)
|
||||
{
|
||||
unset($_POST["options_" . $key]);
|
||||
{
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1609,7 +1610,10 @@ else
|
||||
print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'<br><br>';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||
@ -1779,6 +1783,9 @@ else
|
||||
else print '<tr '.$bc[false].'><td colspan="9" class="opacitymedium">'.$langs->trans("NoneF").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print "</form>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@ -636,7 +636,8 @@ if ($resql)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
|
||||
@ -866,30 +867,25 @@ if ($resql)
|
||||
$facturestatic->statut=$obj->fk_statut;
|
||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||
$facturestatic->type=$obj->type;
|
||||
$facturestatic->note_public=$obj->note_public;
|
||||
$facturestatic->note_private=$obj->note_private;
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
||||
$paiement = $facturestatic->getSommePaiement();
|
||||
$remaintopay = $obj->total_ttc - $paiement;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
|
||||
print $facturestatic->getNomUrl(1,'',200,0,'',0,1);
|
||||
print $obj->increment;
|
||||
print '</td>';
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if (! empty($obj->note_private))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/note.php?id='.$obj->facid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
$filename=dol_sanitizeFileName($obj->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->facid;
|
||||
@ -1140,6 +1136,7 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ if ($object->id > 0)
|
||||
// Remise dispo de type non avoir
|
||||
$filter='fk_facture_source IS NULL';
|
||||
print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer);
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$object->thirdparty->id,$absolute_discount,$filter,$resteapayer,'',1);
|
||||
}
|
||||
}
|
||||
if ($absolute_creditnote > 0)
|
||||
@ -283,7 +283,7 @@ if ($object->id > 0)
|
||||
// Remise dispo de type avoir
|
||||
$filter='fk_facture_source IS NOT NULL';
|
||||
if (! $absolute_discount) print '<br>';
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer);
|
||||
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id_for_payment',$object->thirdparty->id,$absolute_creditnote,$filter,$resteapayer,'',1);
|
||||
}
|
||||
}
|
||||
if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
|
||||
|
||||
@ -24,32 +24,60 @@
|
||||
<?php
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
$langs = $GLOBALS['langs'];
|
||||
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$total=0; $ilink=0;
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
$ilink++;
|
||||
$var=!$var;
|
||||
$trclass=($var?'pair':'impair');
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<tr class="<?php echo $trclass; ?>">
|
||||
<td><?php echo $langs->trans("CustomerInvoice"); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$sign = 1;
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
|
||||
if ($objectlink->statut != 3) // If not abandonned
|
||||
{
|
||||
$total = $total + $sign * $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<strike>'.price($objectlink->total_ht).'</strike>';
|
||||
}
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter)?'liste_sub_total':''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td align="center"></td>
|
||||
<td align="center"></td>
|
||||
<td align="right"><?php echo price($total); ?></td>
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user