Merge pull request #4 from Dolibarr/develop

Update dev version
This commit is contained in:
tomours 2015-08-24 09:39:47 +02:00
commit eae22c04c0
121 changed files with 2067 additions and 1137 deletions

View File

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

View File

@ -26,6 +26,7 @@ php-iban 1.4.6 LGPL-3+ Yes
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.6 LGPL-3+ Yes PDF generation TCPDF 6.2.6 LGPL-3+ Yes PDF generation
EvalMath 1.0 BSD Yes Safe math expressions evaluation
JS libraries: JS libraries:
jQuery 1.11.3 MIT License Yes JS library jQuery 1.11.3 MIT License Yes JS library

View File

@ -224,7 +224,7 @@ Dolibarr better:
hook afterLogin or afterLoginFailed instead. hook afterLogin or afterLoginFailed instead.
- The trigger USER_CREATE_FROM_CONTACT has been replace with USER_CREATE and property context is now filled - The trigger USER_CREATE_FROM_CONTACT has been replace with USER_CREATE and property context is now filled
to make difference between creation from contact or not. to make difference between creation from contact or not.
- Function get_exdir require now 6 parameters. This is to prepare a future feature.
***** ChangeLog for 3.7.2 compared to 3.7.1 ***** ***** ChangeLog for 3.7.2 compared to 3.7.1 *****
FIX [ bug #2855 ] Wrong translation key in localtax report page FIX [ bug #2855 ] Wrong translation key in localtax report page
@ -235,6 +235,10 @@ FIX [ bug 1634 ] Error deleting a project when it had many linked objects
FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly
FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne
FIX: Not showing delivery date on rouget pdf FIX: Not showing delivery date on rouget pdf
FIX: Not showing task extrafields when creating from left menu
FIX [ bug #3288 ] Tasks box is not properly drawn
FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts
FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights
NEW: Created new ContratLigne::insert function NEW: Created new ContratLigne::insert function
@ -496,6 +500,8 @@ Dolibarr better:
- Fix: [ bug #2696 ] Adding complementary attribute fails if code is numerics - Fix: [ bug #2696 ] Adding complementary attribute fails if code is numerics
- Fix: [ bug #3074 ] Accruals accounting use payment date instead of commitment date in turnover reports for salaries - Fix: [ bug #3074 ] Accruals accounting use payment date instead of commitment date in turnover reports for salaries
- Fix: Not showing product supplier reference when page break - Fix: Not showing product supplier reference when page break
- Fix: [ bug #3341 ] Missing translation in /compta/paiement_charge.php
- Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate
***** ChangeLog for 3.6.2 compared to 3.6.1 ***** ***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
@ -680,6 +686,9 @@ Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter
Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result
Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled
Fix: [ bug #3310 ] OrderLine::fetch, FactureLigne::fetch and PropaleLigne::fetch do not return anything
Fix: [ bug #3206 ] PropaleLigne, OrderLine and FactureLigne given to triggers through update function does not contain all the information
Fix: [ bug #3313 ] Error enabling module with PostgreSQL database
***** ChangeLog for 3.5.6 compared to 3.5.5 ***** ***** ChangeLog for 3.5.6 compared to 3.5.5 *****
Fix: Avoid missing class error for fetch_thirdparty method #1973 Fix: Avoid missing class error for fetch_thirdparty method #1973

View File

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

View File

@ -117,7 +117,7 @@ http://bugs.debian.org/package
severity 123 xxx severity 123 xxx
##### Update but tracker system ##### Update bug tracker system
To set status of a bug to "pending" To set status of a bug to "pending"
> bts --smtp-host=yoursmtpserver tag 999999 +pending > bts --smtp-host=yoursmtpserver tag 999999 +pending
@ -249,7 +249,7 @@ from git clone dir and make link to git.
* If local branch upstream and pristine-tar does not exists, create it * If local branch upstream and pristine-tar does not exists, create it
from origin/upstream and origin/pristine. from origin/upstream and origin/pristine.
* If new upstream is available onto sourceforge, launch: * When new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh > debian/get-orig-source.sh
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this. If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this.
@ -273,8 +273,8 @@ Note: If there was errors solved manually after get-orig-sources.sh, you may nee
* Fix debian/* files used to build package. * Fix debian/* files used to build package.
Add an entry into debian/changelog Add an entry into debian/changelog
> dch -v x.y.z+dfsgw-v "My comment" will add entry. > dch -v x.y.z+dfsgw-v "My comment" will add entry.
For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import) For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increased for each new import)
Then modify changelog to replace "version" or "unstable" with "UNRELEASED". Then check/modify changelog to replace "version" or "unstable" with "UNRELEASED".
Then check/modify also the user/date signature: Then check/modify also the user/date signature:
- Date must have format reported by "date -R" - Date must have format reported by "date -R"
- Name and email must match value into debian/control file (Entry added here is used by next step). - Name and email must match value into debian/control file (Entry added here is used by next step).
@ -299,7 +299,7 @@ Note: Package is built into directory ../build-area
* If package .deb is ok: * If package .deb is ok:
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
> git push --all ou git push origin --all > git push --all
* If ok, you can tag. * If ok, you can tag.
> Edit debian/changelog to replace "UNRELEASED" into "unstable", then push > Edit debian/changelog to replace "UNRELEASED" into "unstable", then push

View File

@ -1,7 +1,7 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# \file dolibarr.pl # \file dolibarr.pl
# \brief Dolibarr script install for Virtualmin Pro # \brief Dolibarr script install for Virtualmin Pro
# \author (c)2009-2012 Regis Houssin <regis.houssin@capnetworks.com> # \author (c)2009-2015 Regis Houssin <regis.houssin@capnetworks.com>
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -30,8 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions() # script_dolibarr_versions()
sub script_dolibarr_versions sub script_dolibarr_versions
{ {
# TODO Replace this with version of Dolibar we want to install return ( "3.7.2", "3.6.3", "3.5.6" );
return ( "x.y.z", "3.6.0");
} }
sub script_dolibarr_category sub script_dolibarr_category
@ -57,6 +56,26 @@ local ($d, $ver) = @_;
return ("mysql", "postgres"); return ("mysql", "postgres");
} }
# script_dolibarr_depends(&domain, version)
sub script_dolibarr_depends
{
local ($d, $ver, $sinfo, $phpver) = @_;
local @rv;
if ($ver >= 3.6) {
# Check for PHP 5.3+
local $phpv = &get_php_version($phpver || 5, $d);
if (!$phpv) {
push(@rv, "Could not work out exact PHP version");
}
elsif ($phpv < 5.3) {
push(@rv, "Dolibarr requires PHP version 5.3 or later");
}
}
return @rv;
}
# script_dolibarr_params(&domain, version, &upgrade-info) # script_dolibarr_params(&domain, version, &upgrade-info)
# Returns HTML for table rows for options for installing dolibarr # Returns HTML for table rows for options for installing dolibarr
sub script_dolibarr_params sub script_dolibarr_params
@ -78,8 +97,7 @@ else {
$rv .= &ui_table_row("Database for Dolibarr tables", $rv .= &ui_table_row("Database for Dolibarr tables",
&ui_database_select("db", undef, \@dbs, $d, "dolibarr")); &ui_database_select("db", undef, \@dbs, $d, "dolibarr"));
$rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>", $rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>",
&ui_opt_textbox("dir", "dolibarr", 30, &ui_opt_textbox("dir", &substitute_scriptname_template("dolibarr", $d), 30, "At top level"));
"At top level"));
if ($d->{'ssl'} && $ver >= 3.0) { if ($d->{'ssl'} && $ver >= 3.0) {
$rv .= &ui_table_row("Force https connection?", $rv .= &ui_table_row("Force https connection?",
&ui_yesno_radio("forcehttps", 0)); &ui_yesno_radio("forcehttps", 0));
@ -159,7 +177,8 @@ if ($opts->{'newdb'} && !$upgrade) {
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2); local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d); local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d);
local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1); local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1);
local $dbphptype = $dbtype eq "mysql" ? "mysqli" : "pgsql"; local $dbphptype = $dbtype eq "mysql" && $version >= 3.6 ? "mysql" :
$dbtype eq "mysql" ? "mysqli" : "pgsql";
local $dbhost = &get_database_host($dbtype); local $dbhost = &get_database_host($dbtype);
local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass); local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
return (0, "Database connection failed : $dberr") if ($dberr); return (0, "Database connection failed : $dberr") if ($dberr);
@ -201,12 +220,10 @@ if ($opts->{'path'} =~ /\w/) {
if (!$upgrade) { if (!$upgrade) {
local $cdef = "$opts->{'dir'}/conf/conf.php.example"; local $cdef = "$opts->{'dir'}/conf/conf.php.example";
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile)); &run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
&set_ownership_permissions(undef, undef, 0777, $cfiledir); &set_permissions_as_domain_user($d, 0777, $cfiledir);
&set_ownership_permissions(undef, undef, 0666, $cfile); &set_permissions_as_domain_user($d, 0666, $cfile);
&run_as_domain_user($d, "mkdir ".quotemeta($docdir)); &run_as_domain_user($d, "mkdir ".quotemeta($docdir));
&set_ownership_permissions(undef, undef, 0777, $docdir); &set_permissions_as_domain_user($d, 0777, $docdir);
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
&set_ownership_permissions(undef, undef, 0777, $altdir);
} }
else { else {
# Preserve old config file, documents and custom directory # Preserve old config file, documents and custom directory
@ -289,8 +306,8 @@ else {
local $dinstall = "$opts->{'dir'}/install"; local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
&set_ownership_permissions(undef, undef, 0644, $cfile); &set_permissions_as_domain_user($d, 0644, $cfile);
&set_ownership_permissions(undef, undef, 0755, $cfiledir); &set_permissions_as_domain_user($d, 0755, $cfiledir);
} }
# Return a URL for the user # Return a URL for the user
@ -309,6 +326,7 @@ local $ipage = $opts->{'path'}."/install/".$page.".php";
local ($iout, $ierror); local ($iout, $ierror);
&post_http_connection($d, $ipage, $params, \$iout, \$ierror); &post_http_connection($d, $ipage, $params, \$iout, \$ierror);
print STDERR $iout;
if ($ierror) { if ($ierror) {
return $ierror; return $ierror;
@ -329,10 +347,10 @@ local $derr = &delete_script_install_directory($d, $opts);
return (0, $derr) if ($derr); return (0, $derr) if ($derr);
# Remove all llx_ tables from the database # Remove all llx_ tables from the database
# 3 times because of constraints # 4 times because of constraints
&cleanup_script_database($d, $opts->{'db'}, "llx_"); for(my $i=0; $i<4; $i++) {
&cleanup_script_database($d, $opts->{'db'}, "llx_"); &cleanup_script_database($d, $opts->{'db'}, "llx_");
&cleanup_script_database($d, $opts->{'db'}, "llx_"); }
# Take out the DB # Take out the DB
if ($opts->{'newdb'}) { if ($opts->{'newdb'}) {

File diff suppressed because one or more lines are too long

View File

@ -222,10 +222,11 @@ class Skeleton_Class extends CommonObject
* @param int $limit offset limit * @param int $limit offset limit
* @param int $offset offset limit * @param int $offset offset limit
* @param array $filter filter array * @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($sortorder, $sortfield, $limit, $offset, array $filter = array()) public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
{ {
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -240,14 +241,19 @@ class Skeleton_Class extends CommonObject
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
foreach ($filter as $key => $value) { foreach ($filter as $key => $value) {
$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
} }
} }
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' AND ', $sqlwhere); $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
}
if (!empty($sortfield)) {
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
} }
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit($limit + 1, $offset);
$this->lines = array(); $this->lines = array();
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -615,7 +615,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i=0; $i=0;
foreach ($listfieldinsert as $f => $value) foreach ($listfieldinsert as $f => $value)
{ {
if ($value == 'price' || preg_match('/^amount/i',$value)) { if ($value == 'price' || preg_match('/^amount/i',$value) || preg_match('/^localtax/i',$value) || $value == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($value == 'entity') { else if ($value == 'entity') {
@ -663,7 +663,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0; $i = 0;
foreach ($listfieldmodify as $field) foreach ($listfieldmodify as $field)
{ {
if ($field == 'price' || preg_match('/^amount/i',$field)) { if ($field == 'price' || preg_match('/^amount/i',$field) || preg_match('/^localtax/i',$field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
} }
else if ($field == 'entity') { else if ($field == 'entity') {
@ -899,7 +899,11 @@ if ($id)
else $valuetoshow=$langs->trans("Type"); else $valuetoshow=$langs->trans("Type");
} }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
$valuetoshow=$langs->trans("Label");
if ($id != 25) $valuetoshow.="*";
}
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='country') { if ($fieldlist[$field]=='country') {
if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input if (in_array('region_id',$fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
@ -1055,7 +1059,11 @@ if ($id)
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
$valuetoshow=$langs->trans("Label");
if ($id != 25) $valuetoshow.="*";
}
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; }
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); }
if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; }
@ -1274,17 +1282,20 @@ if ($id)
$align="center"; $align="center";
} }
else if ($fieldlist[$field]=='localtax1') { else if ($fieldlist[$field]=='localtax1') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax1 == 0) if ($obj->localtax1 == 0)
$valuetoshow = ''; $valuetoshow = '';
$align="right"; $align="right";
} }
else if ($fieldlist[$field]=='localtax2') { else if ($fieldlist[$field]=='localtax2') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
if ($obj->localtax2 == 0) if ($obj->localtax2 == 0)
$valuetoshow = ''; $valuetoshow = '';
$align="right"; $align="right";
} }
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
{ {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align="right"; $align="right";
} }
else if (in_array($fieldlist[$field],array('recuperableonly'))) else if (in_array($fieldlist[$field],array('recuperableonly')))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -148,12 +148,13 @@ foreach($fulltree as $key => $val)
$categstatic->ref=$val['label']; $categstatic->ref=$val['label'];
$categstatic->type=$type; $categstatic->type=$type;
$li=$categstatic->getNomUrl(1,'',60); $li=$categstatic->getNomUrl(1,'',60);
$desc=dol_htmlcleanlastbr($val['description']);
$data[] = array( $data[] = array(
'rowid'=>$val['rowid'], 'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'], 'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li. 'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.
'</td><td width="50%">'.dolGetFirstLineOfText($val['description']).'</td>'. '</td><td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'. '<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
'</tr></table>' '</tr></table>'
); );

View File

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

View File

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

View File

@ -801,7 +801,7 @@ $db->close();
/** /**
* Show event of a particular day for a user * Show event line of a particular day for a user
* *
* @param string $username Login * @param string $username Login
* @param int $day Day * @param int $day Day
@ -853,6 +853,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
// Scan all event for this date // Scan all event for this date
foreach ($eventarray[$daykey] as $index => $event) foreach ($eventarray[$daykey] as $index => $event)
{ {
//var_dump($event);
$keysofuserassigned=array_keys($event->userassigned); $keysofuserassigned=array_keys($event->userassigned);
if (! in_array($username->id,$keysofuserassigned)) continue; // We discard record if event is from another user than user we want to show if (! in_array($username->id,$keysofuserassigned)) continue; // We discard record if event is from another user than user we want to show
//if ($username->id != $event->userownerid) continue; // We discard record if event is from another user than user we want to show //if ($username->id != $event->userownerid) continue; // We discard record if event is from another user than user we want to show
@ -1021,30 +1023,37 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
} }
} }
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
if (count($cases1[$h]) == 1) // 1 seul evenement
{
$ids=array_keys($cases1[$h]);
$output = array_slice($cases1[$h], 0, 1);
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color'];
}
else if (count($cases1[$h]) > 1) $color1='222222';
if (count($cases2[$h]) == 1) // 1 seul evenement
{
$ids=array_keys($cases2[$h]);
$output = array_slice($cases2[$h], 0, 1);
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color'];
}
else if (count($cases2[$h]) > 1) $color2='222222';
$ids1='';$ids2=''; $ids1='';$ids2='';
if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h])); if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h]));
if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h])); if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h]));
//var_dump($cases1[$h]);
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
if (count($cases1[$h]) == 1) // only 1 event
{
$output = array_slice($cases1[$h], 0, 1);
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color1 = $output[0]['color'];
}
else if (count($cases1[$h]) > 1)
{
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
$color1='222222';
}
if (count($cases2[$h]) == 1) // only 1 event
{
$output = array_slice($cases2[$h], 0, 1);
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
if ($output[0]['color']) $color2 = $output[0]['color'];
}
else if (count($cases2[$h]) > 1)
{
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
$color2='222222';
}
print '<table class="nobordernopadding" width="100%">'; print '<table class="nobordernopadding" width="100%">';
print '<tr><td '.($color1?'style="background: #'.$color1.';"':'').'class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>'; print '<tr><td '.($color1?'style="background: #'.$color1.';"':'').'class="'.($style1?$style1.' ':'').'onclickopenref'.($title1?' cursorpointer':'').'" ref="ref_'.$username->id.'_'.sprintf("%04d",$year).'_'.sprintf("%02d",$month).'_'.sprintf("%02d",$day).'_'.sprintf("%02d",$h).'_00_'.($ids1?$ids1:'none').'"'.($title1?' title="'.$title1.'"':'').'>';
print $string1; print $string1;

View File

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

View File

@ -96,7 +96,8 @@ if ($result)
$param = "&amp;sall=".$sall; $param = "&amp;sall=".$sall;
if ($filteremail) $param.='&amp;filteremail='.urlencode($filteremail); if ($filteremail) $param.='&amp;filteremail='.urlencode($filteremail);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="liste">'; print '<table class="liste">';
print '<tr class="liste_titre">'; 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("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
@ -108,7 +109,6 @@ if ($result)
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="sref" value="'.$sref.'" size="6">'; print '<input type="text" class="flat" name="sref" value="'.$sref.'" size="6">';
@ -123,7 +123,6 @@ if ($result)
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
print '</form>';
$var=True; $var=True;
@ -177,7 +176,7 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
print "</table>"; print '</table></form>';
$db->free($result); $db->free($result);
} }
else else

View File

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

View File

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

View File

@ -266,8 +266,11 @@ print '<table class="border" width="100%">';
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>'; print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="center">'.$langs->trans("NbOfProposals").'</td>'; print '<td align="center">'.$langs->trans("NbOfProposals").'</td>';
print '<td align="center">%</td>';
print '<td align="center">'.$langs->trans("AmountTotal").'</td>'; print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
print '<td align="center">%</td>';
print '<td align="center">'.$langs->trans("AmountAverage").'</td>'; print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
print '<td align="center">%</td>';
print '</tr>'; print '</tr>';
$oldyear=0; $oldyear=0;
@ -280,15 +283,21 @@ foreach ($data as $val)
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>';
print '</tr>'; print '</tr>';
} }
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['nb_diff']).'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
print '<td align="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['total_diff']).'</td>';
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
print '<td align="right" style="'.(($val['avg_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['avg_diff']).'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year; $oldyear=$year;
} }

View File

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

View File

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

View File

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

View File

@ -279,8 +279,11 @@ print '<table class="border" width="100%">';
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>'; print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="center">'.$langs->trans("NbOfOrders").'</td>'; print '<td align="center">'.$langs->trans("NbOfOrders").'</td>';
print '<td align="center">%</td>';
print '<td align="center">'.$langs->trans("AmountTotal").'</td>'; print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
print '<td align="center">%</td>';
print '<td align="center">'.$langs->trans("AmountAverage").'</td>'; print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
print '<td align="center">%</td>';
print '</tr>'; print '</tr>';
$oldyear=0; $oldyear=0;
@ -289,21 +292,27 @@ foreach ($data as $val)
$year = $val['year']; $year = $val['year'];
while (! empty($year) && $oldyear > $year+1) while (! empty($year) && $oldyear > $year+1)
{ // If we have empty year { // If we have empty year
$oldyear--; $oldyear--;
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right"></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '</tr>'; print '<td align="right"></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
print '</tr>';
} }
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['nb_diff']).'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
print '<td align="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['total_diff']).'</td>';
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
print '<td align="right" style="'.(($val['avg_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['avg_diff']).'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year; $oldyear=$year;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@ if (GETPOST('button_search'))
} }
if ($option == 'late') $filter = 'paye:0'; if ($option == 'late') $filter = 'paye:0';
if ($option == 'unpaidall') $filter = 'paye:0'; if ($option == 'unpaidall') $filter = 'paye:0';
if ($mode == 'sendremind' && $filter == '') $filter = 'paye:0'; if ($mode == 'sendmassremind' && $filter == '') $filter = 'paye:0';
if ($filter == '') $filter = 'paye:0'; if ($filter == '') $filter = 'paye:0';
$search_user = GETPOST('search_user','int'); $search_user = GETPOST('search_user','int');

View File

@ -263,8 +263,11 @@ print '<table class="border" width="100%">';
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>'; print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="center">'.$langs->trans("NumberOfBills").'</td>'; print '<td align="center">'.$langs->trans("NumberOfBills").'</td>';
print '<td align="center">%</td>';
print '<td align="center">'.$langs->trans("AmountTotal").'</td>'; print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
print '<td align="center">%</td>';
print '<td align="center">'.$langs->trans("AmountAverage").'</td>'; print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
print '<td align="center">%</td>';
print '</tr>'; print '</tr>';
$oldyear=0; $oldyear=0;
@ -277,15 +280,21 @@ foreach ($data as $val)
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>';
print '</tr>'; print '</tr>';
} }
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['nb_diff']).'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
print '<td align="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['total_diff']).'</td>';
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
print '<td align="right" style="'.(($val['avg_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['avg_diff']).'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year; $oldyear=$year;
} }

View File

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

View File

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

View File

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

View File

@ -3,12 +3,12 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -762,7 +762,6 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->error,'errors'); setEventMessage($object->error,'errors');
} }
} elseif ($action=='setref_supplier') { } elseif ($action=='setref_supplier') {
$cancelbutton = GETPOST('cancel'); $cancelbutton = GETPOST('cancel');
if (!$cancelbutton) { if (!$cancelbutton) {
@ -771,9 +770,8 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors, 'errors'); setEventMessage($object->errors, 'errors');
} }
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
$result = $object->update($user); $result = $object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha'));
if ($result < 0) { if ($result < 0) {
setEventMessage($object->errors, 'errors'); setEventMessage($object->errors, 'errors');
$action = 'editref_supplier'; $action = 'editref_supplier';
@ -782,17 +780,32 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
exit; exit;
} }
} }
else {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
}
} elseif ($action=='setref') { } elseif ($action=='setref') {
$object->ref=GETPOST('ref','alpha'); $cancelbutton = GETPOST('cancel');
$result = $object->update($user); if (!$cancelbutton) {
if ($result < 0) { $result = $object->fetch($id);
setEventMessage($object->errors,'errors'); if ($result < 0) {
$action='editref'; setEventMessage($object->errors, 'errors');
} else { }
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; $result = $object->setValueFrom('ref',GETPOST('ref','alpha'));;
} if ($result < 0) {
setEventMessage($object->errors, 'errors');
$action = 'editref';
} else {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit;
}
}
else {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
}
} }
// Generation doc (depuis lien ou depuis cartouche doc) // Generation doc (depuis lien ou depuis cartouche doc)

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
@ -1147,7 +1147,7 @@ class Contrat extends CommonObject
if (isset($this->note_private)) $this->note_private=trim($this->note_private); if (isset($this->note_private)) $this->note_private=trim($this->note_private);
if (isset($this->note_public)) $this->note_public=trim($this->note_public); if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->import_key)) $this->import_key=trim($this->import_key); if (isset($this->import_key)) $this->import_key=trim($this->import_key);
if (isset($this->extraparams)) $this->extraparams=trim($this->extraparams); //if (isset($this->extraparams)) $this->extraparams=trim($this->extraparams);
@ -1174,8 +1174,8 @@ class Contrat extends CommonObject
$sql.= " fk_user_cloture=".(isset($this->fk_user_cloture)?$this->fk_user_cloture:"null").","; $sql.= " fk_user_cloture=".(isset($this->fk_user_cloture)?$this->fk_user_cloture:"null").",";
$sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").",";
$sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").",";
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").","; $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null")."";
$sql.= " extraparams=".(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null").""; //$sql.= " extraparams=".(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null")."";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;

View File

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

View File

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

View File

@ -122,7 +122,8 @@ class box_task extends ModeleBoxes
// Add the sum à the bottom of the boxes // Add the sum à the bottom of the boxes
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left" ', 'text' => $langs->trans("Total")."&nbsp;".$textHead); $this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left"', 'text' => $langs->trans("Total")."&nbsp;".$textHead);
$this->info_box_contents[$i][1] = array('td' => '', 'text' => "");
$this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks")); $this->info_box_contents[$i][2] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')."&nbsp;".$langs->trans("Tasks"));
$this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); $this->info_box_contents[$i][3] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5));
$this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); $this->info_box_contents[$i][4] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5));

View File

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

View File

@ -3277,12 +3277,12 @@ abstract class CommonObject
* Need $this->element & $this->id * Need $this->element & $this->id
* *
* @param int $resource_id Resource id * @param int $resource_id Resource id
* @param string $resource_element Resource element * @param string $resource_type 'resource'
* @param int $busy Busy or not * @param int $busy Busy or not
* @param int $mandatory Mandatory or not * @param int $mandatory Mandatory or not
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function add_element_resource($resource_id,$resource_element,$busy=0,$mandatory=0) function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0)
{ {
$this->db->begin(); $this->db->begin();
@ -3295,7 +3295,7 @@ abstract class CommonObject
$sql.= ", mandatory"; $sql.= ", mandatory";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= $resource_id; $sql.= $resource_id;
$sql.= ", '".$resource_element."'"; $sql.= ", '".$resource_type."'";
$sql.= ", '".$this->id."'"; $sql.= ", '".$this->id."'";
$sql.= ", '".$this->element."'"; $sql.= ", '".$this->element."'";
$sql.= ", '".$busy."'"; $sql.= ", '".$busy."'";

View File

@ -95,6 +95,7 @@ class HookManager
$pathroot = ''; $pathroot = '';
// Include actions class overwriting hooks // Include actions class overwriting hooks
dol_syslog('Loading hook:' . $actionfile, LOG_INFO);
$resaction=dol_include_once($path.$actionfile); $resaction=dol_include_once($path.$actionfile);
if ($resaction) if ($resaction)
{ {

View File

@ -2072,10 +2072,12 @@ class Form
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1); if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1);
$opt.=$objp->ref; $opt.=$objp->ref;
if (! empty($objp->idprodfournprice)) $opt.=' ('.$objp->ref_fourn.')'; if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$opt.=' ('.$objp->ref_fourn.')';
$opt.=' - '; $opt.=' - ';
$outval.=$objRef; $outval.=$objRef;
if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')'; if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
$outval.=' ('.$objRefFourn.')';
$outval.=' - '; $outval.=' - ';
$opt.=dol_trunc($label, 72).' - '; $opt.=dol_trunc($label, 72).' - ';
$outval.=dol_trunc($label, 72).' - '; $outval.=dol_trunc($label, 72).' - ';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1227,19 +1227,6 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
else else
{ {
dol_print_error('','PHP version must be 5.3+'); dol_print_error('','PHP version must be 5.3+');
/*
$usealternatemethod=false;
if ($year <= 1970) $usealternatemethod=true; // <= 1970
if ($year >= 2038) $usealternatemethod=true; // >= 2038
if ($usealternatemethod || $gm) // Si time gm, seule adodb peut convertir
{
$date=adodb_mktime($hour,$minute,$second,$month,$day,$year,0,$gm);
}
else
{
$date=mktime($hour,$minute,$second,$month,$day,$year);
}*/
return ''; return '';
} }
} }
@ -2743,8 +2730,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
* *
* @param string $title Title to show * @param string $title Title to show
* @return string Title to show * @return string Title to show
* @deprecated Use print_fiche_titre instead * @deprecated Use load_fiche_titre instead
* @see print_fiche_titre * @see print_fiche_titre, load_fiche_titre
*/ */
function print_titre($title) function print_titre($title)
{ {
@ -3756,7 +3743,7 @@ function yn($yesno, $case=1, $color=0)
* *
* @param string $num Id of object * @param string $num Id of object
* @param int $level Level of subdirs to return (1, 2 or 3 levels) * @param int $level Level of subdirs to return (1, 2 or 3 levels)
* @param int $alpha Use alpha ref * @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0).
* @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '') * @param int $withoutslash 0=With slash at end, 1=without slash at end (except if '/', we return '')
* @param Object $object Object * @param Object $object Object
* @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...') * @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...')

View File

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

View File

@ -1692,64 +1692,61 @@ function pdf_getLinkedObjects($object,$outputlangs)
if ($objecttype == 'propal') if ($objecttype == 'propal')
{ {
$outputlangs->load('propal'); $outputlangs->load('propal');
$num=count($objects);
for ($i=0;$i<$num;$i++) foreach($objects as $elementobject)
{ {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
} }
} }
else if ($objecttype == 'commande') else if ($objecttype == 'commande')
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
$num=count($objects); foreach($objects as $elementobject)
for ($i=0;$i<$num;$i++)
{ {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$objects[$i]->ref_client.')' : '');
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs);
} }
} }
else if ($objecttype == 'contrat') else if ($objecttype == 'contrat')
{ {
$outputlangs->load('contracts'); $outputlangs->load('contracts');
$num=count($objects); foreach($objects as $elementobject)
for ($i=0;$i<$num;$i++)
{ {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs);
} }
} }
else if ($objecttype == 'shipping') else if ($objecttype == 'shipping')
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
$outputlangs->load('sendings'); $outputlangs->load('sendings');
$num=count($objects); foreach($objects as $elementobject)
for ($i=0;$i<$num;$i++)
{ {
$objects[$i]->fetchObjectLinked(); $elementobject->fetchObjectLinked();
$order = $objects[$i]->linkedObjects['commande'][0]; $order = $elementobject->linkedObjects['commande'][0];
if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment
{ {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending");
$linkedobjects[$objecttype]['date_value'].= dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); $linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
} }
else // We show both info of order and shipment else // We show both info of order and shipment
{ {
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);
$linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs);
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -269,18 +269,32 @@ class pdf_strato extends ModelePDFContract
// Description of product line // Description of product line
if ($objectligne->datei) { if ($objectligne->date_ouverture_prevue) {
$datei = dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); $datei = dol_print_date($objectligne->date_ouverture_prevue,'day',false,$outputlangs,true);
} else { } else {
$datei = $langs->trans("Unknown"); $datei = $langs->trans("Unknown");
} }
if ($objectligne->duration) { if ($objectligne->date_fin_validite) {
$durationi = convertSecondToTime($objectligne->duration); $durationi = convertSecondToTime($objectligne->date_fin_validite - $objectligne->date_ouverture_prevue, 'allwithouthour');
$datee = dol_print_date($objectligne->date_fin_validite,'day',false,$outputlangs,true);
} else { } else {
$durationi = $langs->trans("Unknown"); $durationi = $langs->trans("Unknown");
$datee = $langs->trans("Unknown");
} }
if ($objectligne->date_ouverture) {
$daters = dol_print_date($objectligne->date_ouverture,'day',false,$outputlangs,true);
} else {
$daters = $langs->trans("Unknown");
}
if ($objectligne->date_cloture) {
$datere = dol_print_date($objectligne->date_cloture,'day',false,$outputlangs,true);
} else {
$datere = $langs->trans("Unknown");
}
$txtpredefinedservice=''; $txtpredefinedservice='';
$txtpredefinedservice = $objectligne->product_ref; $txtpredefinedservice = $objectligne->product_ref;
if ($objectligne->product_label) if ($objectligne->product_label)
@ -289,7 +303,10 @@ class pdf_strato extends ModelePDFContract
$txtpredefinedservice .= $objectligne->product_label; $txtpredefinedservice .= $objectligne->product_label;
} }
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).'</strong>'; $txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee,1,$outputlangs->charset_output).'</strong>';
$txt.='<br>';
$txt.='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartRealShort")." : ".$daters,1,$outputlangs->charset_output);
if ($objectligne->date_cloture) $txt.=dol_htmlentitiesbr(" - ".$outputlangs->transnoentities("DateEndRealShort")." : ".$datere,1,$outputlangs->charset_output).'</strong>';
$desc=dol_htmlentitiesbr($objectligne->desc,1); $desc=dol_htmlentitiesbr($objectligne->desc,1);
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0);

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -10,7 +11,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
@ -18,11 +19,11 @@
*/ */
/** /**
* \defgroup barcode Module barcode * \defgroup barcode Module barcode
* \brief Module pour gerer les codes barres * \brief Module pour gerer les codes barres
* \file htdocs/core/modules/modBarcode.class.php * \file htdocs/core/modules/modBarcode.class.php
* \ingroup barcode,produit * \ingroup barcode,produit
* \brief Fichier de description et activation du module Barcode * \brief Fichier de description et activation du module Barcode
*/ */
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -34,9 +35,9 @@ class modBarcode extends DolibarrModules
{ {
/** /**
* Constructor. Define names, constants, directories, boxes, permissions * Constructor. Define names, constants, directories, boxes, permissions
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {
@ -56,7 +57,7 @@ class modBarcode extends DolibarrModules
$this->dirs = array("/barcode/temp"); $this->dirs = array("/barcode/temp");
// Dependances // Dependances
$this->depends = array(); // May be used for product or service or third party module $this->depends = array(); // May be used for product or service or third party module
$this->requiredby = array(); $this->requiredby = array();
// Config pages // Config pages
@ -90,43 +91,43 @@ class modBarcode extends DolibarrModules
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut $this->rights[2][3] = 0; // La permission est-elle une permission par defaut
$this->rights[2][4] = 'creer_advance'; $this->rights[2][4] = 'creer_advance';
// Main menu entries // Main menu entries
$r=0; $r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'tools', 'mainmenu'=>'tools',
'leftmenu'=>'barcodeprint', 'leftmenu'=>'barcodeprint',
'type'=>'left', // This is a Left menu entry 'type'=>'left', // This is a Left menu entry
'titre'=>'BarCodePrintsheet', 'titre'=>'BarCodePrintsheet',
'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint', 'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200, 'position'=>200,
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->lire_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'', 'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++; $r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry 'type'=>'left', // This is a Left menu entry
'titre'=>'MassBarcodeInit', 'titre'=>'MassBarcodeInit',
'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools', 'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300, 'position'=>300,
'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->creer_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'', 'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
$r++; $r++;
} }
/** /**
* Function called when module is enabled. * Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories. * It also creates data directories.
* *
* @param string $options Options when enabling module ('', 'noboxes') * @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO * @return int 1 if OK, 0 if KO
*/ */
function init($options='') function init($options='')
{ {

View File

@ -94,7 +94,7 @@ class modPrinting extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 64001; $this->rights[$r][0] = 64001;
$this->rights[$r][1] = 'Printing'; $this->rights[$r][1] = 'DirectPrint';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 1;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
@ -106,7 +106,7 @@ class modPrinting extends DolibarrModules
// This is to declare the Top Menu entry: // This is to declare the Top Menu entry:
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Put 0 if this is a top menu $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry 'type'=>'left', // This is a Top menu entry
'titre'=>'Printing', 'titre'=>'MenuDirectPrinting',
'mainmenu'=>'printing', 'mainmenu'=>'printing',
'url'=>'/printing/index.php', 'url'=>'/printing/index.php',
'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.

View File

@ -252,7 +252,7 @@ class modProduct extends DolibarrModules
if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode')); if (! empty($conf->barcode->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r],array('p.barcode'=>'BarCode'));
// Add extra fields // Add extra fields
$import_extrafield_sample=array(); $import_extrafield_sample=array();
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' entity IN (0, ".$conf->entity.')'; $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.')';
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example) if ($resql) // This can fail when class is used on old database (during migration for example)
{ {

View File

@ -154,6 +154,11 @@ class pdf_baleine extends ModelePDFProjects
$task = new Task($this->db); $task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id); $tasksarray = $task->getTasksArray(0,0,$object->id);
if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines
{
$tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray)));
}
$object->lines=$tasksarray; $object->lines=$tasksarray;
$nblignes=count($object->lines); $nblignes=count($object->lines);
@ -230,12 +235,12 @@ class pdf_baleine extends ModelePDFProjects
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload, 0, 'R'); $pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $planned_workload, 0, 'R');
$pdf->SetXY($this->posxprogress, $curY); $pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R'); $pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, $progress, 0, 'R');
$pdf->SetXY($this->posxdatestart, $curY); $pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C'); $pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, $datestart, 0, 'C');
$pdf->SetXY($this->posxdateend, $curY); $pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxdateend, 3, $dateend, 0, 'C');
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut

