Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
fc9dc100b1
@ -26,6 +26,7 @@ php-iban 1.4.6 LGPL-3+ Yes
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
|
||||
TCPDF 6.2.6 LGPL-3+ Yes PDF generation
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
|
||||
JS libraries:
|
||||
jQuery 1.11.3 MIT License Yes JS library
|
||||
|
||||
@ -235,6 +235,8 @@ 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 #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne
|
||||
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
|
||||
|
||||
NEW: Created new ContratLigne::insert function
|
||||
|
||||
@ -494,6 +496,10 @@ Dolibarr better:
|
||||
- Fix: Bad permission assignments for stock movements actions
|
||||
- Fix: [ bug #2891 ] Category hooks do not work
|
||||
- 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: 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 *****
|
||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||
@ -677,6 +683,7 @@ Fix: [ bug #2715 ] Statistics page has broken layout with long thirdparty names
|
||||
Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid
|
||||
Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter
|
||||
Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result
|
||||
Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled
|
||||
|
||||
***** ChangeLog for 3.5.6 compared to 3.5.5 *****
|
||||
Fix: Avoid missing class error for fetch_thirdparty method #1973
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# \file dolibarr.pl
|
||||
# \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()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
# TODO Replace this with version of Dolibar we want to install
|
||||
return ( "x.y.z", "3.6.0");
|
||||
return ( "3.7.2", "3.6.3", "3.5.6" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_category
|
||||
@ -57,6 +56,26 @@ local ($d, $ver) = @_;
|
||||
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)
|
||||
# Returns HTML for table rows for options for installing dolibarr
|
||||
sub script_dolibarr_params
|
||||
@ -78,8 +97,7 @@ else {
|
||||
$rv .= &ui_table_row("Database for Dolibarr tables",
|
||||
&ui_database_select("db", undef, \@dbs, $d, "dolibarr"));
|
||||
$rv .= &ui_table_row("Install sub-directory under <tt>$hdir</tt>",
|
||||
&ui_opt_textbox("dir", "dolibarr", 30,
|
||||
"At top level"));
|
||||
&ui_opt_textbox("dir", &substitute_scriptname_template("dolibarr", $d), 30, "At top level"));
|
||||
if ($d->{'ssl'} && $ver >= 3.0) {
|
||||
$rv .= &ui_table_row("Force https connection?",
|
||||
&ui_yesno_radio("forcehttps", 0));
|
||||
@ -159,7 +177,8 @@ if ($opts->{'newdb'} && !$upgrade) {
|
||||
local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2);
|
||||
local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d);
|
||||
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 $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass);
|
||||
return (0, "Database connection failed : $dberr") if ($dberr);
|
||||
@ -201,12 +220,10 @@ if ($opts->{'path'} =~ /\w/) {
|
||||
if (!$upgrade) {
|
||||
local $cdef = "$opts->{'dir'}/conf/conf.php.example";
|
||||
&run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile));
|
||||
&set_ownership_permissions(undef, undef, 0777, $cfiledir);
|
||||
&set_ownership_permissions(undef, undef, 0666, $cfile);
|
||||
&set_permissions_as_domain_user($d, 0777, $cfiledir);
|
||||
&set_permissions_as_domain_user($d, 0666, $cfile);
|
||||
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
|
||||
&set_ownership_permissions(undef, undef, 0777, $docdir);
|
||||
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
|
||||
&set_ownership_permissions(undef, undef, 0777, $altdir);
|
||||
&set_permissions_as_domain_user($d, 0777, $docdir);
|
||||
}
|
||||
else {
|
||||
# Preserve old config file, documents and custom directory
|
||||
@ -289,8 +306,8 @@ else {
|
||||
local $dinstall = "$opts->{'dir'}/install";
|
||||
$dinstall =~ s/\/$//;
|
||||
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
|
||||
&set_ownership_permissions(undef, undef, 0644, $cfile);
|
||||
&set_ownership_permissions(undef, undef, 0755, $cfiledir);
|
||||
&set_permissions_as_domain_user($d, 0644, $cfile);
|
||||
&set_permissions_as_domain_user($d, 0755, $cfiledir);
|
||||
}
|
||||
|
||||
# Return a URL for the user
|
||||
@ -309,6 +326,7 @@ local $ipage = $opts->{'path'}."/install/".$page.".php";
|
||||
local ($iout, $ierror);
|
||||
|
||||
&post_http_connection($d, $ipage, $params, \$iout, \$ierror);
|
||||
print STDERR $iout;
|
||||
|
||||
if ($ierror) {
|
||||
return $ierror;
|
||||
@ -329,10 +347,10 @@ local $derr = &delete_script_install_directory($d, $opts);
|
||||
return (0, $derr) if ($derr);
|
||||
|
||||
# Remove all llx_ tables from the database
|
||||
# 3 times because of constraints
|
||||
&cleanup_script_database($d, $opts->{'db'}, "llx_");
|
||||
&cleanup_script_database($d, $opts->{'db'}, "llx_");
|
||||
&cleanup_script_database($d, $opts->{'db'}, "llx_");
|
||||
# 4 times because of constraints
|
||||
for(my $i=0; $i<4; $i++) {
|
||||
&cleanup_script_database($d, $opts->{'db'}, "llx_");
|
||||
}
|
||||
|
||||
# Take out the DB
|
||||
if ($opts->{'newdb'}) {
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
# This directory contains script example to use ansible to deploy or maitains dolibarr instances
|
||||
|
||||
This is a quick tutorial:
|
||||
|
||||
* Install ansible:
|
||||
> apt-get install ansible
|
||||
|
||||
* Add ip of server to manage into
|
||||
/etc/ansible/hosts
|
||||
|
||||
* Deploy public key to managed servers
|
||||
- authorized_key: user=charlie key="{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"
|
||||
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env ansible-playbook
|
||||
|
||||
# Run script with ansible-playbook deploydev.yml
|
||||
# or ./deploydev.yml
|
||||
|
||||
- name: Configure webserver with apache
|
||||
hosts: webservers
|
||||
sudo: True
|
||||
tasks:
|
||||
- name: install apache
|
||||
apt: name=apache update_cache=yes
|
||||
- name: copy apache config file
|
||||
copy: src=files/apachealias.conf dest=/etc/apache/conf.d/dolibarr_dev
|
||||
#- name: enable configuration
|
||||
# file: >
|
||||
# dest=/etc/apache/sites-enabled/default
|
||||
# src=/etc/apache/sites-available/default
|
||||
# state=link
|
||||
- name: copy info.html
|
||||
template: src=templates/info.html.j2 dest=/var/www/dolibarr_dev/info.html
|
||||
mode=0644
|
||||
- name: restart apache
|
||||
service: name=apache state=restarted
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
|
||||
Alias /dolibarr_dev /var/www/dolibarr
|
||||
@ -1,2 +0,0 @@
|
||||
[webservers]
|
||||
testserver ansible_ssh_host=127.0.0.1 ansible_ssh_port=22
|
||||
@ -1,10 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Page info ansible</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Apache, configured by Ansible</h1>
|
||||
<p>If you can see this, Ansible successfully installed apache.</p>
|
||||
<p>{{ ansible_managed }}</p>
|
||||
</body>
|
||||
</html>
|
||||
@ -222,10 +222,11 @@ class Skeleton_Class extends CommonObject
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @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);
|
||||
|
||||
@ -240,14 +241,19 @@ class Skeleton_Class extends CommonObject
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -145,6 +145,7 @@ if ($result) {
|
||||
|
||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
print '<br/><br/>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
<?PHP
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,19 +20,19 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("companies");
|
||||
@ -41,383 +40,355 @@ $langs->load("compta");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Search & action GETPOST
|
||||
// search & action GETPOST
|
||||
$action = GETPOST('action');
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
$account_number_buy = GETPOST('account_number_buy');
|
||||
$chk_prod = GETPOST('chk_prod', 'array');
|
||||
$account_number_buy = GETPOST('account_number_buy');
|
||||
$account_number_sell = GETPOST('account_number_sell');
|
||||
$changeaccount = GETPOST('changeaccount','array');
|
||||
$changeaccount_buy = GETPOST('changeaccount_buy','array');
|
||||
$changeaccount_sell = GETPOST('changeaccount_sell','array');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$changeaccount = GETPOST('changeaccount', 'array');
|
||||
$changeaccount_buy = GETPOST('changeaccount_buy', 'array');
|
||||
$changeaccount_sell = GETPOST('changeaccount_sell', 'array');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount');
|
||||
$btn_changetype = GETPOST('changetype');
|
||||
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0) $page = 0;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
//bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
||||
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
//} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
// $limit = $conf->liste_limit;
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
// } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
// $limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield)
|
||||
$sortfield = "p.ref";
|
||||
if (! $sortorder)
|
||||
$sortorder = "ASC";
|
||||
|
||||
// sales or purchase
|
||||
if ($action == 'update') {
|
||||
if (! empty($btn_changetype)) {
|
||||
$error = 0;
|
||||
|
||||
$accounting_product_modes = array (
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_BUY'
|
||||
);
|
||||
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($btn_changeaccount)) {
|
||||
$msg = '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($chk_prod)) {
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
$msg .= '<div><font color="red">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
|
||||
|
||||
$cpt = 0;
|
||||
foreach ( $chk_prod as $productid ) {
|
||||
|
||||
$accounting_account_id=GETPOST('codeventil_'.$productid);
|
||||
|
||||
$result=$accounting->fetch($accounting_account_id,null,1);
|
||||
if ($result<0) {
|
||||
//setEventMessage(null, $accounting->errors,'errors');
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
} else {
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " SET accountancy_code_buy = " . $accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
|
||||
}
|
||||
$sql .= " WHERE rowid = " . $productid;
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||
} else {
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $accounting->account_number . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$cpt ++;
|
||||
}
|
||||
} else {
|
||||
$msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
||||
}
|
||||
$msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
// TODO after adding menu
|
||||
// if (! $user->rights->accounting->ventilation->dispatch)
|
||||
// accessforbidden();
|
||||
accessforbidden();
|
||||
// TODO after adding menu
|
||||
// if (! $user->rights->accounting->ventilation->dispatch)
|
||||
// accessforbidden();
|
||||
|
||||
$form = new FormVentilation($db);
|
||||
|
||||
//Defaut AccountingAccount RowId Product / Service
|
||||
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
|
||||
//so we need to get those default value rowid first
|
||||
// Defaut AccountingAccount RowId Product / Service
|
||||
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
|
||||
// so we need to get those default value rowid first
|
||||
$accounting = new AccountingAccount($db);
|
||||
//TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
||||
$aarowid_prodbuy = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
|
||||
$aarowid_servsell = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
||||
$aarowid_prodsell = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_label='';
|
||||
$search_desc='';
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
}
|
||||
|
||||
//TODO: modify to update all selected product with a sell account
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_sell")) {
|
||||
$error = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql1 .= " SET p.accountancy_code_sell=" . $account_number_sell;
|
||||
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
// Debug
|
||||
// print_r ($sql1);
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount product sell sql= ' . $sql1);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Save'), 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: modify to update all selected product with a buy account
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_buy")) {
|
||||
$error = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql1 .= " SET p.accountancy_code_buy=" . $account_number_buy;
|
||||
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
// Debug
|
||||
// print_r ($sql1);
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount product buy sql= ' . $sql1);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Save'), 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
}
|
||||
}
|
||||
// debug move header to top
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
|
||||
// For updating account export
|
||||
print '<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
//TODO For select box
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
//TODO
|
||||
/*
|
||||
if ($action == 'ventil') {
|
||||
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($codeventil_buy) && ! empty($mesCasesCochees)) {
|
||||
if (! empty($codeventil_sell) && ! empty($mesCasesCochees)) {
|
||||
|
||||
} else {
|
||||
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
||||
}
|
||||
print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
|
||||
}
|
||||
*/
|
||||
//do we really need to exclude old product not tosell / tobuy ?
|
||||
//$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
|
||||
//$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
|
||||
//$sql .= " WHERE p.accountancy_code_sell ='' AND p.tosell = 1 OR p.accountancy_code_buy ='' AND p.tobuy = 1";
|
||||
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
|
||||
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
//$sql .= " , " . MAIN_DB_PREFIX . "accountingaccount as aa";
|
||||
$sql .= " WHERE (";
|
||||
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||
|
||||
//Search on correct pcg version
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
|
||||
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
|
||||
|
||||
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL ";
|
||||
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
}
|
||||
|
||||
$sql .= ")";
|
||||
//Add search filter like
|
||||
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
||||
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '" . $search_label . "%')";
|
||||
$sql .= " AND (p.label like '" . $search_label . "%')";
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (p.description like '%" . $search_desc . "%')";
|
||||
$sql .= " AND (p.description like '%" . $search_desc . "%')";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
/*
|
||||
|
||||
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td> ';
|
||||
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder);
|
||||
print ' ';
|
||||
|
||||
|
||||
//DEBUG
|
||||
//print $sql;
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post"><br />';
|
||||
// print '<input type="hidden" name="action" value="ventil">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td width="33%">';
|
||||
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
|
||||
print $langs->trans("Accountancy_code_buy") . ': ' . $form->select_account($account_number_buy, 'account_number_buy', 1,'', 0, 1);
|
||||
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_buy") . '"/></div>';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="33%">';
|
||||
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
|
||||
print $langs->trans("Accountancy_code_sell") . ': ' . $form->select_account($account_number_sell, 'account_number_sell', 1, '', 0, 1);
|
||||
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_sell") . '"/></div>';
|
||||
print '</td>';
|
||||
print '<td width="33%">';
|
||||
//TODO change button
|
||||
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
// print '<td align="left">' . $langs->trans("Ref") . '</td>';
|
||||
// print '<td align="left">' . $langs->trans("Label") . '</td>';
|
||||
// print '<td align="left">' . $langs->trans("Description") . '</td>';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||
print_liste_field_titre('');
|
||||
// print_liste_field_titre('');
|
||||
print '<td align="center" colspan="2">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
|
||||
print '<td class="liste_titre" colspan="3"> </td>';
|
||||
print '<td align="right" colspan="4" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
// print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
// print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '</td>';
|
||||
// print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = true;
|
||||
|
||||
|
||||
while ( $i < min($num_lines, 250) ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$compta_prodsell = $obj->accountancy_code_sell;
|
||||
if (empty($compta_prodsell)) {
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
} else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$compta_prodbuy = $obj->accountancy_code_buy;
|
||||
if (empty($compta_prodbuy)) {
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
} else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
//debug
|
||||
print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_prodbuy . ' -- compta_prodbuy_id' . $compta_prodbuy_id . '-- compta_prodsell:' . $compta_prodsell . '-- compta_prodsell_id' . $compta_prodsell_id . '</td>';
|
||||
|
||||
print "</tr>";
|
||||
print "<tr $bc[$var]>";
|
||||
// Ref produit as link
|
||||
$product_static->ref = $obj->ref;
|
||||
$product_static->id = $obj->rowid;
|
||||
$product_static->type = $obj->type;
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print '- ';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">' . $obj->label . '</td>';
|
||||
//TODO ADJUST DESCRIPTION SIZE
|
||||
// print '<td align="left">' . $obj->description . '</td>';
|
||||
//TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
|
||||
//acountingaccount buy
|
||||
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||
//TODO: replace by select
|
||||
// print '<td align="left">' . $compta_prodbuy . '</td>';
|
||||
//TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
print '<td align="center">';
|
||||
print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1);
|
||||
print '</td>';
|
||||
|
||||
//acountingaccount sel
|
||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||
|
||||
//TODO: replace by select
|
||||
//TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
print '<td align="center">';
|
||||
print $form->select_account($compta_prodsell_id, 'codeventil[]', 1);
|
||||
print '</td>';
|
||||
//action edit & select box
|
||||
print '<td align="center">' . $obj->rowid . '</td>';
|
||||
print '<td><a href="./card.php?id=' . $obj->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
//Checkbox select
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="changeaccount[]" value="' . $obj->rowid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr ' . $bc[false] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_sell') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductSell'));
|
||||
print "</td></tr>\n";
|
||||
print '<tr ' . $bc[true] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_buy') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductBuy')) . "</td></tr>\n";
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
if (! empty($msg)) {
|
||||
print $msg;
|
||||
}
|
||||
|
||||
// print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td> ';
|
||||
// print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "p.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print ' ';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||
} else {
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||
}
|
||||
// print_liste_field_titre('');
|
||||
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>' . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = true;
|
||||
|
||||
while ( $i < min($num_lines, 250) ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
$compta_prodsell = $obj->accountancy_code_sell;
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
} else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
|
||||
$compta_prodbuy = $obj->accountancy_code_buy;
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
} else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print "</tr>";
|
||||
print "<tr $bc[$var]>";
|
||||
// Ref produit as link
|
||||
$product_static->ref = $obj->ref;
|
||||
$product_static->id = $obj->rowid;
|
||||
$product_static->type = $obj->type;
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print '- ';
|
||||
print '</td>';
|
||||
print '<td align="left">' . dol_trunc($obj->label, 24) . '</td>';
|
||||
// TODO ADJUST DESCRIPTION SIZE
|
||||
// print '<td align="left">' . $obj->description . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
|
||||
// acountingaccount buy
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||
// TODO: replace by select
|
||||
// print '<td align="left">' . $compta_prodbuy . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
print '<td align="center">';
|
||||
print $form->select_account($compta_prodbuy_id, 'codeventil_'.$product_static->id, 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
|
||||
// acountingaccount sel
|
||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||
// TODO: replace by select
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
print '<td align="center">';
|
||||
print $form->select_account($compta_prodsell_id, 'codeventil_'.$product_static->id, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Change_Account") . '"></div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
} else {
|
||||
// print $db->error();
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "</table></form>";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -65,8 +65,10 @@ class AccountingAccount extends CommonObject
|
||||
* @param string $account_number Account number
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null)
|
||||
function fetch($rowid = null, $account_number = null, $limittocurentchart=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
|
||||
@ -75,7 +77,9 @@ class AccountingAccount extends CommonObject
|
||||
} elseif ($account_number) {
|
||||
$sql .= " account_number = '" . $account_number . "'";
|
||||
}
|
||||
|
||||
if (!empty($limittocurentchart)) {
|
||||
$sql .=' AND fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')';
|
||||
}
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -101,7 +105,8 @@ class AccountingAccount extends CommonObject
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
$this->error="Error " . $this->db->lasterror();
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
@ -27,10 +27,13 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->load("main");
|
||||
@ -38,23 +41,23 @@ $langs->load("accountancy");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
//Search Getpost
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_invoice = GETPOST('search_invoice','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','alpha');
|
||||
$search_vat = GETPOST('search_vat','alpha');
|
||||
|
||||
//Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
|
||||
//if ($page == -1) { $page = 0; }
|
||||
if ($page < 0) $page = 0;
|
||||
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
//$limit = $conf->liste_limit;
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
@ -62,19 +65,11 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
//$offset = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
|
||||
// TODO : remove comment
|
||||
//elarifr we can not use only
|
||||
//$sql .= " ORDER BY l.rowid";
|
||||
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
|
||||
// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
|
||||
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
|
||||
//if (! $sortfield) $sortfield="f.facnumber";
|
||||
|
||||
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
|
||||
|
||||
//if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
$sortorder = " DESC ";
|
||||
@ -98,6 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_desc='';
|
||||
$search_amount='';
|
||||
$search_account='';
|
||||
$search_vat='';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
@ -181,6 +177,10 @@ if (strlen(trim($search_amount))) {
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat)))
|
||||
{
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
}
|
||||
@ -210,6 +210,7 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('');
|
||||
@ -222,6 +223,7 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
|
||||
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
@ -257,6 +259,7 @@ if ($result) {
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codecompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
@ -275,4 +278,4 @@ if ($result) {
|
||||
print "</table></form>";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -24,14 +24,13 @@
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Ventilation page from customers invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -42,24 +41,25 @@ $langs->load("accountancy");
|
||||
|
||||
$action = GETPOST('action');
|
||||
|
||||
//Select Box
|
||||
// Select Box
|
||||
$codeventil = GETPOST('codeventil', 'array');
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
|
||||
//Search Getpost
|
||||
$search_invoice = GETPOST('search_invoice','alpha');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','alpha');
|
||||
$search_vat = GETPOST('search_vat','alpha');
|
||||
// Search Getpost
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
|
||||
//Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page');
|
||||
if ($page < 0) $page = 0;
|
||||
// Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
@ -70,7 +70,8 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
|
||||
if (! $sortfield)
|
||||
$sortfield = "f.datef, f.facnumber, l.rowid";
|
||||
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
@ -91,23 +92,23 @@ $aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
||||
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter"))
|
||||
{
|
||||
$search_ref='';
|
||||
$search_invoice='';
|
||||
$search_label='';
|
||||
$search_desc='';
|
||||
$search_amount='';
|
||||
$search_account='';
|
||||
$search_vat='';
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
@ -139,18 +140,18 @@ if ($action == 'ventil') {
|
||||
$monId = $maLigneCourante[0];
|
||||
$monNumLigne = $maLigneCourante[1];
|
||||
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||
$sql .= " WHERE rowid = " . $monId;
|
||||
|
||||
|
||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||
} else {
|
||||
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
|
||||
|
||||
$cpt ++;
|
||||
}
|
||||
} else {
|
||||
@ -163,7 +164,6 @@ if ($action == 'ventil') {
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod";
|
||||
$sql .= " , aa.rowid as aarowid";
|
||||
@ -177,8 +177,7 @@ $sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_invoice)))
|
||||
{
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND (f.facnumber like '%" . $search_invoice . "%')";
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
@ -190,16 +189,13 @@ if (strlen(trim($search_label))) {
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||
}
|
||||
if (strlen(trim($search_amount)))
|
||||
{
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account)))
|
||||
{
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat)))
|
||||
{
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
|
||||
@ -207,7 +203,7 @@ if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
@ -216,87 +212,86 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"],"f.datef","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
|
||||
print ' ';
|
||||
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"l.rowid","",$param,'',$sortfield,$sortorder);
|
||||
|
||||
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
|
||||
print '</tr>';
|
||||
|
||||
// We add search filter
|
||||
|
||||
|
||||
// We add search filter
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre">%<input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount. '"></td>';
|
||||
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td align="right" colspan="2" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td align="right" class="liste_titre" colspan="4">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
$var = true;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$objp->code_sell_l = '';
|
||||
$objp->code_sell_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
$code_sell_p_l_differ = '';
|
||||
|
||||
|
||||
$code_sell_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
if ( ! empty($objp->code_sell)) {
|
||||
if (! empty($objp->code_sell)) {
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
} else {
|
||||
$code_sell_p_notset = 'color:red';
|
||||
if ($objp->type == 1) {
|
||||
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
elseif ($objp->type == 0) {
|
||||
} elseif ($objp->type == 0) {
|
||||
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
}
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
|
||||
}
|
||||
elseif ($objp->type_l == 0) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
|
||||
}
|
||||
if ($objp->code_sell_l <> $objp->code_sell_p) $code_sell_p_l_differ = 'color:red';
|
||||
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
}
|
||||
if ($objp->code_sell_l != $objp->code_sell_p)
|
||||
$code_sell_p_l_differ = 'color:red';
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
|
||||
// Ref Invoice
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
@ -311,21 +306,25 @@ if ($result) {
|
||||
else
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
|
||||
print '<td align="right">';
|
||||
print price($objp->total_ht);
|
||||
print '</td>';
|
||||
if ($objp->vat_tx_l <> $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="center">';
|
||||
print price($objp->tva_tx_line);
|
||||
print '</td>';
|
||||
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
||||
if ($objp->code_sell_l == $objp->code_sell_p) {
|
||||
print $objp->code_sell_l;
|
||||
} else {
|
||||
print 'lines='.$objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
|
||||
print 'lines=' . $objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="center">';
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
|
||||
print '</td>';
|
||||
@ -336,7 +335,7 @@ if ($result) {
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
|
||||
print '</form>';
|
||||
@ -345,4 +344,4 @@ if ($result) {
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@ -26,11 +26,14 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
@ -39,24 +42,45 @@ $langs->load("accountancy");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
//Search Getpost
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_invoice = GETPOST('search_invoice','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','alpha');
|
||||
$search_vat = GETPOST('search_vat','alpha');
|
||||
|
||||
//Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
|
||||
if ($page == -1) { $page = 0; }
|
||||
if ($page < 0) $page = 0;
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
$limit = $conf->liste_limit;
|
||||
if (! $sortfield) $sortfield="f.ref";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION))
|
||||
{
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
}
|
||||
else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0)
|
||||
{
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
|
||||
|
||||
if (! $sortorder)
|
||||
{
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0)
|
||||
{
|
||||
$sortorder = " DESC ";
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
@ -75,6 +99,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_desc='';
|
||||
$search_amount='';
|
||||
$search_account='';
|
||||
$search_vat='';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
@ -124,9 +149,6 @@ print '<script type="text/javascript">
|
||||
});
|
||||
</script>';
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
/*
|
||||
* Supplier Invoice lines
|
||||
@ -157,6 +179,10 @@ if (strlen(trim($search_amount))) {
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat)))
|
||||
{
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
|
||||
}
|
||||
@ -187,6 +213,7 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('');
|
||||
@ -198,11 +225,12 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
print "</td></tr>\n";
|
||||
|
||||
$facturefournisseur_static = new FactureFournisseur($db);
|
||||
$product_static = new Product($db);
|
||||
@ -234,6 +262,7 @@ if ($result) {
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codeCompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
@ -253,4 +282,4 @@ if ($result) {
|
||||
print "</table></form>";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -24,14 +24,13 @@
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Ventilation page from suppliers invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -41,18 +40,28 @@ $langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$action = GETPOST('action');
|
||||
|
||||
// Select Box
|
||||
$codeventil = GETPOST('codeventil', 'array');
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
//Should move to top with all GETPOST
|
||||
// Search Getpost
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
|
||||
$page = GETPOST('page');
|
||||
if ($page < 0) $page = 0;
|
||||
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
@ -62,18 +71,9 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
//End Should move to top with all GETPOST
|
||||
|
||||
|
||||
// TODO : remove comment
|
||||
//elarifr we can not use only
|
||||
//$sql .= " ORDER BY l.rowid";
|
||||
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
|
||||
// f.ref will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
|
||||
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
|
||||
//if (! $sortfield) $sortfield="l.rowid";
|
||||
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
|
||||
//if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield)
|
||||
$sortfield = "f.datef, f.ref, l.rowid";
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
$sortorder = " DESC ";
|
||||
@ -88,21 +88,24 @@ if (! $user->rights->accounting->ventilation->dispatch)
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
//Defaut AccountingAccount RowId Product / Service
|
||||
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
|
||||
//so we need to get those default value rowid first
|
||||
// Defaut AccountingAccount RowId Product / Service
|
||||
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
|
||||
// so we need to get those default value rowid first
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
//TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
||||
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_label='';
|
||||
$search_desc='';
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -110,10 +113,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
*/
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
//debug
|
||||
//print_r($aarowid_s);
|
||||
//print_r($aarowid_p);
|
||||
print '<script type="text/javascript">
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
@ -133,31 +133,31 @@ print '<script type="text/javascript">
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'ventil') {
|
||||
if ($action == 'ventil' && !empty($btn_ventil)) {
|
||||
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) {
|
||||
print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
|
||||
$mesCodesVentilChoisis = $codeventil;
|
||||
$cpt = 0;
|
||||
|
||||
|
||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
||||
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
|
||||
$maLigneCourante = explode("_", $maLigneCochee);
|
||||
$monId = $maLigneCourante[0];
|
||||
$monNumLigne = $maLigneCourante[1];
|
||||
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||
$sql .= " WHERE rowid = " . $monId;
|
||||
|
||||
|
||||
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||
} else {
|
||||
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
|
||||
|
||||
$cpt ++;
|
||||
}
|
||||
} else {
|
||||
@ -170,22 +170,9 @@ if ($action == 'ventil') {
|
||||
* Supplier Invoice Lines
|
||||
*
|
||||
*/
|
||||
$page = GETPOST('page');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
$limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, ";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy";
|
||||
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, l.tva_tx as tva_tx_line, ";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod";
|
||||
$sql .= " , aa.rowid as aarowid";
|
||||
$sql .= " , f.datef";
|
||||
$sql .= " , l.product_type as type_l";
|
||||
@ -195,9 +182,12 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_buy = aa.account_number";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
||||
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
|
||||
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND (f.ref like '%" . $search_invoice . "%')";
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
|
||||
}
|
||||
@ -207,11 +197,20 @@ if (strlen(trim($search_label))) {
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
@ -220,32 +219,49 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
|
||||
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre">%<input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<td class="liste_titre"> </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 ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$facturefourn_static = new FactureFournisseur($db);
|
||||
$productfourn_static = new ProductFournisseur($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
$var = True;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
@ -258,43 +274,43 @@ if ($result) {
|
||||
$objp->code_buy_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
$code_buy_p_l_differ = '';
|
||||
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
|
||||
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
if ( ! empty($objp->code_buy)) {
|
||||
if (! empty($objp->code_buy)) {
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:red';
|
||||
if ($objp->type == 1) {
|
||||
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($objp->type == 0) {
|
||||
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
}
|
||||
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
|
||||
}
|
||||
elseif ($objp->type_l == 0) {
|
||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
|
||||
}
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
}
|
||||
|
||||
if ($objp->code_buy_l <> $objp->code_buy_p) $code_buy_p_l_differ = 'color:red';
|
||||
if ($objp->code_buy_l != $objp->code_buy_p)
|
||||
$code_buy_p_l_differ = 'color:red';
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
|
||||
// Ref Invoice
|
||||
$facturefourn_static->ref = $objp->ref;
|
||||
$facturefourn_static->id = $objp->facid;
|
||||
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
|
||||
|
||||
|
||||
// Ref Supplier Invoice
|
||||
$productfourn_static->ref = $objp->product_ref;
|
||||
$productfourn_static->id = $objp->product_id;
|
||||
@ -305,26 +321,32 @@ if ($result) {
|
||||
else
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
|
||||
|
||||
// TODO: we should set a user defined value to adjust user square / wide screen size
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
|
||||
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
||||
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p)
|
||||
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="center">';
|
||||
print price($objp->tva_tx_line);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" style="' . $code_buy_p_notset . '">';
|
||||
//if not same kind of product_type stored in product & facturedt we display both account and let user choose
|
||||
// if not same kind of product_type stored in product & facturedt we display both account and let user choose
|
||||
if ($objp->code_buy_l == $objp->code_buy_p) {
|
||||
print $objp->code_buy_l;
|
||||
} else {
|
||||
print 'lines='.$objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
|
||||
print 'lines=' . $objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Colonne choix du compte
|
||||
print '<td align="center">';
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
|
||||
@ -332,19 +354,19 @@ if ($result) {
|
||||
print '<td align="center">' . $objp->rowid . '</td>';
|
||||
// Colonne choix ligne a ventiler
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid_suggest ? "checked" : "") . '/>';
|
||||
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil" ></div>';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
@ -615,7 +615,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i=0;
|
||||
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');
|
||||
}
|
||||
else if ($value == 'entity') {
|
||||
@ -663,7 +663,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i = 0;
|
||||
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');
|
||||
}
|
||||
else if ($field == 'entity') {
|
||||
@ -1274,17 +1274,20 @@ if ($id)
|
||||
$align="center";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax1') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax1 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if ($fieldlist[$field]=='localtax2') {
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
if ($obj->localtax2 == 0)
|
||||
$valuetoshow = '';
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('taux','localtax1','localtax2')))
|
||||
{
|
||||
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
|
||||
$align="right";
|
||||
}
|
||||
else if (in_array($fieldlist[$field],array('recuperableonly')))
|
||||
|
||||
@ -3138,11 +3138,12 @@ class PropaleLigne extends CommonObjectLine
|
||||
if (empty($this->total_localtax2)) $this->total_localtax2=0;
|
||||
if (empty($this->rang)) $this->rang=0;
|
||||
if (empty($this->remise)) $this->remise=0;
|
||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->remise_percent) || ! is_numeric($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
if (! is_numeric($this->qty)) $this->qty = 0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
|
||||
@ -266,8 +266,11 @@ print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</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">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
@ -287,8 +290,11 @@ foreach ($data as $val)
|
||||
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="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" 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" style="'.(($val['avg_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['avg_diff']).'</td>';
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
@ -279,8 +279,11 @@ print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</td>';
|
||||
print '<td align="center">'.$langs->trans("NbOfOrders").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
@ -302,8 +305,11 @@ foreach ($data as $val)
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></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" 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" style="'.(($val['avg_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['avg_diff']).'</td>';
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
@ -579,7 +579,7 @@ else
|
||||
|
||||
// State
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($account->fk_departement > 0) print getState($account->fk_departement);
|
||||
if ($account->state_id > 0) print getState($account->state_id);
|
||||
print '</td></tr>';
|
||||
|
||||
// Conciliate
|
||||
|
||||
@ -263,8 +263,11 @@ print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
print '<td align="center">'.$langs->trans("Year").'</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">%</td>';
|
||||
print '<td align="center">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '<td align="center">%</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
@ -284,8 +287,11 @@ foreach ($data as $val)
|
||||
print '<tr height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></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" 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" style="'.(($val['avg_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['avg_diff']).'</td>';
|
||||
print '</tr>';
|
||||
$oldyear=$year;
|
||||
}
|
||||
|
||||
@ -554,13 +554,20 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti
|
||||
|
||||
if ($conf->salaries->enabled)
|
||||
{
|
||||
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
} else {
|
||||
$column = 'p.datep';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
|
||||
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
|
||||
$sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
|
||||
$sql.= " ORDER BY u.firstname";
|
||||
|
||||
|
||||
@ -477,9 +477,16 @@ $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$acti
|
||||
/*
|
||||
* Salaries
|
||||
*/
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
} else {
|
||||
$column = 'p.datep';
|
||||
}
|
||||
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
$sql = "SELECT p.label as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY p.label, dm";
|
||||
|
||||
@ -3,12 +3,12 @@
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* 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-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* 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
|
||||
* 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');
|
||||
}
|
||||
} elseif ($action=='setref_supplier') {
|
||||
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
|
||||
if (!$cancelbutton) {
|
||||
@ -771,9 +770,8 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
|
||||
if ($result < 0) {
|
||||
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) {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
$action = 'editref_supplier';
|
||||
@ -782,17 +780,32 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
||||
exit;
|
||||
}
|
||||
} elseif ($action=='setref') {
|
||||
$object->ref=GETPOST('ref','alpha');
|
||||
$cancelbutton = GETPOST('cancel');
|
||||
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->errors,'errors');
|
||||
$action='editref';
|
||||
} else {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
if (!$cancelbutton) {
|
||||
$result = $object->fetch($id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->errors, 'errors');
|
||||
}
|
||||
|
||||
$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)
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.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 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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_public)) $this->note_public=trim($this->note_public);
|
||||
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.= " 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.= " 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.= " 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.= " WHERE rowid=".$this->id;
|
||||
|
||||
@ -122,7 +122,8 @@ class box_task extends ModeleBoxes
|
||||
|
||||
|
||||
// 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")." ".$textHead);
|
||||
$this->info_box_contents[$i][0] = array('tr' => 'class="liste_total"', 'td' => 'align="left"', 'text' => $langs->trans("Total")." ".$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, ',', ' ')." ".$langs->trans("Tasks"));
|
||||
$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));
|
||||
|
||||
@ -95,6 +95,7 @@ class HookManager
|
||||
$pathroot = '';
|
||||
|
||||
// Include actions class overwriting hooks
|
||||
dol_syslog('Loading hook:' . $actionfile, LOG_INFO);
|
||||
$resaction=dol_include_once($path.$actionfile);
|
||||
if ($resaction)
|
||||
{
|
||||
|
||||
@ -2072,10 +2072,12 @@ class Form
|
||||
if ($filterkey && $filterkey != '') $label=preg_replace('/('.preg_quote($filterkey).')/i','<strong>$1</strong>',$label,1);
|
||||
|
||||
$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.=' - ';
|
||||
$outval.=$objRef;
|
||||
if (! empty($objp->idprodfournprice)) $outval.=' ('.$objRefFourn.')';
|
||||
if (! empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn))
|
||||
$outval.=' ('.$objRefFourn.')';
|
||||
$outval.=' - ';
|
||||
$opt.=dol_trunc($label, 72).' - ';
|
||||
$outval.=dol_trunc($label, 72).' - ';
|
||||
@ -2110,7 +2112,7 @@ class Form
|
||||
$outval.= ' '.$langs->transnoentities("Units");
|
||||
}
|
||||
|
||||
if ($objp->quantity >= 1)
|
||||
if ($objp->quantity > 1)
|
||||
{
|
||||
$opt.=" (".price($objp->unitprice,1,$langs,0,0,-1,$conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
||||
$outval.=" (".price($objp->unitprice,0,$langs,0,0,-1,$conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
|
||||
|
||||
@ -56,7 +56,7 @@ abstract class Stats
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache';
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask='0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
@ -150,7 +150,7 @@ abstract class Stats
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache';
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask='0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
@ -276,7 +276,7 @@ abstract class Stats
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
}
|
||||
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache';
|
||||
$newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_entity.'.$conf->entity.'_user'.$user->id.'.cache';
|
||||
$newmask='0644';
|
||||
|
||||
$nowgmt = dol_now();
|
||||
@ -383,8 +383,11 @@ abstract class Stats
|
||||
$row = $this->db->fetch_object($resql);
|
||||
$result[$i]['year'] = $row->year;
|
||||
$result[$i]['nb'] = $row->nb;
|
||||
if($i>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
|
||||
$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;
|
||||
if($i>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -897,7 +897,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='')
|
||||
*/
|
||||
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
global $bc,$user;
|
||||
global $bc,$user,$conf;
|
||||
|
||||
// Check parameters
|
||||
if (! is_object($object)) dol_print_error('','BadParameter');
|
||||
@ -915,12 +915,22 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$out.="\n";
|
||||
$out.='<table width="100%" class="noborder">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td colspan="2">';
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE) $out.='<td colspan="3">';
|
||||
else $out.='<td colspan="2">';
|
||||
if (get_class($object) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&status=todo">';
|
||||
$out.=$langs->trans("ActionsToDoShort");
|
||||
if (get_class($object) == 'Societe') $out.='</a>';
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="5" align="right">';
|
||||
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE) {
|
||||
$out.='<td>';
|
||||
$out.=$langs->trans("Type");
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="4" align="right">';
|
||||
} else {
|
||||
$out.='<td colspan="5" align="right">';
|
||||
}
|
||||
|
||||
$out.='</td>';
|
||||
$out.='</tr>';
|
||||
|
||||
@ -965,7 +975,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$var = !$var;
|
||||
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$actionstatic->fetch($obj->id);
|
||||
$datep=$db->jdate($obj->dp);
|
||||
$datep2=$db->jdate($obj->dp2);
|
||||
|
||||
@ -999,8 +1009,13 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
|
||||
// Title of event
|
||||
//$out.='<td colspan="2">'.dol_trunc($obj->label,40).'</td>';
|
||||
$out.='<td colspan="2">'.$actionstatic->getNomUrl(1,120).'</td>';
|
||||
|
||||
$out.='<td>'.$actionstatic->getNomUrl(1,120).'</td>';
|
||||
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE) {
|
||||
$out.= '<td>';
|
||||
$out.=$actionstatic->type;
|
||||
$out.='</td>';
|
||||
}
|
||||
// Contact pour cette action
|
||||
if (empty($objcon->id) && $obj->fk_contact > 0)
|
||||
{
|
||||
@ -1063,7 +1078,7 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
*/
|
||||
function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
global $bc,$user;
|
||||
global $bc,$user,$conf;
|
||||
|
||||
// Check parameters
|
||||
if (! is_object($object)) dol_print_error('','BadParameter');
|
||||
@ -1202,12 +1217,22 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$out.="\n";
|
||||
$out.='<table class="noborder" width="100%">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td colspan="2">';
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE) $out.='<td colspan="3">';
|
||||
else $out.='<td colspan="2">';
|
||||
if (get_class($object) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&status=done">';
|
||||
$out.=$langs->trans("ActionsDoneShort");
|
||||
if (get_class($object) == 'Societe') $out.='</a>';
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="5" align="right">';
|
||||
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE) {
|
||||
$out.='<td>';
|
||||
$out.=$langs->trans("Type");
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="4" align="right">';
|
||||
} else {
|
||||
$out.='<td colspan="5" align="right">';
|
||||
}
|
||||
|
||||
$out.='</td>';
|
||||
$out.='</tr>';
|
||||
|
||||
@ -1215,7 +1240,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
$var=!$var;
|
||||
$out.="<tr ".$bc[$var].">";
|
||||
|
||||
$actionstatic->fetch($histo[$key]['id']);
|
||||
// Champ date
|
||||
$out.='<td width="120" class="nowrap">';
|
||||
$out.=dol_print_date($histo[$key]['datestart'],'dayhour');
|
||||
@ -1251,7 +1276,12 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
$out.=dol_trunc($libelle,120);
|
||||
}
|
||||
$out.='</td>';
|
||||
|
||||
|
||||
if($conf->global->AGENDA_USE_EVENT_TYPE) {
|
||||
$out.='<td>';
|
||||
$out.=$actionstatic->type;
|
||||
$out.='</td>';
|
||||
}
|
||||
// Title of event
|
||||
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
|
||||
|
||||
|
||||
@ -2015,7 +2015,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $
|
||||
$tmparray=array(0=>$titlealt);
|
||||
if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
|
||||
$title=$tmparray[0];
|
||||
$alt=empty($tmparray[1])?'':$tmparray[1];
|
||||
$alt=empty($tmparray[1])?$tmparray[0]:$tmparray[1]; // Use title for alt if no alt is provided
|
||||
return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* 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,
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
@ -18,11 +19,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup barcode Module barcode
|
||||
* \brief Module pour gerer les codes barres
|
||||
* \file htdocs/core/modules/modBarcode.class.php
|
||||
* \ingroup barcode,produit
|
||||
* \brief Fichier de description et activation du module Barcode
|
||||
* \defgroup barcode Module barcode
|
||||
* \brief Module pour gerer les codes barres
|
||||
* \file htdocs/core/modules/modBarcode.class.php
|
||||
* \ingroup barcode,produit
|
||||
* \brief Fichier de description et activation du module Barcode
|
||||
*/
|
||||
|
||||
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)
|
||||
{
|
||||
@ -56,7 +57,7 @@ class modBarcode extends DolibarrModules
|
||||
$this->dirs = array("/barcode/temp");
|
||||
|
||||
// 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();
|
||||
|
||||
// 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][4] = 'creer_advance';
|
||||
|
||||
// Main menu entries
|
||||
$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
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'barcodeprint',
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'BarCodePrintsheet',
|
||||
'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.
|
||||
'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.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
// Main menu entries
|
||||
$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
|
||||
'mainmenu'=>'tools',
|
||||
'leftmenu'=>'barcodeprint',
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'BarCodePrintsheet',
|
||||
'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.
|
||||
'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.
|
||||
'perms'=>'$user->rights->barcode->lire_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$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
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
$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
|
||||
'titre'=>'MassBarcodeInit',
|
||||
'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,
|
||||
'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
|
||||
'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'=>'$user->rights->barcode->creer_advance', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||
'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++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories.
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories.
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
|
||||
@ -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'));
|
||||
// Add extra fields
|
||||
$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);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
618
htdocs/core/modules/project/doc/pdf_beluga.modules.php
Normal file
618
htdocs/core/modules/project/doc/pdf_beluga.modules.php
Normal file
@ -0,0 +1,618 @@
|
||||
<?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):' '), 1, 'R');
|
||||
$pdf->SetXY($this->posxamountttc, $curY);
|
||||
$pdf->MultiCell($this->posxstatut-$this->posxamountttc, 3,
|
||||
(isset($element->total_ttc)?price($element->total_ttc):' '), 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):' '), 1, 'R');
|
||||
$pdf->SetXY($this->posxamountttc, $curY);
|
||||
$pdf->MultiCell($this->posxstatut-$this->posxamountttc, 3,
|
||||
(isset($element->total_ttc)?price($total_ttc):' '), 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);
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,1);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
|
||||
@ -353,7 +353,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc,1);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
|
||||
@ -50,7 +50,7 @@ $(document).ready(function () {
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<div align="center">
|
||||
<div class="center">
|
||||
<div class="login_vertical_align">
|
||||
|
||||
<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_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); ?>">
|
||||
<tr class="vmenu"><td align="center"><?php echo dol_escape_htmltag($title); ?></td></tr>
|
||||
<table class="login_table_title center" title="<?php echo dol_escape_htmltag($title); ?>">
|
||||
<tr class="vmenu"><td class="center"><?php echo dol_escape_htmltag($title); ?></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
@ -81,7 +81,7 @@ $(document).ready(function () {
|
||||
|
||||
<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>
|
||||
|
||||
@ -89,10 +89,11 @@ $(document).ready(function () {
|
||||
|
||||
<div id="login_right">
|
||||
|
||||
<table class="left centpercent" summary="Login pass">
|
||||
<table class="left centpercent" title="Login pass">
|
||||
<!-- Login -->
|
||||
<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">
|
||||
<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>
|
||||
@ -100,7 +101,8 @@ $(document).ready(function () {
|
||||
</tr>
|
||||
<!-- Password -->
|
||||
<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">
|
||||
<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>
|
||||
@ -126,7 +128,7 @@ if (! empty($hookmanager->resArray['options'])) {
|
||||
?>
|
||||
<!-- Captcha -->
|
||||
<tr>
|
||||
<td valign="top" class="nowrap none center">
|
||||
<td class="nowrap none center">
|
||||
|
||||
<table class="login_table_securitycode centpercent"><tr>
|
||||
<td>
|
||||
@ -165,7 +167,7 @@ if ($forgetpasslink || $helpcenterlink)
|
||||
if ($dol_use_jmobile) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile;
|
||||
|
||||
echo '<br>';
|
||||
echo '<div align="center" style="margin-top: 8px;">';
|
||||
echo '<div class="center" style="margin-top: 8px;">';
|
||||
if ($forgetpasslink) {
|
||||
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">(';
|
||||
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=
|
||||
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;
|
||||
if (! empty($url)) print '<a class="alogin" href="'.$url.'">'.$langs->trans("LoginUsingOpenID").'</a>';
|
||||
@ -286,7 +288,7 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLI
|
||||
if (empty($conf->dol_use_jmobile))
|
||||
{
|
||||
?>
|
||||
<div align="center"><br>
|
||||
<div class="center"><br>
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
|
||||
google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
* 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 '</td>';
|
||||
if ($action != 'editavailability')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $commande->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editavailability') {
|
||||
@ -345,7 +345,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print $langs->trans('Source');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason')
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $commande->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdemandreason') {
|
||||
|
||||
@ -949,7 +949,7 @@ $formfile = new FormFile($db);
|
||||
if ($conf->contrat->enabled)
|
||||
$formcontract = new FormContract($db);
|
||||
|
||||
llxHeader('',$langs->trans("Fichinter"));
|
||||
llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
|
||||
@ -106,7 +106,7 @@ $formcompany = new FormCompany($db);
|
||||
$contactstatic=new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
|
||||
llxHeader();
|
||||
llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
// Mode vue et edition
|
||||
|
||||
|
||||
@ -81,8 +81,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader("","",$langs->trans("InterventionCard"));
|
||||
|
||||
llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
|
||||
@ -49,7 +49,7 @@ if ($id > 0)
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
llxHeader('',$langs->trans("Intervention"));
|
||||
|
||||
$societe = new Societe($db);
|
||||
$societe->fetch($object->socid);
|
||||
|
||||
@ -2103,188 +2103,6 @@ else
|
||||
|
||||
$num=count($object->lines);
|
||||
|
||||
/*
|
||||
$var=1;
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
if ($i == 0)
|
||||
{
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans('Label').'</td>';
|
||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td align="right">'.$langs->trans('TotalHTShort').'</td>';
|
||||
print '<td align="right">'.$langs->trans('TotalTTCShort').'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Show product and description
|
||||
$type=(! empty($object->lines[$i]->product_type)?$object->lines[$i]->product_type:(! empty($object->lines[$i]->fk_product_type)?$object->lines[$i]->fk_product_type:0));
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type was not saved.
|
||||
$date_start='';
|
||||
$date_end='';
|
||||
if (! empty($object->lines[$i]->date_start))
|
||||
{
|
||||
$date_start=$object->lines[$i]->date_start;
|
||||
$type=1;
|
||||
}
|
||||
if (! empty($object->lines[$i]->date_end))
|
||||
{
|
||||
$date_end=$object->lines[$i]->date_end;
|
||||
$type=1;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
|
||||
// Edit line
|
||||
if ($object->statut == 0 && $action == 'editline' && $_GET['lineid'] == $object->lines[$i]->rowid)
|
||||
{
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// Show product and description
|
||||
print '<td>';
|
||||
|
||||
print '<input type="hidden" name="lineid" value="'.$object->lines[$i]->rowid.'">';
|
||||
|
||||
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product > 0)
|
||||
{
|
||||
print '<input type="hidden" name="idprod" value="'.$object->lines[$i]->fk_product.'">';
|
||||
$product_static=new ProductFournisseur($db);
|
||||
$product_static->fetch($object->lines[$i]->fk_product);
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$product_static->libelle;
|
||||
print $text;
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$forceall=1; // For suppliers, we always show all types
|
||||
print $form->select_type_of_lines($object->lines[$i]->product_type,'type',1,0,$forceall);
|
||||
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
$nbrows=ROWS_2;
|
||||
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
$doleditor=new DolEditor('desc',$object->lines[$i]->description,'',128,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td align="right">';
|
||||
print $form->load_tva('tauxtva',$object->lines[$i]->tva_tx,$societe,$mysoc);
|
||||
print '</td>';
|
||||
|
||||
// Unit price
|
||||
print '<td align="right" class="nowrap"><input size="4" name="puht" type="text" value="'.price($object->lines[$i]->pu_ht).'"></td>';
|
||||
|
||||
print '<td align="right" class="nowrap"><input size="4" name="puttc" type="text" value=""></td>';
|
||||
|
||||
print '<td align="right"><input size="1" name="qty" type="text" value="'.$object->lines[$i]->qty.'"></td>';
|
||||
|
||||
print '<td align="right" class="nowrap"><input size="1" name="remise_percent" type="text" value="'.$object->lines[$i]->remise_percent.'"><span class="hideonsmartphone">%</span></td>';
|
||||
|
||||
print '<td align="right" class="nowrap"> </td>';
|
||||
|
||||
print '<td align="right" class="nowrap"> </td>';
|
||||
|
||||
print '<td align="center" colspan="2"><input type="submit" class="button" name="save" value="'.$langs->trans('Save').'">';
|
||||
print '<br><input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
else // Affichage simple de la ligne
|
||||
{
|
||||
print '<tr id="row-'.$object->lines[$i]->rowid.'" '.$bc[$var].'>';
|
||||
|
||||
// Show product and description
|
||||
print '<td>';
|
||||
if ($object->lines[$i]->fk_product)
|
||||
{
|
||||
print '<a name="'.$object->lines[$i]->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
$product_static=new ProductFournisseur($db);
|
||||
$product_static->fetch($object->lines[$i]->fk_product);
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$product_static->libelle;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($object->lines[$i]->description));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($date_start,$date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) print ($object->lines[$i]->description && $object->lines[$i]->description!=$product_static->libelle)?'<br>'.dol_htmlentitiesbr($object->lines[$i]->description):'';
|
||||
}
|
||||
|
||||
// Description - Editor wysiwyg
|
||||
if (! $object->lines[$i]->fk_product)
|
||||
{
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($object->lines[$i]->description);
|
||||
|
||||
// Show range
|
||||
print_date_range($date_start,$date_end);
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('formViewProductSupplierOptions',$parameters,$object,$action);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td align="right">'.vatrate($object->lines[$i]->tva_tx, true, $object->lines[$i]->info_bits).'</td>';
|
||||
|
||||
// Unit price
|
||||
print '<td align="right" class="nowrap">'.price($object->lines[$i]->pu_ht,'MU').'</td>';
|
||||
|
||||
print '<td align="right" class="nowrap">'.($object->lines[$i]->pu_ttc?price($object->lines[$i]->pu_ttc,'MU'):' ').'</td>';
|
||||
|
||||
print '<td align="right">'.$object->lines[$i]->qty.'</td>';
|
||||
|
||||
print '<td align="right">'.(($object->lines[$i]->remise_percent > 0)?$object->lines[$i]->remise_percent.'%':'').'</td>';
|
||||
|
||||
print '<td align="right" class="nowrap">'.price($object->lines[$i]->total_ht).'</td>';
|
||||
|
||||
print '<td align="right" class="nowrap">'.price($object->lines[$i]->total_ttc).'</td>';
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('line'=>$object->lines[$i],'num'=>$num,'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action);
|
||||
}
|
||||
|
||||
print '<td align="center" width="16">';
|
||||
if ($object->statut == 0) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=editline&etat=0&lineid='.$object->lines[$i]->rowid.'">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" width="16">';
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_delete_line&lineid='.$object->lines[$i]->rowid.'">'.img_delete().'</a>';
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
// Form to add new line
|
||||
if ($object->statut == FactureFournisseur::STATUS_DRAFT && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
@ -2316,135 +2134,137 @@ else
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if (empty($reshook)) {
|
||||
|
||||
// Modify a validated invoice with no payments
|
||||
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||
|
||||
// Modify a validated invoice with no payments
|
||||
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
// Reopen a standard paid invoice
|
||||
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// Send by mail
|
||||
if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
|
||||
{
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Make payments
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&action=create &accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice
|
||||
}
|
||||
|
||||
// Classify paid
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid"';
|
||||
print '>'.$langs->trans('ClassifyPaid').'</a>';
|
||||
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||
}
|
||||
|
||||
// Validate
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
|
||||
{
|
||||
if (count($object->lines))
|
||||
{
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'"';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
//print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
//print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
|
||||
$ref=dol_sanitizeFileName($object->ref);
|
||||
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
|
||||
|
||||
print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
|
||||
$somethingshown=$formfile->numoffiles;
|
||||
|
||||
// Linked object block
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
//print '</td><td valign="top" width="50%">';
|
||||
//print '<br>';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($object,'invoice_supplier',$socid);
|
||||
|
||||
print '</div></div></div>';
|
||||
//print '</td></tr></table>';
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen a standard paid invoice
|
||||
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
// Send by mail
|
||||
if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
|
||||
{
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Make payments
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&action=create &accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice
|
||||
}
|
||||
|
||||
// Classify paid
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid"';
|
||||
print '>'.$langs->trans('ClassifyPaid').'</a>';
|
||||
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||
}
|
||||
|
||||
// Validate
|
||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
|
||||
{
|
||||
if (count($object->lines))
|
||||
{
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->fournisseur->supplier_invoice_advance->validate)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'"';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
//print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
//print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
|
||||
$ref=dol_sanitizeFileName($object->ref);
|
||||
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
|
||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
|
||||
|
||||
print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
|
||||
$somethingshown=$formfile->numoffiles;
|
||||
|
||||
// Linked object block
|
||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
|
||||
if ($linktoelem) print '<br>'.$linktoelem;
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
//print '</td><td valign="top" width="50%">';
|
||||
//print '<br>';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($object,'invoice_supplier',$socid);
|
||||
|
||||
print '</div></div></div>';
|
||||
//print '</td></tr></table>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Show mail form
|
||||
*/
|
||||
*/
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
create table llx_c_type_resource
|
||||
(
|
||||
rowid integer PRIMARY KEY,
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(32) NOT NULL,
|
||||
label varchar(64) NOT NULL,
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
|
||||
@ -330,8 +330,8 @@ PaymentTypeCB=Credit card
|
||||
PaymentTypeShortCB=Credit card
|
||||
PaymentTypeCHQ=Check
|
||||
PaymentTypeShortCHQ=Check
|
||||
PaymentTypeTIP=TIP
|
||||
PaymentTypeShortTIP=TIP
|
||||
PaymentTypeTIP=Deposit
|
||||
PaymentTypeShortTIP=Deposit
|
||||
PaymentTypeVAD=On line payment
|
||||
PaymentTypeShortVAD=On line payment
|
||||
PaymentTypeTRA=Bill payment
|
||||
|
||||
@ -10,6 +10,7 @@ PrintTestDesc=List of Printers.
|
||||
FileWasSentToPrinter=File %s was sent to printer
|
||||
NoActivePrintingModuleFound=No active module to print document
|
||||
PleaseSelectaDriverfromList=Please select a driver from list.
|
||||
PleaseConfigureDriverfromList=Please configure the selected driver from list.
|
||||
SetupDriver=Driver setup
|
||||
TestDriver=Test
|
||||
TargetedPrinter=Targeted printer
|
||||
|
||||
@ -10,6 +10,7 @@ PrintTestDesc=Listado de Impresoras.
|
||||
FileWasSentToPrinter=El archivo %s ha sido enviado a la impresora
|
||||
NoActivePrintingModuleFound=Sin módulo activo para imprimir documentos
|
||||
PleaseSelectaDriverfromList=Seleccione un driver del listado.
|
||||
PleaseConfigureDriverfromList=Configure el driver seleccionado del listado.
|
||||
SetupDriver=Configuración driver
|
||||
TestDriver=Prueba
|
||||
TargetedPrinter=Impresora destino
|
||||
|
||||
@ -10,6 +10,7 @@ PrintTestDesc=Liste des imprimantes
|
||||
FileWasSentToPrinter=Le fichier %s a été envoyé à l'imprimante
|
||||
NoActivePrintingModuleFound=Pas de module actif pour imprimer le document
|
||||
PleaseSelectaDriverfromList=Sélection un driver dans la liste
|
||||
PleaseConfigureDriverfromList=Configurer le driver sélectionné dans la liste.
|
||||
SetupDriver=Configuration du driver
|
||||
TestDriver=Test
|
||||
TargetedPrinter=Imprimante cible
|
||||
|
||||
@ -1059,14 +1059,14 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
}
|
||||
}
|
||||
}
|
||||
$themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity;
|
||||
$themeparam.=($ext?'&'.$ext:'');
|
||||
if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache'];
|
||||
if (GETPOST('dol_hide_topmenu')) { $themeparam.='&dol_hide_topmenu='.GETPOST('dol_hide_topmenu','int'); }
|
||||
if (GETPOST('dol_hide_leftmenu')) { $themeparam.='&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu','int'); }
|
||||
if (GETPOST('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen','int'); }
|
||||
if (GETPOST('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); }
|
||||
if (GETPOST('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); }
|
||||
$themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'&userid='.$user->id.'&entity='.$conf->entity;
|
||||
$themeparam.=($ext?'&'.$ext:'');
|
||||
if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache'];
|
||||
if (GETPOST('dol_hide_topmenu')) { $themeparam.='&dol_hide_topmenu='.GETPOST('dol_hide_topmenu','int'); }
|
||||
if (GETPOST('dol_hide_leftmenu')) { $themeparam.='&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu','int'); }
|
||||
if (GETPOST('dol_optimize_smallscreen')) { $themeparam.='&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen','int'); }
|
||||
if (GETPOST('dol_no_mouse_hover')) { $themeparam.='&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover','int'); }
|
||||
if (GETPOST('dol_use_jmobile')) { $themeparam.='&dol_use_jmobile='.GETPOST('dol_use_jmobile','int'); $conf->dol_use_jmobile=GETPOST('dol_use_jmobile','int'); }
|
||||
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
|
||||
print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
|
||||
if (! empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) print '<!-- Includes CSS that does not exists as workaround of flash bug of chrome -->'."\n".'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'."\n";
|
||||
|
||||
@ -229,7 +229,12 @@ if ($mode == 'test' && $user->admin)
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
print $printer->listAvailablePrinters();
|
||||
if (count($printer->getlist_available_printers)) {
|
||||
print $printer->listAvailablePrinters();
|
||||
}
|
||||
else {
|
||||
print $langs->trans('PleaseConfigureDriverfromList');
|
||||
}
|
||||
|
||||
} else {
|
||||
print $langs->trans('PleaseSelectaDriverfromList');
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -68,7 +69,7 @@ if ($sall) $sql.= natural_search(array('e.label','e.description','e.lieu','e.add
|
||||
$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
print $sql;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -823,7 +823,8 @@ class Task extends CommonObject
|
||||
{
|
||||
$tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time");
|
||||
$ret = $tasktime_id;
|
||||
|
||||
$this->timespent_id = $ret;
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
|
||||
@ -55,8 +55,8 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels_projet=$extrafields_project->fetch_name_optionals_label($object->table_element);
|
||||
$extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element);
|
||||
}
|
||||
$extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->table_element);
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
|
||||
@ -740,7 +740,7 @@ $formcompany = new FormCompany($db);
|
||||
|
||||
if ($socid > 0 && empty($object->id))
|
||||
{
|
||||
$res=$object->fetch($socid);
|
||||
$result=$object->fetch($socid);
|
||||
if ($result <= 0) dol_print_error('',$object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -418,6 +418,7 @@ textarea.centpercent {
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
margin: 0px auto;
|
||||
}
|
||||
.left {
|
||||
text-align: <?php print $left; ?>;
|
||||
@ -931,8 +932,7 @@ form#login {
|
||||
text-shadow: 1px 1px 1px #FFF;
|
||||
}
|
||||
.login_table {
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
margin: 0px auto; /* Center */
|
||||
padding-left:6px;
|
||||
padding-right:6px;
|
||||
padding-top:16px;
|
||||
|
||||
@ -264,7 +264,7 @@ if ($action == 'add' && $canadduser)
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
if (is_array($object->errors) && count($object->errors)) setEventMessage($object->errors,'errors');
|
||||
else setEventMessage($object->error);
|
||||
else setEventMessage($object->error, 'errors');
|
||||
$action="create"; // Go back to create page
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
||||
$result=$tmpuser->fetch(0, GETPOST("login"));
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorLoginAlreadyExists"), 'errors');
|
||||
setEventMessage($langs->trans("ErrorLoginAlreadyExists", GETPOST('login')), 'errors');
|
||||
$action="edit"; // Go back to create page
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -639,11 +639,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$s=img_picto('title','/fullpath/img.png','',1);
|
||||
print __METHOD__." s=".$s."\n";
|
||||
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto3');
|
||||
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto3');
|
||||
|
||||
$s=img_picto('title','/fullpath/img.png','',true);
|
||||
print __METHOD__." s=".$s."\n";
|
||||
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto4');
|
||||
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto4');
|
||||
|
||||
$s=img_picto('title:alt','/fullpath/img.png','',true);
|
||||
print __METHOD__." s=".$s."\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user