View File

@ -0,0 +1,601 @@
<?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/project/doc/pdf_beluga.modules.php
* \ingroup project
* \brief Fichier de la classe permettant de generer les projets au modele beluga
* \author Charlie Benke
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
/**
* Classe permettant de generer les projets au modele Baleine
*/
class pdf_beluga extends ModelePDFProjects
{
var $emetteur; // Objet societe qui emet
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("projects");
$langs->load("companies");
$this->db = $db;
$this->name = "beluga";
$this->description = $langs->trans("DocumentModelBeluga");
// Dimension page pour format A4
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_codeproduitservice = 1; // Affiche code produit-service
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
// Defini position des colonnes
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+115;
$this->posxamountttc=$this->marge_gauche+140;
$this->posxstatut=$this->marge_gauche+165;
}
/**
* Fonction generant le projet sur le disque
*
* @param Project $object Object project a generer
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object,$outputlangs)
{
global $user,$langs,$conf;
$formproject=new FormProjets($this->db);
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
if ($conf->projet->dir_output)
{
//$nblignes = count($object->lines); // This is set later with array of tasks
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->projet->dir_output;
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Complete object by loading several other informations
$task = new Task($this->db);
$tasksarray = $task->getTasksArray(0,0,$object->id);
$object->lines=$tasksarray;
$nblignes=count($object->lines);
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Project"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 50;
$tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
// Affiche notes
if (! empty($object->note_public))
{
$pdf->SetFont('','', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref-1, $tab_top-2, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note=$nexY-($tab_top-2);
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192);
$pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY+6;
}
else
{
$height_note=0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
$listofreferent=array(
'propal'=>array(
'name'=>"Proposals",
'title'=>"ListProposalsAssociatedProject",
'class'=>'Propal',
'table'=>'propal',
'datefieldname'=>'datep',
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
'order'=>array(
'name'=>"CustomersOrders",
'title'=>"ListOrdersAssociatedProject",
'class'=>'Commande',
'table'=>'commande',
'datefieldname'=>'date_commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'invoice'=>array(
'name'=>"CustomersInvoices",
'title'=>"ListInvoicesAssociatedProject",
'class'=>'Facture',
'margin'=>'add',
'table'=>'facture',
'datefieldname'=>'datef',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'invoice_predefined'=>array(
'name'=>"PredefinedInvoices",
'title'=>"ListPredefinedInvoicesAssociatedProject",
'class'=>'FactureRec',
'table'=>'facture_rec',
'datefieldname'=>'datec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'order_supplier'=>array(
'name'=>"SuppliersOrders",
'title'=>"ListSupplierOrdersAssociatedProject",
'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire),
'invoice_supplier'=>array(
'name'=>"BillsSuppliers",
'title'=>"ListSupplierInvoicesAssociatedProject",
'class'=>'FactureFournisseur',
'margin'=>'minus',
'table'=>'facture_fourn',
'datefieldname'=>'datef',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
'contract'=>array(
'name'=>"Contracts",
'title'=>"ListContractAssociatedProject",
'class'=>'Contrat',
'table'=>'contrat',
'datefieldname'=>'date_contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'intervention'=>array(
'name'=>"Interventions",
'title'=>"ListFichinterAssociatedProject",
'class'=>'Fichinter',
'table'=>'fichinter',
'datefieldname'=>'date_valid',
'disableamount'=>1,
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'trip'=>array(
'name'=>"TripsAndExpenses",
'title'=>"ListTripAssociatedProject",
'class'=>'Deplacement',
'table'=>'deplacement',
'datefieldname'=>'dated',
'margin'=>'minus',
'disableamount'=>1,
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
'class'=>'ActionComm',
'table'=>'actioncomm',
'datefieldname'=>'datep',
'disableamount'=>1,
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire)
);
foreach ($listofreferent as $key => $value)
{
$title=$value['title'];
$classname=$value['class'];
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
if ($qualified)
{
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
$num = count($elementarray);
if ($num > 0)
{
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
$selectList = $formproject->select_element($tablename, $project->thirdparty->id);
$nexY = $pdf->GetY() + 1;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $outputlangs->transnoentities("Ref"), 1, 'L');
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities("Date"), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $outputlangs->transnoentities("ThirdParty"), 1, 'L');
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHT"), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTC"), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R');
if (is_array($elementarray) && count($elementarray) > 0)
{
$nexY = $pdf->GetY();
$curY = $nexY;
$total_ht = 0;
$total_ttc = 0;
$num = count($elementarray);
for ($i = 0; $i < $num; $i ++) {
$element = new $classname($this->db);
$element->fetch($elementarray[$i]);
$element->fetch_thirdparty();
// print $classname;
$qualifiedfortotal = true;
if ($key == 'invoice') {
if ($element->close_code == 'replaced')
$qualifiedfortotal = false; // Replacement invoice
}
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L');
// Date
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
$date = $element->date_commande;
else {
$date = $element->date;
if (empty($date))
$date = $element->datep;
if (empty($date))
$date = $element->date_contrat;
if (empty($date))
$date = $element->datev; // Fiche inter
}
$pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C');
$pdf->SetXY($this->posxsociety, $curY);
if (is_object($element->thirdparty))
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $element->thirdparty->name, 1, 'L');
// Amount without tax
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : '&nbsp;'), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
// Status
if ($element instanceof CommonInvoice) {
// This applies for Facture and FactureFournisseur
$outputstatut = $element->getLibStatut(1, $element->getSommePaiement());
} else {
$outputstatut = $element->getLibStatut(1);
}
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1, 'R', false, 1, '', '', true, 0, true);
if ($qualifiedfortotal) {
$total_ht = $total_ht + $element->total_ht;
$total_ttc = $total_ttc + $element->total_ttc;
}
$nexY = $pdf->GetY();
$curY = $nexY;
}
if (empty($value['disableamount'])) {
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L');
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : '&nbsp;'), 1, 'R');
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L');
}
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
}
}
}
}
/*
* Pied de page
*/
$this->_pagefoot($pdf,$object,$outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file,'F');
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
return 1; // Pas d'erreur
}
else
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
$this->error=$langs->transnoentities("ErrorConstantNotDefined","LIVRAISON_OUTPUTDIR");
return 0;
}
/**
* Show table for lines
*
* @param PDF $pdf Object PDF
* @param string $tab_top Top position of table
* @param string $tab_height Height of table (rectangle)
* @param int $nexY Y
* @param Translate $outputlangs Langs object
* @param int $hidetop Hide top bar of array
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{
global $conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetDrawColor(128,128,128);
// Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size);
$pdf->SetXY($this->posxref, $tab_top+1);
$pdf->MultiCell($this->posxlabel-$this->posxref,3, $outputlangs->transnoentities("Tasks"),'','L');
$pdf->SetXY($this->posxlabel, $tab_top+1);
$pdf->MultiCell($this->posxworkload-$this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
$pdf->SetXY($this->posxworkload, $tab_top+1);
$pdf->MultiCell($this->posxprogress-$this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R');
$pdf->SetXY($this->posxprogress, $tab_top+1);
$pdf->MultiCell($this->posxdatestart-$this->posxprogress, 3, '%', 0, 'R');
$pdf->SetXY($this->posxdatestart, $tab_top+1);
$pdf->MultiCell($this->posxdateend-$this->posxdatestart, 3, '', 0, 'C');
$pdf->SetXY($this->posxdateend, $tab_top+1);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
}
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{
global $langs,$conf,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size + 3);
$posx=$this->page_largeur-$this->marge_droite-100;
$posy=$this->marge_haute;
$pdf->SetXY($this->marge_gauche,$posy);
// Logo
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if ($mysoc->logo)
{
if (is_readable($logo))
{
$height=pdf_getHeightForLogo($logo);
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
}
else
{
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
}
}
else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->name), 0, 'L');
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
$pdf->SetFont('','', $default_font_size + 2);
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
$posy+=6;
$pdf->SetXY($posx,$posy);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
$pdf->SetTextColor(0,0,60);
}
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}

View File

@ -50,7 +50,7 @@ $(document).ready(function () {
</script> </script>
<?php } ?> <?php } ?>
<div align="center"> <div class="center">
<div class="login_vertical_align"> <div class="login_vertical_align">
<form id="login" name="login" method="post" action="<?php echo $php_self; ?>"> <form id="login" name="login" method="post" action="<?php echo $php_self; ?>">
@ -70,8 +70,8 @@ $(document).ready(function () {
<input type="hidden" name="dol_no_mouse_hover" id="dol_no_mouse_hover" value="<?php echo $dol_no_mouse_hover; ?>" /> <input type="hidden" name="dol_no_mouse_hover" id="dol_no_mouse_hover" value="<?php echo $dol_no_mouse_hover; ?>" />
<input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" /> <input type="hidden" name="dol_use_jmobile" id="dol_use_jmobile" value="<?php echo $dol_use_jmobile; ?>" />
<table class="login_table_title center" summary="<?php echo dol_escape_htmltag($title); ?>"> <table class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
<tr class="vmenu"><td align="center"><?php echo dol_escape_htmltag($title); ?></td></tr> <tr class="vmenu"><td class="center"><?php echo dol_escape_htmltag($title); ?></td></tr>
</table> </table>
<br> <br>
@ -81,7 +81,7 @@ $(document).ready(function () {
<div id="login_left"> <div id="login_left">
<img alt="Logo" title="" src="<?php echo $urllogo; ?>" id="img_logo" /> <img alt="" src="<?php echo $urllogo; ?>" id="img_logo" />
</div> </div>
@ -89,10 +89,11 @@ $(document).ready(function () {
<div id="login_right"> <div id="login_right">
<table class="left centpercent" summary="Login pass"> <table class="left centpercent" title="Login pass">
<!-- Login --> <!-- Login -->
<tr> <tr>
<td valign="middle" class="nowrap center"> <td class="nowrap center valignmiddle">
<label for="username" hidden><?php echo $langs->trans("Login"); ?></label>
<span class="span-icon-user"> <span class="span-icon-user">
<input type="text" id="username" placeholder="<?php echo $langs->trans("Login"); ?>" name="username" class="flat input-icon-user" size="20" value="<?php echo dol_escape_htmltag($login); ?>" tabindex="1" autofocus="autofocus" /> <input type="text" id="username" placeholder="<?php echo $langs->trans("Login"); ?>" name="username" class="flat input-icon-user" size="20" value="<?php echo dol_escape_htmltag($login); ?>" tabindex="1" autofocus="autofocus" />
</span> </span>
@ -100,7 +101,8 @@ $(document).ready(function () {
</tr> </tr>
<!-- Password --> <!-- Password -->
<tr> <tr>
<td valign="middle" class="nowrap center"> <td class="nowrap center valignmiddle">
<label for="password" hidden><?php echo $langs->trans("Password"); ?></label>
<span class="span-icon-password"> <span class="span-icon-password">
<input id="password" placeholder="<?php echo $langs->trans("Password"); ?>" name="password" class="flat input-icon-password" type="password" size="20" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="off" /> <input id="password" placeholder="<?php echo $langs->trans("Password"); ?>" name="password" class="flat input-icon-password" type="password" size="20" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="off" />
</span> </span>
@ -126,7 +128,7 @@ if (! empty($hookmanager->resArray['options'])) {
?> ?>
<!-- Captcha --> <!-- Captcha -->
<tr> <tr>
<td valign="top" class="nowrap none center"> <td class="nowrap none center">
<table class="login_table_securitycode centpercent"><tr> <table class="login_table_securitycode centpercent"><tr>
<td> <td>
@ -165,7 +167,7 @@ if ($forgetpasslink || $helpcenterlink)
if ($dol_use_jmobile) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile; if ($dol_use_jmobile) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile;
echo '<br>'; echo '<br>';
echo '<div align="center" style="margin-top: 8px;">'; echo '<div class="center" style="margin-top: 8px;">';
if ($forgetpasslink) { if ($forgetpasslink) {
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">('; echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">(';
echo $langs->trans('PasswordForgotten'); echo $langs->trans('PasswordForgotten');
@ -192,7 +194,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
//if (! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $url= //if (! empty($conf->global->MAIN_OPENIDURL_PERUSER)) $url=
echo '<br>'; echo '<br>';
echo '<div align="center" style="margin-top: 4px;">'; echo '<div class="center" style="margin-top: 4px;">';
$url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL; $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
if (! empty($url)) print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>'; if (! empty($url)) print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
@ -220,7 +222,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
<?php if (! empty($_SESSION['dol_loginmesg'])) <?php if (! empty($_SESSION['dol_loginmesg']))
{ {
?> ?>
<div class="center login_main_message" style="max-width: 500px; margin-left: 10px; margin-right: 10px;"><div class="error"> <div class="center login_main_message" style="max-width: 520px"><div class="error">
<?php echo $_SESSION['dol_loginmesg']; ?> <?php echo $_SESSION['dol_loginmesg']; ?>
</div></div> </div></div>
<?php <?php
@ -286,7 +288,7 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLI
if (empty($conf->dol_use_jmobile)) if (empty($conf->dol_use_jmobile))
{ {
?> ?>
<div align="center"><br> <div class="center"><br>
<script type="text/javascript"><!-- <script type="text/javascript"><!--
google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>"; google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>"; google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";

View File

@ -322,7 +322,7 @@ if (! empty($conf->margin->enabled))
var remise = $("input[name='remise_percent']:first"); var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first"); var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '') return true; if (rate.val() == '' || (typeof rate.val()) == 'undefined' ) return true;
if (! $.isNumeric(rate.val().replace(',','.'))) if (! $.isNumeric(rate.val().replace(',','.')))
{ {
@ -331,7 +331,7 @@ if (! empty($conf->margin->enabled))
setTimeout(function () { rate.focus() }, 50); setTimeout(function () { rate.focus() }, 50);
return false; return false;
} }
if (npRate == "markRate" && rate.val() >= 100) if (npRate == "np_markRate" && rate.val() >= 100)
{ {
alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>'); alert('<?php echo $langs->trans("markRateShouldBeLesserThan100"); ?>');
e.stopPropagation(); e.stopPropagation();
@ -347,9 +347,11 @@ if (! empty($conf->margin->enabled))
bpjs=price2numjs(buying_price.val()); bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val()); ratejs=price2numjs(rate.val());
if (npRate == "marginRate") /* console.log(npRate+" - "+bpjs+" - "+ratejs); */
if (npRate == "np_marginRate")
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
else if (npRate == "markRate") else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
} }
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value

View File

@ -151,7 +151,7 @@ if (! empty($hookmanager->resArray['options'])) {
</form> </form>
<div class="center login_main_home" style="max-width: 680px; margin-left: 10px; margin-right: 10px;"> <div class="center login_main_home" style="max-width: 80%">
<?php if ($mode == 'dolibarr' || ! $disabled) { ?> <?php if ($mode == 'dolibarr' || ! $disabled) { ?>
<font style="font-size: 12px;"> <font style="font-size: 12px;">
<?php echo $langs->trans('SendNewPasswordDesc'); ?> <?php echo $langs->trans('SendNewPasswordDesc'); ?>
@ -167,7 +167,7 @@ if (! empty($hookmanager->resArray['options'])) {
<br> <br>
<?php if ($message) { ?> <?php if ($message) { ?>
<div class="center login_main_message" style="max-width: 680px; margin-left: 10px; margin-right: 10px;"> <div class="center login_main_message" style="max-width: 520px">
<?php echo dol_htmloutput_mesg($message,'','',1); ?> <?php echo dol_htmloutput_mesg($message,'','',1); ?>
</div> </div>
<?php } ?> <?php } ?>

View File

@ -14,7 +14,7 @@ $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<input type="hidden" name="action" value="add_element_resource">'; $out .= '<input type="hidden" name="action" value="add_element_resource">';
$out .= '<input type="hidden" name="element" value="'.$element.'">'; $out .= '<input type="hidden" name="element" value="'.$element.'">';
$out .= '<input type="hidden" name="element_id" value="'.$element_id.'">'; $out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
$out .= '<input type="hidden" name="resource_type" value="'.$resource_type.'">'; $out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'resource' : $resource_type).'">';
// Place // Place
@ -37,4 +37,4 @@ $out .= '<br />';
print $out; print $out;
// FIN DU TPL // END BEGIN TPL RESOURCE_ADD.TPL.PHP

View File

@ -678,10 +678,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Add entry in event table // Add entry in event table
$now=dol_now(); $now=dol_now();
if(isset($_SESSION['listofnames'])) if (isset($_SESSION['listofnames']))
{ {
$attachs=$_SESSION['listofnames']; $attachs=$_SESSION['listofnames'];
if($attachs && strpos($action,'SENTBYMAIL')) if ($attachs && strpos($action,'SENTBYMAIL'))
{ {
$object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs; $object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs;
} }
@ -719,6 +719,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->elementtype = $object->element; $actioncomm->elementtype = $object->element;
$ret=$actioncomm->add($user); // User qui saisit l'action $ret=$actioncomm->add($user); // User qui saisit l'action
unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse vallue of first action.
if ($ret > 0) if ($ret > 0)
{ {
$_SESSION['LAST_ACTION_CREATED'] = $ret; $_SESSION['LAST_ACTION_CREATED'] = $ret;

View File

@ -76,7 +76,7 @@ $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($co
$object = new Expedition($db); $object = new Expedition($db);
// Load object // Load object. Make an object->fetch
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
@ -160,6 +160,7 @@ if (empty($reshook))
$num=count($objectsrc->lines); $num=count($objectsrc->lines);
$totalqty=0; $totalqty=0;
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
$idl="idl".$i; $idl="idl".$i;
@ -178,11 +179,12 @@ if (empty($reshook))
while (isset($_POST[$batch])) while (isset($_POST[$batch]))
{ {
// save line of detail into sub_qty // save line of detail into sub_qty
$sub_qty[$j]['q']=GETPOST($qty,'int'); $sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record
$sub_qty[$j]['id_batch']=GETPOST($batch,'int'); $sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move
$subtotalqty+=$sub_qty[$j]['q']; $subtotalqty+=$sub_qty[$j]['q'];
//var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']);
$j++; $j++;
$batch="batchl".$i."_".$j; $batch="batchl".$i."_".$j;
$qty = "qtyl".$i.'_'.$j; $qty = "qtyl".$i.'_'.$j;
@ -200,6 +202,8 @@ if (empty($reshook))
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int'); if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
} }
} }
//var_dump($batch_line[2]);
if ($totalqty > 0) // There is at least one thing to ship if ($totalqty > 0) // There is at least one thing to ship
{ {
@ -208,7 +212,8 @@ if (empty($reshook))
{ {
$qty = "qtyl".$i; $qty = "qtyl".$i;
if (! isset($batch_line[$i])) if (! isset($batch_line[$i]))
{ // not batch mode {
// not batch mode
if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) if (GETPOST($qty,'int') > 0 || (GETPOST($qty,'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS))
{ {
$ent = "entl".$i; $ent = "entl".$i;
@ -225,7 +230,8 @@ if (empty($reshook))
} }
} }
else else
{ // batch mode {
// batch mode
if ($batch_line[$i]['qty']>0) if ($batch_line[$i]['qty']>0)
{ {
$ret=$object->addline_batch($batch_line[$i]); $ret=$object->addline_batch($batch_line[$i]);
@ -669,9 +675,10 @@ if ($action == 'create')
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>'; print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
print '<td align="center">'.$langs->trans("QtyShipped").'</td>'; print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
print '<td align="center">'.$langs->trans("QtyToShip"); print '<td align="center">'.$langs->trans("QtyToShip");
if (empty($conf->productbatch->enabled)) { if (empty($conf->productbatch->enabled))
print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>'; {
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)'; print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>';
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)';
} }
print '</td>'; print '</td>';
if (! empty($conf->stock->enabled)) if (! empty($conf->stock->enabled))
@ -848,31 +855,45 @@ if ($action == 'create')
else else
{ {
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
$staticwarehouse=new Entrepot($db);
$staticwarehouse->fetch($warehouse_id);
$subj=0; $subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) if (count($product->stock_warehouse[$warehouse_id]->detail_batch))
{ {
//var_dump($dbatch); foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch)
$substock=$dbatch->qty +0 ; {
print '<tr><td colspan="3" ></td><td align="center">'; //var_dump($dbatch);
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.min($defaultqty,$substock).'">'; $substock=$dbatch->qty +0 ; // To get a numeric
print '</td>'; print '<tr><td colspan="3" ></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.($substock > 0 ? min($defaultqty,$substock) : '0').'">';
print '<td align="left">'; print '</td>';
$staticwarehouse=new Entrepot($db); print '<td align="left">';
$staticwarehouse->fetch($warehouse_id);
print $staticwarehouse->getNomUrl(0).' / '; print $staticwarehouse->getNomUrl(0).' / ';
print '<!-- Show details of lot -->'; print '<!-- Show details of lot -->';
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">'; print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
if ($defaultqty<=0) { if ($defaultqty<=0) {
$defaultqty=0; $defaultqty=0;
} else { } else {
$defaultqty -=min($defaultqty,$substock); $defaultqty -= min($defaultqty,$substock);
}
$subj++;
} }
$subj++; }
else
{
print '<tr><td colspan="3" ></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
print '</td>';
print '<td align="left">';
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle);
} }
} }
@ -1242,8 +1263,8 @@ else if ($id || $ref)
print "</table>\n"; print "</table>\n";
/* /*
* Lignes produits * Lines of products
*/ */
print '<br><table class="noborder" width="100%">'; print '<br><table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
@ -1402,12 +1423,19 @@ else if ($id || $ref)
if (isset($lines[$i]->detail_batch)) if (isset($lines[$i]->detail_batch))
{ {
print '<td>'; print '<td>';
$detail = ''; if ($lines[$i]->product_tobatch)
foreach ($lines[$i]->detail_batch as $dbatch)
{ {
$detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'<br/>'; $detail = '';
foreach ($lines[$i]->detail_batch as $dbatch)
{
$detail.= $langs->trans("DetailBatchFormat",$dbatch->batch,dol_print_date($dbatch->eatby,"day"),dol_print_date($dbatch->sellby,"day"),$dbatch->dluo_qty).'<br/>';
}
print $form->textwithtooltip($langs->trans("DetailBatchNumber"),$detail);
}
else
{
print $langs->trans("NA");
} }
print $form->textwithtooltip($langs->trans("DetailBatchNumber"),$detail);
print '</td>'; print '</td>';
} else { } else {
print '<td></td>'; print '<td></td>';

View File

@ -391,7 +391,7 @@ class Expedition extends CommonObject
/** /**
* Create a expedition line with eat-by date * Create the detail (eat-by date) of the expedition line
* *
* @param object $line_ext full line informations * @param object $line_ext full line informations
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -626,9 +626,12 @@ class Expedition extends CommonObject
// Loop on each product line to add a stock movement // Loop on each product line to add a stock movement
// TODO possibilite d'expedier a partir d'une propale ou autre origine // TODO possibilite d'expedier a partir d'une propale ou autre origine
$sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid"; $sql = "SELECT cd.fk_product, cd.subprice,";
$sql.= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql.= " edb.rowid as edbrowid, edb.eatby, edb.sellby, edb.batch, edb.qty as edbqty, edb.fk_origin_stock";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,"; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
$sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid";
$sql.= " WHERE ed.fk_expedition = ".$this->id; $sql.= " WHERE ed.fk_expedition = ".$this->id;
$sql.= " AND cd.rowid = ed.fk_origin_line"; $sql.= " AND cd.rowid = ed.fk_origin_line";
@ -636,31 +639,42 @@ class Expedition extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$cpt = $this->db->num_rows($resql); $cpt = $this->db->num_rows($resql);
for ($i = 0; $i < $cpt; $i++) for ($i = 0; $i < $cpt; $i++)
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if($obj->qty <= 0) continue; if ($obj->qty <= 0) continue;
dol_syslog(get_class($this)."::valid movement index ".$i); dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid);
//var_dump($this->lines[$i]); //var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db); $mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this; $mouvS->origin = &$this;
// We decrement stock of product (and sub-products)
// We use warehouse selected for each line if (empty($obj->edbrowid))
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref));
if ($result < 0) { $error++; break; }
if (! empty($conf->productbatch->enabled))
{ {
$details=ExpeditionLineBatch::fetchAll($this->db,$obj->rowid); // line without batch detail
if (! empty($details))
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref));
if ($result < 0) {
$error++; break;
}
}
else
{
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->edbqty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch);
if ($result < 0) {
$error++; break;
}
// We update content of table llx_product_batch (will be rename into llx_product_stock_batch inantoher version)
if (! empty($conf->productbatch->enabled))
{ {
foreach ($details as $dbatch) $result=$mouvS->livraison_batch($obj->fk_origin_stock, $obj->qty); // ->fk_origin_stock = id into table llx_product_batch (will be rename into llx_product_stock_batch in another version)
{ if ($result < 0) { $error++; $this->errors[]=$mouvS->error; break; }
$result=$mouvS->livraison_batch($dbatch->fk_origin_stock,$dbatch->dluo_qty);
if ($result < 0) { $error++; $this->errors[]=$mouvS->$error; break 2; }
}
} }
} }
} }
@ -672,7 +686,7 @@ class Expedition extends CommonObject
return -2; return -2;
} }
} }
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
{ {
// Call trigger // Call trigger
@ -843,7 +857,11 @@ class Expedition extends CommonObject
{ {
if ($value['q']>0) if ($value['q']>0)
{ {
$linebatch = new ExpeditionLineBatch($this->db); // $value['q']=qty to move
// $value['id_batch']=id into llx_product_batch of record to move
//var_dump($value);
$linebatch = new ExpeditionLineBatch($this->db);
$ret=$linebatch->fetchFromStock($value['id_batch']); // load serial, sellby, eatby $ret=$linebatch->fetchFromStock($value['id_batch']); // load serial, sellby, eatby
if ($ret<0) if ($ret<0)
{ {
@ -857,13 +875,16 @@ class Expedition extends CommonObject
{ {
// TODO // TODO
} }
//var_dump($linebatch);
} }
} }
$line->entrepot_id = $linebatch->entrepot_id; $line->entrepot_id = $linebatch->entrepot_id;
$line->origin_line_id = $dbatch['ix_l']; $line->origin_line_id = $dbatch['ix_l'];
$line->qty = $dbatch['qty']; $line->qty = $dbatch['qty'];
$line->detail_batch=$tab; $line->detail_batch=$tab;
//var_dump($line);
$this->lines[$num] = $line; $this->lines[$num] = $line;
} }
} }
@ -1146,9 +1167,9 @@ class Expedition extends CommonObject
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked"; $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent"; $sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent";
$sql.= ", ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, ed.rowid as line_id"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
$sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,"; $sql.= " FROM (".MAIN_DB_PREFIX."expeditiondet as ed,";
$sql.= " ".MAIN_DB_PREFIX."commandedet as cd)"; $sql.= " ".MAIN_DB_PREFIX."commandedet as cd)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product";
@ -1192,6 +1213,8 @@ class Expedition extends CommonObject
$line->details_entrepot[] = $detail_entrepot; $line->details_entrepot[] = $detail_entrepot;
$line->line_id = $obj->line_id; $line->line_id = $obj->line_id;
$line->rowid = $obj->line_id; // TODO deprecated
$line->id = $obj->line_id;
$line->fk_origin_line = $obj->fk_origin_line; $line->fk_origin_line = $obj->fk_origin_line;
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated $line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
$line->fk_product = $obj->fk_product; $line->fk_product = $obj->fk_product;
@ -1200,6 +1223,7 @@ class Expedition extends CommonObject
$line->product_ref = $obj->product_ref; $line->product_ref = $obj->product_ref;
$line->product_label = $obj->product_label; $line->product_label = $obj->product_label;
$line->libelle = $obj->product_label; // TODO deprecated $line->libelle = $obj->product_label; // TODO deprecated
$line->product_tobatch = $obj->product_tobatch;
$line->label = $obj->custom_label; $line->label = $obj->custom_label;
$line->description = $obj->description; $line->description = $obj->description;
$line->qty_asked = $obj->qty_asked; $line->qty_asked = $obj->qty_asked;

View File

@ -48,13 +48,13 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
$var=false; $var=false;
print '<table class="noborder nohover" width="100%">';
print '<form method="post" action="list.php">'; print '<form method="post" action="list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; 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("SearchASending").'</td></tr>'; print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchASending").'</td></tr>';
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>'; print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sf_ref" size="18"></td><td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "</form></table><br>\n"; print "</table></form><br>\n";
/* /*
* Shipments to validate * Shipments to validate

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -329,7 +329,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('AvailabilityPeriod'); print $langs->trans('AvailabilityPeriod');
print '</td>'; print '</td>';
if ($action != 'editavailability') if ($action != 'editavailability')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $commande->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editavailability') { if ($action == 'editavailability') {
@ -345,7 +345,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('Source'); print $langs->trans('Source');
print '</td>'; print '</td>';
if ($action != 'editdemandreason') if ($action != 'editdemandreason')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $commande->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editdemandreason') { if ($action == 'editdemandreason') {

View File

@ -949,7 +949,7 @@ $formfile = new FormFile($db);
if ($conf->contrat->enabled) if ($conf->contrat->enabled)
$formcontract = new FormContract($db); $formcontract = new FormContract($db);
llxHeader('',$langs->trans("Fichinter")); llxHeader('',$langs->trans("Intervention"));
if ($action == 'create') if ($action == 'create')
{ {

View File

@ -106,7 +106,7 @@ $formcompany = new FormCompany($db);
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$userstatic=new User($db); $userstatic=new User($db);
llxHeader(); llxHeader('',$langs->trans("Intervention"));
// Mode vue et edition // Mode vue et edition

View File

@ -81,8 +81,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php
$form = new Form($db); $form = new Form($db);
llxHeader("","",$langs->trans("InterventionCard")); llxHeader('',$langs->trans("Intervention"));
if ($object->id) if ($object->id)
{ {

View File

@ -49,7 +49,7 @@ if ($id > 0)
* View * View
*/ */
llxHeader(); llxHeader('',$langs->trans("Intervention"));
$societe = new Societe($db); $societe = new Societe($db);
$societe->fetch($object->socid); $societe->fetch($object->socid);

View File

@ -1151,7 +1151,7 @@ class FactureFournisseur extends CommonInvoice
if (empty($txtva)) $txtva=0; if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0; if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($txlocaltax2)) $txlocaltax2=0;
$remise_percent=price2num($remise_percent); $remise_percent=price2num($remise_percent);
$qty=price2num($qty); $qty=price2num($qty);
$pu=price2num($pu); $pu=price2num($pu);
@ -1197,7 +1197,7 @@ class FactureFournisseur extends CommonInvoice
} }
else else
{ {
dol_syslog("Error error=".$this->error, LOG_ERR); dol_syslog("Error after updateline error=".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -2096,16 +2096,17 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->db->begin(); $this->db->begin();
if ($this->fk_product) { if (empty($this->fk_product))
{
$fk_product = "null"; $fk_product = "null";
} else { } else {
$fk_product = $this->fk_product; $fk_product = $this->fk_product;
} }
if ($this->fk_unit) { if (empty($this->fk_unit)) {
$fk_unit = "'".$this->db->escape($this->fk_unit)."'";
} else {
$fk_unit = "null"; $fk_unit = "null";
} else {
$fk_unit = "'".$this->db->escape($this->fk_unit)."'";
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET";

View File

@ -1612,9 +1612,10 @@ if ($action=='create')
print "</form>\n"; print "</form>\n";
// Show origin lines // Show origin lines
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) { if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
{
$title = $langs->trans('ProductsAndServices'); $title = $langs->trans('ProductsAndServices');
print_titre($title); print load_fiche_titre($title,'','');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -2395,7 +2396,7 @@ elseif (! empty($object->id))
'entity'=>'' 'entity'=>''
); );
print_titre($langs->trans('CreateRemoteOrder')); print load_fiche_titre($langs->trans('CreateRemoteOrder'),'');
//Is everything filled? //Is everything filled?
if (empty($ws_url) || empty($ws_key)) { if (empty($ws_url) || empty($ws_key)) {

View File

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

View File

@ -453,7 +453,9 @@ if (($action != 'create' && $action != 'add') && !$error) {
$companystatic->nom = $soc->nom; $companystatic->nom = $soc->nom;
print '<h3>' . $companystatic->getNomUrl(1, 'customer') . '</h3>'; print '<h3>' . $companystatic->getNomUrl(1, 'customer') . '</h3>';
} }
print '<form method="get" action="orderstoinvoice.php">';
print '<input type="hidden" name="socid" value="' . $socid . '">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&amp;socid=' . $socid, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans('Ref'), 'orderstoinvoice.php', 'c.ref', '', '&amp;socid=' . $socid, '', $sortfield, $sortorder);
@ -465,8 +467,6 @@ if (($action != 'create' && $action != 'add') && !$error) {
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="get" action="orderstoinvoice.php">';
print '<input type="hidden" name="socid" value="' . $socid . '">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
// REF // REF
@ -497,7 +497,6 @@ if (($action != 'create' && $action != 'add') && !$error) {
print '</td>'; print '</td>';
print '</td></tr>'; print '</td></tr>';
print '</form>';
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">'; print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
$var = True; $var = True;

View File

@ -787,4 +787,8 @@ UPDATE llx_c_departements SET code_departement='VI' WHERE ncc='ALAVA' AND fk_reg
UPDATE llx_c_departements SET code_departement='CE' WHERE ncc='CEUTA' AND fk_region=407; UPDATE llx_c_departements SET code_departement='CE' WHERE ncc='CEUTA' AND fk_region=407;
UPDATE llx_c_departements SET code_departement='ML' WHERE ncc='MELILLA' AND fk_region=409; UPDATE llx_c_departements SET code_departement='ML' WHERE ncc='MELILLA' AND fk_region=409;
DELETE FROM llx_c_departements WHERE ncc='OTROS' AND fk_region=420; DELETE FROM llx_c_departements WHERE ncc='OTROS' AND fk_region=420;
DELETE FROM llx_c_regions WHERE code_region=420 and fk_pays=4; DELETE FROM llx_c_regions WHERE code_region=420 and fk_pays=4;
ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(62);
ALTER TABLE llx_societe_remise_except MODIFY COLUMN description text NOT NULL;

View File

@ -22,7 +22,7 @@ create table llx_c_paiement
( (
id integer PRIMARY KEY, id integer PRIMARY KEY,
code varchar(6) NOT NULL, code varchar(6) NOT NULL,
libelle varchar(30), libelle varchar(62),
type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other
active tinyint DEFAULT 1 NOT NULL, active tinyint DEFAULT 1 NOT NULL,
accountancy_code varchar(32) NULL, accountancy_code varchar(32) NULL,

View File

@ -27,7 +27,7 @@
create table llx_c_type_resource create table llx_c_type_resource
( (
rowid integer PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
code varchar(32) NOT NULL, code varchar(32) NOT NULL,
label varchar(64) NOT NULL, label varchar(64) NOT NULL,
active tinyint DEFAULT 1 NOT NULL active tinyint DEFAULT 1 NOT NULL

View File

@ -20,18 +20,18 @@
create table llx_extrafields create table llx_extrafields
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
name varchar(64) NOT NULL, -- nom de l'attribut name varchar(64) NOT NULL, -- name of field into extrafields tables
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
elementtype varchar(64) NOT NULL DEFAULT 'member', elementtype varchar(64) NOT NULL DEFAULT 'member', -- for which element this extra fields is for
tms timestamp, tms timestamp, -- date of last update
label varchar(255) NOT NULL, -- label correspondant a l'attribut label varchar(255) NOT NULL, -- label to show for attribute
type varchar(8), type varchar(8),
size varchar(8) DEFAULT NULL, size varchar(8) DEFAULT NULL,
fieldunique integer DEFAULT 0, fieldunique integer DEFAULT 0,
fieldrequired integer DEFAULT 0, fieldrequired integer DEFAULT 0,
perms varchar(255), perms varchar(255), -- not used yet
pos integer DEFAULT 0, pos integer DEFAULT 0,
alwayseditable integer DEFAULT 0, alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, param text, -- extra parameters to define possible values of field
list integer DEFAULT 0 list integer DEFAULT 0 -- list of values for field that are combo lists
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -32,5 +32,5 @@ create table llx_societe_remise_except
fk_facture_line integer, fk_facture_line integer,
fk_facture integer, fk_facture integer,
fk_facture_source integer, fk_facture_source integer,
description varchar(255) NOT NULL description text NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -90,6 +90,8 @@ ExtSiteUrlAgenda=URL to access .ical file
ExtSiteNoLabel=No Description ExtSiteNoLabel=No Description
WorkingTimeRange=Working time range WorkingTimeRange=Working time range
WorkingDaysRange=Working days range WorkingDaysRange=Working days range
VisibleTimeRange=Visible time range
VisibleDaysRange=Visible days range
AddEvent=Create event AddEvent=Create event
MyAvailability=My availability MyAvailability=My availability
ActionType=Event type ActionType=Event type

View File

@ -330,8 +330,8 @@ PaymentTypeCB=Credit card
PaymentTypeShortCB=Credit card PaymentTypeShortCB=Credit card
PaymentTypeCHQ=Check PaymentTypeCHQ=Check
PaymentTypeShortCHQ=Check PaymentTypeShortCHQ=Check
PaymentTypeTIP=TIP PaymentTypeTIP=Deposit
PaymentTypeShortTIP=TIP PaymentTypeShortTIP=Deposit
PaymentTypeVAD=On line payment PaymentTypeVAD=On line payment
PaymentTypeShortVAD=On line payment PaymentTypeShortVAD=On line payment
PaymentTypeTRA=Bill payment PaymentTypeTRA=Bill payment

View File

@ -3,6 +3,8 @@ Module64000Name=Direct Printing
Module64000Desc=Enable Direct Printing System Module64000Desc=Enable Direct Printing System
PrintingSetup=Setup of Direct Printing System PrintingSetup=Setup of Direct Printing System
PrintingDesc=This module adds a Print button to send documents directly to a printer (without opening document into an application) with various module. PrintingDesc=This module adds a Print button to send documents directly to a printer (without opening document into an application) with various module.
MenuDirectPrinting=Direct Printing
DirectPrint=Direct print
ModuleDriverSetup=Setup Module Driver ModuleDriverSetup=Setup Module Driver
PrintingDriverDesc=Configuration variables for printing driver. PrintingDriverDesc=Configuration variables for printing driver.
ListDrivers=List of drivers ListDrivers=List of drivers
@ -10,6 +12,7 @@ PrintTestDesc=List of Printers.
FileWasSentToPrinter=File %s was sent to printer FileWasSentToPrinter=File %s was sent to printer
NoActivePrintingModuleFound=No active module to print document NoActivePrintingModuleFound=No active module to print document
PleaseSelectaDriverfromList=Please select a driver from list. PleaseSelectaDriverfromList=Please select a driver from list.
PleaseConfigureDriverfromList=Please configure the selected driver from list.
SetupDriver=Driver setup SetupDriver=Driver setup
TestDriver=Test TestDriver=Test
TargetedPrinter=Targeted printer TargetedPrinter=Targeted printer

View File

@ -143,7 +143,8 @@ SelectElement=Select element
AddElement=Link to element AddElement=Link to element
UnlinkElement=Unlink element UnlinkElement=Unlink element
# Documents models # Documents models
DocumentModelBaleine=A complete project's report model (logo...) DocumentModelBeluga=Project template for linked objects overview
DocumentModelBaleine=Project report template for tasks
PlannedWorkload=Planned workload PlannedWorkload=Planned workload
PlannedWorkloadShort=Workload PlannedWorkloadShort=Workload
WorkloadOccupation=Workload assignation WorkloadOccupation=Workload assignation

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