Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop
This commit is contained in:
commit
02f6bc7b4f
43
.travis.yml
43
.travis.yml
@ -2,19 +2,15 @@
|
|||||||
# from Dolibarr GitHub repository.
|
# from Dolibarr GitHub repository.
|
||||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
|
# We use dist: precise to have php 5.3 available
|
||||||
dist: precise
|
dist: precise
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
# Start on every boot
|
||||||
- '5.3'
|
services:
|
||||||
- '5.4'
|
- memcached
|
||||||
- '5.5'
|
|
||||||
- '5.6'
|
|
||||||
- '7.0'
|
|
||||||
- '7.1'
|
|
||||||
- nightly
|
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
mariadb: '10.0'
|
mariadb: '10.0'
|
||||||
@ -34,9 +30,15 @@ addons:
|
|||||||
# We need pgloader for import mysql database into pgsql
|
# We need pgloader for import mysql database into pgsql
|
||||||
- pgloader
|
- pgloader
|
||||||
|
|
||||||
# Start on every boot
|
php:
|
||||||
services:
|
- '5.3'
|
||||||
- memcached
|
- '5.4'
|
||||||
|
- '5.5'
|
||||||
|
- '5.6'
|
||||||
|
- '7.0'
|
||||||
|
- '7.1'
|
||||||
|
#- hhvm only with dist: trusty
|
||||||
|
- nightly
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
@ -57,11 +59,22 @@ env:
|
|||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: 7.1
|
- php: hhvm
|
||||||
- php: nightly
|
- php: nightly
|
||||||
#- env: DB=postgresql
|
# We exclude some combinations not usefull to save Travis CPU
|
||||||
# TODO
|
exclude:
|
||||||
#- env: DB=sqlite
|
- php: '5.4'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: '5.5'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: '5.6'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: '7.0'
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: hhvm
|
||||||
|
env: DB=postgresql
|
||||||
|
- php: nightly
|
||||||
|
env: DB=postgresql
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
|
|||||||
12
ChangeLog
12
ChangeLog
@ -5,11 +5,16 @@ English Dolibarr ChangeLog
|
|||||||
|
|
||||||
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
***** ChangeLog for 7.0.0 compared to 6.0.* *****
|
||||||
|
|
||||||
|
For developers:
|
||||||
|
NEW: Add hook addAdminLdapOptions and doAction in ldap admin page
|
||||||
|
NEW: complete_head_from_modules() in ldap_prepare_head()
|
||||||
|
|
||||||
WARNING:
|
WARNING:
|
||||||
|
|
||||||
Following changes may create regression for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
* The methode "cloture" on contact were renamed into "closeAll".
|
* The methode "cloture" on contact were renamed into "closeAll".
|
||||||
|
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
|
||||||
|
__PROPALREF__, ...)
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
***** ChangeLog for 6.0.0 compared to 5.0.* *****
|
||||||
@ -162,6 +167,9 @@ Following changes may create regression for some external modules, but were nece
|
|||||||
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
|
||||||
hook specifications so you must return output into "resprint".
|
hook specifications so you must return output into "resprint".
|
||||||
|
|
||||||
|
***** ChangeLog for 5.0.6 compared to 5.0.5 *****
|
||||||
|
FIX: Removed a bad symbolic link into custom directory.
|
||||||
|
FIX: Renaming a resource ref rename also the directory of attached files.
|
||||||
|
|
||||||
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
***** ChangeLog for 5.0.5 compared to 5.0.4 *****
|
||||||
FIX: #7075 : bad path for document
|
FIX: #7075 : bad path for document
|
||||||
|
|||||||
@ -366,7 +366,9 @@ if ($nboftargetok) {
|
|||||||
}
|
}
|
||||||
else # For a maintenance release
|
else # For a maintenance release
|
||||||
{
|
{
|
||||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
#print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||||
|
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||||
|
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
# \file build/makepack-dolibarrmodule.pl
|
# \file build/makepack-dolibarrmodule.pl
|
||||||
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
||||||
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
# \contributor (c)2017 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
use Cwd;
|
use Cwd;
|
||||||
@ -134,7 +135,15 @@ foreach my $PROJECT (@PROJECTLIST) {
|
|||||||
# Get version $MAJOR, $MINOR and $BUILD
|
# Get version $MAJOR, $MINOR and $BUILD
|
||||||
print "Version detected for module ".$PROJECT.": ";
|
print "Version detected for module ".$PROJECT.": ";
|
||||||
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
||||||
if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; }
|
$custom=false;
|
||||||
|
if (! $result) {
|
||||||
|
$result=open(IN,"<".$SOURCE."/htdocs/custom/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
|
||||||
|
if (! $result) {
|
||||||
|
die "Error: Can't open descriptor file ".$SOURCE."/htdocs/(or /htdocs/custom/)".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n";
|
||||||
|
}else{
|
||||||
|
$custom = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
while(<IN>)
|
while(<IN>)
|
||||||
{
|
{
|
||||||
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
|
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
|
||||||
@ -294,6 +303,9 @@ foreach my $PROJECT (@PROJECTLIST) {
|
|||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
|
||||||
|
if($custom){
|
||||||
|
$ret=`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
|
||||||
|
}
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
|
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
|
||||||
|
|||||||
@ -60,14 +60,14 @@ $db->begin();
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/user/class/user.class.php");
|
||||||
|
|
||||||
// Create invoice object
|
// Create user object
|
||||||
$obj = new User($db);
|
$obj = new User($db);
|
||||||
//$obj->initAsSpecimen();
|
//$obj->initAsSpecimen();
|
||||||
|
|
||||||
$obj->login = 'ABCDEF';
|
$obj->login = 'ABCDEF';
|
||||||
$obj->nom = 'ABCDEF';
|
$obj->nom = 'ABCDEF';
|
||||||
|
|
||||||
// Create invoice
|
// Create user
|
||||||
$idobject=$obj->create($user);
|
$idobject=$obj->create($user);
|
||||||
if ($idobject > 0)
|
if ($idobject > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -67,7 +67,7 @@ $db->begin();
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||||
|
|
||||||
// Create invoice object
|
// Create contract object
|
||||||
$obj = new Contrat($db);
|
$obj = new Contrat($db);
|
||||||
$obj->socid=$argv[1];
|
$obj->socid=$argv[1];
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ $langs->load("salaries");
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
|
|
||||||
@ -53,12 +53,10 @@ if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
|||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'sortorder');
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST('page','int');
|
||||||
if ($page == - 1) {
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$page = 0;
|
|
||||||
}
|
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -84,8 +82,8 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accounting
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha')) { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -289,7 +289,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||||
@ -740,15 +740,6 @@ if ($id)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
|
|
||||||
{
|
|
||||||
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$tmp=FormMail::getAvailableSubstitKey('formemail');
|
|
||||||
print implode(', ', $tmp);
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
if ($id == 4) $colspan++;
|
if ($id == 4) $colspan++;
|
||||||
|
|
||||||
|
|||||||
@ -37,10 +37,10 @@ $langs->load("accountancy");
|
|||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$backtopage = GETPOST('backtopage');
|
$backtopage = GETPOST('backtopage','alpha');
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ $object = new AccountingAccount($db);
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel'))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
$urltogo=$backtopage?$backtopage:dol_buildpath('/accountancy/admin/account.php',1);
|
||||||
header("Location: ".$urltogo);
|
header("Location: ".$urltogo);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ $langs->load("accountancy");
|
|||||||
$mesg = '';
|
$mesg = '';
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$cancel = GETPOST('cancel');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
$cat_id = GETPOST('account_category');
|
$cat_id = GETPOST('account_category');
|
||||||
$selectcpt = GETPOST('cpt_bk', 'array');
|
$selectcpt = GETPOST('cpt_bk', 'array');
|
||||||
|
|||||||
@ -185,7 +185,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
|
if (isset($_POST["country"]) && ($_POST["country"] <= 0))
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -37,8 +37,8 @@ $langs->load("bills");
|
|||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
|
|
||||||
// Security check
|
// Security access
|
||||||
if (empty($user->admin) && empty($user->rights->accounting->chartofaccount))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -53,13 +53,6 @@ $main_option = array (
|
|||||||
$model_option = array (
|
$model_option = array (
|
||||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||||
'ACCOUNTING_EXPORT_DATE'
|
'ACCOUNTING_EXPORT_DATE'
|
||||||
/*
|
|
||||||
'ACCOUNTING_EXPORT_PIECE',
|
|
||||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
|
||||||
'ACCOUNTING_EXPORT_LABEL',
|
|
||||||
'ACCOUNTING_EXPORT_AMOUNT',
|
|
||||||
'ACCOUNTING_EXPORT_DEVISE'
|
|
||||||
*/
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -121,17 +114,13 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = admin_accounting_prepare_head();
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron');
|
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -245,8 +234,6 @@ if ($num2) {
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Page to show a fiscal year
|
* \brief Page to show a fiscal year
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
|
||||||
|
|||||||
@ -37,10 +37,9 @@ $langs->load("compta");
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("accountancy");
|
$langs->load("accountancy");
|
||||||
$langs->load("salaries");
|
|
||||||
|
|
||||||
// Security check
|
// Security access
|
||||||
if (empty($user->admin))
|
if (empty($user->rights->accounting->chartofaccount))
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
@ -160,18 +159,13 @@ llxHeader();
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
//$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
|
||||||
|
|
||||||
$head = admin_accounting_prepare_head($accounting);
|
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron');
|
|
||||||
|
|
||||||
|
|
||||||
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
// Default mode for calculating turnover (parameter ACCOUNTING_MODE)
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -287,18 +281,11 @@ foreach ($list as $key)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<div class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'</div>';
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +490,7 @@ if ($id)
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
fieldList($fieldlist,$obj,$tabname[$id],'add');
|
fieldListJournal($fieldlist,$obj,$tabname[$id],'add');
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td colspan="4" align="right">';
|
print '<td colspan="4" align="right">';
|
||||||
@ -595,7 +595,7 @@ if ($id)
|
|||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||||
|
|
||||||
// Show fields
|
// Show fields
|
||||||
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
|
if (empty($reshook)) fieldListJournal($fieldlist,$obj,$tabname[$id],'edit');
|
||||||
|
|
||||||
print '<td align="center" colspan="4">';
|
print '<td align="center" colspan="4">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
@ -713,7 +713,7 @@ $db->close();
|
|||||||
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
function fieldListJournal($fieldlist, $obj='', $tabname='', $context='')
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
global $form, $mysoc;
|
global $form, $mysoc;
|
||||||
|
|||||||
@ -90,8 +90,8 @@ $arrayfields=array();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -28,7 +28,9 @@ require '../../main.inc.php';
|
|||||||
|
|
||||||
// Class
|
// Class
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
|
||||||
@ -51,9 +53,8 @@ if ($search_accountancy_code_end == - 1) {
|
|||||||
$search_accountancy_code_end = '';
|
$search_accountancy_code_end = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv.x") || GETPOST("button_export_csv")) {
|
if (GETPOST("exportcsv")) $action = 'export_csv';
|
||||||
$action = 'export_csv';
|
|
||||||
}
|
|
||||||
|
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||||
|
|
||||||
@ -66,8 +67,18 @@ $formother = new FormOther($db);
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
if (empty($search_date_start)) {
|
if (empty($search_date_start)) {
|
||||||
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
|
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||||
|
$year_start = dol_print_date(dol_now(), '%Y');
|
||||||
|
$year_end = $year_start + 1;
|
||||||
|
$month_end = $month_start - 1;
|
||||||
|
if ($month_end < 1)
|
||||||
|
{
|
||||||
|
$month_end = 12;
|
||||||
|
$year_end--;
|
||||||
|
}
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||||
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
}
|
}
|
||||||
if ($sortorder == "")
|
if ($sortorder == "")
|
||||||
$sortorder = "ASC";
|
$sortorder = "ASC";
|
||||||
@ -136,7 +147,7 @@ if ($action == 'export_csv') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
$title_page = $langs->trans("AccountBalance") . (($search_date_start || $search_date_end) ? ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end) : '');
|
$title_page = $langs->trans("AccountBalance");
|
||||||
|
|
||||||
llxHeader('', $title_page);
|
llxHeader('', $title_page);
|
||||||
|
|
||||||
@ -156,7 +167,7 @@ else {
|
|||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
|
||||||
$button = '<input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -199,7 +210,7 @@ else {
|
|||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -108,8 +108,8 @@ if ($action != 'export_file' && ! isset($_POST['begin']) && ! isset($_GET['begin
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
|
|||||||
@ -315,7 +315,7 @@ while ($i < min($num, $limit))
|
|||||||
|
|
||||||
// Affiche un lien vers la facture client/fournisseur
|
// Affiche un lien vers la facture client/fournisseur
|
||||||
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
$doc_ref = preg_replace('/\(.*\)/', '', $line->doc_ref);
|
||||||
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br /><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
|
||||||
|
|
||||||
|
|
||||||
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
print '<td align="right">' . ($line->debit ? price($line->debit) :''). '</td>';
|
||||||
|
|||||||
@ -354,7 +354,7 @@ class AccountancyCategory
|
|||||||
}
|
}
|
||||||
if ($thirdparty_code != 'nofilter')
|
if ($thirdparty_code != 'nofilter')
|
||||||
{
|
{
|
||||||
$sql .= " AND thirdparty_code = '".$ths->db->escape($thirdparty_code)."'";
|
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class AccountancySystem
|
|||||||
|
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
|
||||||
$sql .= " (date_creation, fk_user_author, numero, label)";
|
$sql .= " (date_creation, fk_user_author, numero, label)";
|
||||||
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
|
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->db->escape($this->numero) . "','" . $this->db->escape($this->label) . "')";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
@ -179,8 +179,8 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", " . $conf->entity;
|
$sql .= ", " . $conf->entity;
|
||||||
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
|
||||||
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
|
||||||
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->pcg_subtype . "'");
|
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'");
|
||||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->account_number . "'");
|
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||||
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
|
||||||
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
|
||||||
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
|
||||||
|
|||||||
@ -108,29 +108,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
} elseif ($action == 'cleanaccountancycode') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -144,7 +121,7 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql1.=")";
|
$sql1.=")";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -169,13 +146,29 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||||
|
|
||||||
|
// Clean database
|
||||||
|
$db->begin();
|
||||||
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
print $langs->trans("DescVentilCustomer") . '<br>';
|
print $langs->trans("DescVentilCustomer") . '<br>';
|
||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//print '<div class="inline-block divButAction">';
|
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
|
||||||
//print '</div>';
|
|
||||||
|
|
||||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||||
@ -214,8 +207,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -241,8 +234,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -271,8 +276,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
|
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -298,7 +303,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
print '<td align="left">' . $row[1] . '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
@ -367,6 +385,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->margin->enabled)) {
|
if (! empty($conf->margin->enabled)) {
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
|||||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -95,8 +101,8 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOU
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -109,6 +115,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -174,6 +182,7 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("Ventilation"));
|
llxHeader('', $langs->trans("Ventilation"));
|
||||||
|
|
||||||
@ -216,6 +225,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||||
} else {
|
} else {
|
||||||
@ -246,6 +268,15 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
@ -280,7 +311,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
|
|||||||
@ -104,29 +104,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
} elseif ($action == 'cleanaccountancycode') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -140,7 +117,7 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql1.=")";
|
$sql1.=")";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -168,13 +145,25 @@ print $langs->trans("DescVentilExpenseReport") . '<br>';
|
|||||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
// Clean database
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
$db->begin();
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||||
//print '</div>';
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE erd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
@ -195,8 +184,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -218,8 +207,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -249,8 +250,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -272,8 +273,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -58,6 +60,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -91,8 +97,8 @@ $accounting = new AccountingAccount($db);
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -103,14 +109,16 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass='Skeleton';
|
$objectclass='ExpenseReport';
|
||||||
$objectlabel='Skeleton';
|
$objectlabel='ExpenseReport';
|
||||||
$permtoread = $user->rights->accounting->read;
|
$permtoread = $user->rights->expensereport->read;
|
||||||
$permtodelete = $user->rights->accounting->delete;
|
$permtodelete = $user->rights->expensereport->delete;
|
||||||
$uploaddir = $conf->accounting->dir_output;
|
$uploaddir = $conf->expensereport->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
if ($massaction == 'ventil') {
|
if ($massaction == 'ventil') {
|
||||||
@ -169,6 +177,7 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
|
||||||
|
|
||||||
@ -203,6 +212,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
$sql .= natural_search("erd.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -228,6 +250,15 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_expensereport) $param.='&search_expensereport='.urlencode($search_expensereport);
|
||||||
|
if ($search_label) $param.='&search_label='.urlencode($search_label);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
@ -263,7 +294,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
@ -313,6 +348,7 @@ if ($result) {
|
|||||||
// Ref Expense report
|
// Ref Expense report
|
||||||
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
|
||||||
|
|
||||||
|
// Date
|
||||||
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
|
||||||
|
|
||||||
// Fees label
|
// Fees label
|
||||||
|
|||||||
@ -87,8 +87,13 @@ print "<br>\n";
|
|||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescMisc", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>')."\n";
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>')."\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
$textlink = '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>';
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||||
@ -132,11 +137,6 @@ $step++;
|
|||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>');
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$step++;
|
|
||||||
$textlink='<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>';
|
|
||||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, $textlink);
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,7 @@ $in_bookkeeping = GETPOST('in_bookkeeping','aZ09');
|
|||||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -102,12 +103,15 @@ $idpays = $mysoc->country_id;
|
|||||||
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop,";
|
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop_company,";
|
||||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop";
|
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop_user,";
|
||||||
|
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
|
||||||
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
|
||||||
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
|
||||||
@ -145,6 +149,7 @@ $result = $db->query($sql);
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
//print $sql;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
$account_supplier = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||||
@ -170,13 +175,31 @@ if ($result) {
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// Set accountancy code (for bank and thirdparty)
|
$lineisapurchase = -1;
|
||||||
|
$lineisasale = -1;
|
||||||
|
// Old method to detect if it's a sale or purchase
|
||||||
|
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
|
||||||
|
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
|
||||||
|
// Try a more reliable method to detect if record is a supplier payment or a customer payment
|
||||||
|
if ($lineisapurchase < 0)
|
||||||
|
{
|
||||||
|
if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1;
|
||||||
|
}
|
||||||
|
if ($lineisasale < 0)
|
||||||
|
{
|
||||||
|
if ($obj->typeop_payment == 'payment') $lineisasale = 1;
|
||||||
|
}
|
||||||
|
//var_dump($obj->type_payment); var_dump($obj->type_payment_supplier);
|
||||||
|
//var_dump($lineisapurchase); //var_dump($lineisasale);
|
||||||
|
|
||||||
|
// Set accountancy code for bank
|
||||||
$compta_bank = $obj->account_number;
|
$compta_bank = $obj->account_number;
|
||||||
|
|
||||||
|
// Set accountancy code for thirdparty
|
||||||
$compta_soc = 'NotDefined';
|
$compta_soc = 'NotDefined';
|
||||||
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)')
|
if ($lineisapurchase > 0)
|
||||||
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
$compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $account_supplier);
|
||||||
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)')
|
if ($lineisasale > 0)
|
||||||
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
||||||
|
|
||||||
$tabcompany[$obj->rowid] = array (
|
$tabcompany[$obj->rowid] = array (
|
||||||
@ -185,6 +208,7 @@ if ($result) {
|
|||||||
'code_compta' => $compta_soc,
|
'code_compta' => $compta_soc,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Set accountancy code for user
|
||||||
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
$compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
|
||||||
|
|
||||||
$tabuser[$obj->rowid] = array (
|
$tabuser[$obj->rowid] = array (
|
||||||
@ -200,6 +224,7 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
|
||||||
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
$tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
|
||||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||||
|
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
||||||
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
||||||
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
||||||
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
||||||
@ -212,7 +237,7 @@ if ($result) {
|
|||||||
//var_dump($tabpay);
|
//var_dump($tabpay);
|
||||||
|
|
||||||
// By default
|
// By default
|
||||||
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or old record with no links in bank_url.
|
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
|
||||||
$tabtype[$obj->rowid] = 'unknown';
|
$tabtype[$obj->rowid] = 'unknown';
|
||||||
|
|
||||||
// get_url may return -1 which is not traversable
|
// get_url may return -1 which is not traversable
|
||||||
@ -602,6 +627,8 @@ if (! $error && $action == 'writebookkeeping') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Export
|
// Export
|
||||||
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
@ -735,18 +762,34 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||||
|
|
||||||
|
|
||||||
|
// Test that setup is complete
|
||||||
|
$sql='SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL';
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj=$db->fetch_object($resql);
|
||||||
|
if ($obj->nb > 0)
|
||||||
|
{
|
||||||
|
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||||
|
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuBankCash").'</strong>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|
||||||
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
|| empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|
||||||
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// TODO Avoid using js. We can use a direct link with $param
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
@ -754,15 +797,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
console.log("Set value into form and submit");
|
console.log("Set value into form and submit");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
console.log("Set value into form and submit");
|
console.log("Set value into form and submit");
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
@ -796,8 +839,10 @@ if (empty($action) || $action == 'view') {
|
|||||||
// Bank
|
// Bank
|
||||||
foreach ( $tabbq[$key] as $k => $mt )
|
foreach ( $tabbq[$key] as $k => $mt )
|
||||||
{
|
{
|
||||||
|
//var_dump($tabpay[$key]);
|
||||||
|
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Bank bank.rowid=".$key."--></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
// Ledger account
|
// Ledger account
|
||||||
@ -818,11 +863,14 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
else print $accounttoshow;*/
|
else print $accounttoshow;*/
|
||||||
print "</td>";
|
print "</td>";
|
||||||
if ($val['soclib'] == '') {
|
print "<td>";
|
||||||
print "<td>" . $langs->trans("Bank") . " - " . $reflabel . "</td>";
|
//var_dump($tabpay[$key]);
|
||||||
} else {
|
print $langs->trans("Bank");
|
||||||
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
|
print ' '.$val['bank_account_ref'];
|
||||||
|
if (! empty($val['soclib'])) {
|
||||||
|
print " - " . $val['soclib'];
|
||||||
}
|
}
|
||||||
|
print "</td>";
|
||||||
print "<td>" . $val["type_payment"] . "</td>";
|
print "<td>" . $val["type_payment"] . "</td>";
|
||||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||||
@ -833,14 +881,15 @@ if (empty($action) || $action == 'view') {
|
|||||||
if (is_array($tabtp[$key])) {
|
if (is_array($tabtp[$key])) {
|
||||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||||
if ($k != 'type') {
|
if ($k != 'type') {
|
||||||
|
print '<!-- Thirdparty bank.rowid='.$key.' -->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Thirdparty bank.rowid=".$key." --></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
// Ledger account
|
// Ledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
$account_ledger = $k;
|
$account_ledger = $k;
|
||||||
|
// Try to force general ledger account depending on type
|
||||||
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||||
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||||
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||||
@ -877,7 +926,11 @@ if (empty($action) || $action == 'view') {
|
|||||||
{
|
{
|
||||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||||
{
|
{
|
||||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
/*var_dump($tabpay[$key]);
|
||||||
|
var_dump($tabtype[$key]);
|
||||||
|
var_dump($tabbq[$key]);*/
|
||||||
|
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown").'</span>';
|
||||||
}
|
}
|
||||||
else print $accounttoshowsubledger;
|
else print $accounttoshowsubledger;
|
||||||
}
|
}
|
||||||
@ -892,8 +945,9 @@ if (empty($action) || $action == 'view') {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||||
|
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print "<td><!-- Wait bank.rowid=".$key." --></td>";
|
print "<td></td>";
|
||||||
print "<td>" . $date . "</td>";
|
print "<td>" . $date . "</td>";
|
||||||
print "<td>" . $ref . "</td>";
|
print "<td>" . $ref . "</td>";
|
||||||
// Ledger account
|
// Ledger account
|
||||||
@ -936,7 +990,7 @@ $db->close();
|
|||||||
* Return source for doc_ref of a bank transaction
|
* Return source for doc_ref of a bank transaction
|
||||||
*
|
*
|
||||||
* @param string $val Array of val
|
* @param string $val Array of val
|
||||||
* @param string $typerecord Type of record
|
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
|
||||||
* @return string|unknown
|
* @return string|unknown
|
||||||
*/
|
*/
|
||||||
function getSourceDocRef($val, $typerecord)
|
function getSourceDocRef($val, $typerecord)
|
||||||
|
|||||||
@ -510,7 +510,7 @@ if (empty($action) || $action == 'view') {
|
|||||||
|
|
||||||
// Button to write into Ledger
|
// Button to write into Ledger
|
||||||
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
|
||||||
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
print '<br>'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
|
||||||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||||
}
|
}
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction tabsActionNoBottom">';
|
||||||
@ -518,11 +518,12 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
}
|
}
|
||||||
//print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
//print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
|
|||||||
@ -539,22 +539,23 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|||||||
@ -559,22 +559,23 @@ if (empty($action) || $action == 'view') {
|
|||||||
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
print '<input type="button" class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
|
||||||
}
|
}
|
||||||
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
// TODO Avoid using js. We can use a direct link with $param
|
||||||
print '
|
print '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function launch_export() {
|
function launch_export() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("exportcsv");
|
$("div.fiche form input[name=\"action\"]").val("exportcsv");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
function writebookkeeping() {
|
function writebookkeeping() {
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
|
$("div.fiche form input[name=\"action\"]").val("writebookkeeping");
|
||||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
$("div.fiche form input[type=\"submit\"]").click();
|
||||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
$("div.fiche form input[name=\"action\"]").val("");
|
||||||
}
|
}
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|||||||
@ -105,29 +105,6 @@ if ($action == 'validatehistory') {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'fixaccountancycode') {
|
|
||||||
$error = 0;
|
|
||||||
$db->begin();
|
|
||||||
|
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
|
||||||
$sql1 .= " SET fk_code_ventilation = 0";
|
|
||||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
|
||||||
$sql1 .= ' (SELECT accnt.rowid ';
|
|
||||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
|
||||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
|
||||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
|
||||||
if (! $resql1) {
|
|
||||||
$error ++;
|
|
||||||
$db->rollback();
|
|
||||||
setEventMessage($db->lasterror(), 'errors');
|
|
||||||
} else {
|
|
||||||
$db->commit();
|
|
||||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
|
||||||
}
|
|
||||||
} elseif ($action == 'cleanaccountancycode') {
|
} elseif ($action == 'cleanaccountancycode') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -140,7 +117,7 @@ if ($action == 'validatehistory') {
|
|||||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||||
$sql1.= ")";
|
$sql1.= ")";
|
||||||
|
|
||||||
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||||
|
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
if (! $resql1) {
|
if (! $resql1) {
|
||||||
@ -168,10 +145,25 @@ print $langs->trans("DescVentilSupplier") . '<br>';
|
|||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
//print '<div class="inline-block divButAction">';
|
// Clean database
|
||||||
// TODO Remove this. Should be done always or into the repair.php script.
|
$db->begin();
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||||
//print '</div>';
|
$sql1 .= " SET fk_code_ventilation = 0";
|
||||||
|
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||||
|
$sql1 .= ' (SELECT accnt.rowid ';
|
||||||
|
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||||
|
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||||
|
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||||
|
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
|
||||||
|
$resql1 = $db->query($sql1);
|
||||||
|
if (! $resql1) {
|
||||||
|
$error ++;
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($db->lasterror(), 'errors');
|
||||||
|
} else {
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
// End clean database
|
||||||
|
|
||||||
|
|
||||||
$y = $year_current;
|
$y = $year_current;
|
||||||
@ -191,8 +183,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -214,8 +206,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
@ -245,8 +249,8 @@ for($i = 1; $i <= 12; $i ++) {
|
|||||||
}
|
}
|
||||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||||
|
|
||||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') ." AS codecomptable,";
|
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
|
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||||
for($i = 1; $i <= 12; $i ++) {
|
for($i = 1; $i <= 12; $i ++) {
|
||||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||||
}
|
}
|
||||||
@ -268,8 +272,20 @@ if ($resql) {
|
|||||||
|
|
||||||
while ( $row = $db->fetch_row($resql)) {
|
while ( $row = $db->fetch_row($resql)) {
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print '<td align="left">' . $row[1] . '</td>';
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
else print length_accountg($row[0]);
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="left">';
|
||||||
|
if ($row[0] == 'tobind')
|
||||||
|
{
|
||||||
|
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
|
||||||
|
}
|
||||||
|
else print $row[1];
|
||||||
|
print '</td>';
|
||||||
for($i = 2; $i <= 12; $i ++) {
|
for($i = 2; $i <= 12; $i ++) {
|
||||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -60,6 +62,10 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
@ -96,8 +102,8 @@ $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUN
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
@ -110,6 +116,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mass actions
|
// Mass actions
|
||||||
@ -176,6 +184,7 @@ if ($massaction == 'ventil') {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation"));
|
llxHeader('', $langs->trans("SuppliersVentilation"));
|
||||||
|
|
||||||
@ -218,6 +227,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
$sql .= natural_search("l.tva_tx",$search_vat,1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -243,6 +265,15 @@ if ($result) {
|
|||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
|
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
|
||||||
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
|
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||||
|
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||||
|
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||||
|
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
'ventil'=>$langs->trans("Ventilate")
|
'ventil'=>$langs->trans("Ventilate")
|
||||||
@ -279,7 +310,11 @@ if ($result) {
|
|||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidthonsmartphone" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
|
|||||||
@ -263,40 +263,6 @@ $helptext.='%YEAR%, %MONTH%, %DAY%';
|
|||||||
|
|
||||||
form_constantes($constantes, 0, $helptext);
|
form_constantes($constantes, 0, $helptext);
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Editing global variables not related to a specific theme
|
|
||||||
*/
|
|
||||||
$constantes=array(
|
|
||||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
|
||||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
|
||||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
|
||||||
'ADHERENT_AUTOREGISTER_MAIL',
|
|
||||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
|
||||||
'ADHERENT_MAIL_VALID',
|
|
||||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
|
||||||
'ADHERENT_MAIL_COTIS',
|
|
||||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
|
||||||
'ADHERENT_MAIL_RESIL',
|
|
||||||
'ADHERENT_MAIL_FROM',
|
|
||||||
);
|
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("Other"),'','');
|
|
||||||
|
|
||||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
|
||||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
|
||||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
|
||||||
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
|
||||||
|
|
||||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
|
||||||
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
|
||||||
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
|
||||||
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
|
||||||
|
|
||||||
form_constantes($constantes, 0, $helptext);
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
190
htdocs/adherents/admin/adherent_emails.php
Normal file
190
htdocs/adherents/admin/adherent_emails.php
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/adherents/admin/adherent.php
|
||||||
|
* \ingroup member
|
||||||
|
* \brief Page to setup the module Foundation
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
|
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("members");
|
||||||
|
|
||||||
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
|
$type=array('yesno','texte','chaine');
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
if ($action == 'updateall')
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
$res1=$res2=$res3=$res4=$res5=$res6=0;
|
||||||
|
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
// Use vat for invoice creation
|
||||||
|
if ($conf->facture->enabled)
|
||||||
|
{
|
||||||
|
$res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||||
|
{
|
||||||
|
$res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
|
||||||
|
{
|
||||||
|
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action mise a jour ou ajout d'une constante
|
||||||
|
if ($action == 'update' || $action == 'add')
|
||||||
|
{
|
||||||
|
$constname=GETPOST('constname','alpha');
|
||||||
|
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
|
||||||
|
|
||||||
|
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue='';
|
||||||
|
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
|
||||||
|
{
|
||||||
|
if ($constvalue) $constvalue=0;
|
||||||
|
else $constvalue=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$consttype=GETPOST('consttype','alpha');
|
||||||
|
$constnote=GETPOST('constnote');
|
||||||
|
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
|
||||||
|
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action activation d'un sous module du module adherent
|
||||||
|
if ($action == 'set')
|
||||||
|
{
|
||||||
|
$result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action desactivation d'un sous module du module adherent
|
||||||
|
if ($action == 'unset')
|
||||||
|
{
|
||||||
|
$result=dolibarr_del_const($db,GETPOST('name','alpha'),$conf->entity);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("MembersSetup"),$help_url);
|
||||||
|
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print load_fiche_titre($langs->trans("MembersSetup"),$linkback,'title_setup');
|
||||||
|
|
||||||
|
|
||||||
|
$head = member_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
|
||||||
|
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="updateall">';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Editing global variables not related to a specific theme
|
||||||
|
*/
|
||||||
|
$constantes=array(
|
||||||
|
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
|
||||||
|
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
|
||||||
|
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||||
|
'ADHERENT_AUTOREGISTER_MAIL',
|
||||||
|
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||||
|
'ADHERENT_MAIL_VALID',
|
||||||
|
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||||
|
'ADHERENT_MAIL_COTIS',
|
||||||
|
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||||
|
'ADHERENT_MAIL_RESIL',
|
||||||
|
'ADHERENT_MAIL_FROM',
|
||||||
|
);
|
||||||
|
|
||||||
|
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
|
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||||
|
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||||
|
$helptext.='%YEAR%, %MONTH%, %DAY%';
|
||||||
|
|
||||||
|
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||||
|
$helptext.='%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, ';
|
||||||
|
$helptext.='%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %BIRTH%, %PHOTO%, %TYPE%, ';
|
||||||
|
//$helptext.='%YEAR%, %MONTH%, %DAY%'; // Not supported
|
||||||
|
|
||||||
|
form_constantes($constantes, 0, $helptext);
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -43,6 +43,12 @@ if (! $user->admin) accessforbidden();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($action == 'setMEMBER_ENABLE_PUBLIC')
|
||||||
|
{
|
||||||
|
if (GETPOST('value')) dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 1, 'chaine', 0, '', $conf->entity);
|
||||||
|
else dolibarr_set_const($db, 'MEMBER_ENABLE_PUBLIC', 0, 'chaine', 0, '', $conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$public=GETPOST('MEMBER_ENABLE_PUBLIC');
|
$public=GETPOST('MEMBER_ENABLE_PUBLIC');
|
||||||
@ -94,7 +100,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
|||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|
||||||
dol_fiche_head($head, 'public', $langs->trans("Members"), -1, 'user');
|
dol_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
@ -135,6 +141,31 @@ if ($conf->use_javascript_ajax)
|
|||||||
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
||||||
|
|
||||||
|
|
||||||
|
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||||
|
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||||
|
{
|
||||||
|
// Button off, click to enable
|
||||||
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=1'.$param.'">';
|
||||||
|
$enabledisablehtml.=img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$enabledisablehtml.='</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Button on, click to disable
|
||||||
|
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMEMBER_ENABLE_PUBLIC&value=0'.$param.'">';
|
||||||
|
$enabledisablehtml.=img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$enabledisablehtml.='</a>';
|
||||||
|
}
|
||||||
|
print $enabledisablehtml;
|
||||||
|
print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC)?0:1).'">';
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -142,13 +173,6 @@ print '<td>'.$langs->trans("Parameter").'</td>';
|
|||||||
print '<td align="right">'.$langs->trans("Value").'</td>';
|
print '<td align="right">'.$langs->trans("Value").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Allow public form
|
|
||||||
print '<tr class="oddeven"><td>';
|
|
||||||
print $langs->trans("EnablePublicSubscriptionForm");
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1);
|
|
||||||
print "</td></tr>\n";
|
|
||||||
|
|
||||||
// Force Type
|
// Force Type
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
print '<tr class="oddeven drag" id="trforcetype"><td>';
|
||||||
@ -174,42 +198,41 @@ print '</td><td align="right">';
|
|||||||
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
// Jump to an online payment page
|
// Jump to an online payment page
|
||||||
print '<tr class="oddeven" id="trpayment"><td>';
|
print '<tr class="oddeven" id="trpayment"><td>';
|
||||||
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
$listofval=array();
|
$listofval=array();
|
||||||
|
$listofval['-1']=$langs->trans('No');
|
||||||
|
$listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
|
||||||
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
|
if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
|
||||||
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
|
if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
|
||||||
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
|
if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
|
||||||
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),1);
|
print $form->selectarray("MEMBER_NEWFORM_PAYONLINE",$listofval,(! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''),0);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
// Jump to an online payment page
|
// Jump to an online payment page
|
||||||
print '<tr class="oddeven" id="tremail"><td>';
|
print '<tr class="oddeven" id="tremail"><td>';
|
||||||
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
|
||||||
print '</td><td align="right">';
|
print '</td><td align="right">';
|
||||||
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
|
|
||||||
print '<center>';
|
print '<center>';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
print '</center>';
|
print '</center>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
||||||
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
//print $langs->trans('FollowingLinksArePublic').'<br>';
|
||||||
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
|
||||||
@ -219,15 +242,8 @@ if ($conf->multicompany->enabled) {
|
|||||||
$entity_qr='';
|
$entity_qr='';
|
||||||
}
|
}
|
||||||
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
print '<table class="border" cellspacing="0" cellpadding="3">';
|
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td><td>'.$langs->trans("URL").'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("BlankSubscriptionForm").'</td><td>'..'</td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("PublicMemberList").'</td><td>'.img_picto('','object_globe.png').' '.'<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/public_list.php'.'">'.DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.'</a></td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("PublicMemberCard").'</td><td>'.img_picto('','object_globe.png').' '.DOL_MAIN_URL_ROOT.'/public/members/public_card.php?id=xxx'.'</td></tr>';
|
|
||||||
print '</table>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
@ -76,6 +76,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
|||||||
*/
|
*/
|
||||||
function assign_values(&$action, $id)
|
function assign_values(&$action, $id)
|
||||||
{
|
{
|
||||||
|
global $limit, $offset, $sortfield, $sortorder;
|
||||||
global $conf, $db, $langs, $user;
|
global $conf, $db, $langs, $user;
|
||||||
global $form;
|
global $form;
|
||||||
|
|
||||||
@ -114,14 +115,14 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
|
|||||||
|
|
||||||
if ($action == 'list')
|
if ($action == 'list')
|
||||||
{
|
{
|
||||||
$this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']);
|
$this->LoadListDatas($limit, $offset, $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch datas list
|
* Fetch datas list and save into ->list_datas
|
||||||
*
|
*
|
||||||
* @param int $limit Limit number of responses
|
* @param int $limit Limit number of responses
|
||||||
* @param int $offset Offset for first response
|
* @param int $offset Offset for first response
|
||||||
|
|||||||
@ -1743,21 +1743,26 @@ else
|
|||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
// Link for paypal payment
|
|
||||||
/*
|
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
|
||||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Shon online payment link
|
||||||
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
|
if ($useonlinepayment)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||||
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
/* Already in tab Agenda/Events
|
/* Already in tab Agenda/Events
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'member', $socid);
|
$somethingshown = $formactions->showactions($object, 'member', $socid, 1);
|
||||||
*/
|
*/
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,10 @@ $mesg='';
|
|||||||
|
|
||||||
$adherentstatic=new Adherent($db);
|
$adherentstatic=new Adherent($db);
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('adherent');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -65,9 +69,14 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
|
$sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
|
||||||
$sql.= " t.libelle as type,";
|
$sql.= " t.libelle as type,";
|
||||||
$sql.= " c.code as country_code, c.label as country";
|
$sql.= " c.code as country_code, c.label as country";
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val)
|
||||||
|
$sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
|
||||||
|
$sql.= " AND d.entity IN (".getEntity('adherent').")";
|
||||||
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
|
||||||
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
|
||||||
$sql.= " ORDER BY d.rowid ASC";
|
$sql.= " ORDER BY d.rowid ASC";
|
||||||
@ -84,9 +93,27 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
|
|
||||||
if ($objp->country == '-') $objp->country='';
|
if ($objp->country == '-') $objp->country='';
|
||||||
|
|
||||||
|
$adherentstatic->id=$objp->rowid;
|
||||||
$adherentstatic->lastname=$objp->lastname;
|
$adherentstatic->lastname=$objp->lastname;
|
||||||
$adherentstatic->firstname=$objp->firstname;
|
$adherentstatic->firstname=$objp->firstname;
|
||||||
|
|
||||||
|
// format extrafiled so they can be parsed in function complete_substitutions_array
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
$adherentstatic->array_options = array();
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
$tmpkey='options_'.$key;
|
||||||
|
if (!empty($objp->$tmpkey))
|
||||||
|
{
|
||||||
|
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
|
||||||
|
}
|
||||||
|
//if (!empty($objp->$key))
|
||||||
|
// $objp->array_options[$tmpkey] = $objp->$key;
|
||||||
|
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// List of values to scan for a replacement
|
// List of values to scan for a replacement
|
||||||
$substitutionarray = array (
|
$substitutionarray = array (
|
||||||
'%ID%'=>$objp->rowid,
|
'%ID%'=>$objp->rowid,
|
||||||
@ -109,7 +136,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
|
|||||||
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
|
||||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
|
||||||
|
|
||||||
// For business cards
|
// For business cards
|
||||||
if (empty($mode) || $mode=='card' || $mode=='cardlogin')
|
if (empty($mode) || $mode=='card' || $mode=='cardlogin')
|
||||||
|
|||||||
@ -199,6 +199,9 @@ class Adherent extends CommonObject
|
|||||||
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
$infos.= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||||
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
$infos.= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||||
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
$infos.= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||||
|
$infos.= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||||
{
|
{
|
||||||
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
$infos.= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||||
@ -243,6 +246,11 @@ class Adherent extends CommonObject
|
|||||||
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
'%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo,
|
||||||
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
'%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login,
|
||||||
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
'%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass,
|
||||||
|
'%TYPE%'=>$msgishtml?dol_htmlentitiesbr($this->type):$this->type,
|
||||||
|
'%PHONE_PRO%'=>$msgishtml?dol_htmlentitiesbr($this->phone):$this->phone,
|
||||||
|
'%PHONE_PERSO%'=>$msgishtml?dol_htmlentitiesbr($this->phone_perso):$this->phone_perso,
|
||||||
|
'%PHONE_MOBILE%'=>$msgishtml?dol_htmlentitiesbr($this->phone_mobile):$this->phone_mobile,
|
||||||
|
// For backward compatibility
|
||||||
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
'%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos,
|
||||||
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
'%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe,
|
||||||
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
'%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname,
|
||||||
@ -317,10 +325,10 @@ class Adherent extends CommonObject
|
|||||||
$sql.= " '".$this->db->idate($this->datec)."'";
|
$sql.= " '".$this->db->idate($this->datec)."'";
|
||||||
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||||
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
$sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be created by a guest or a script
|
||||||
$sql.= ", null, null, '".$this->morphy."'";
|
$sql.= ", null, null, '".$this->db->escape($this->morphy)."'";
|
||||||
$sql.= ", '".$this->typeid."'";
|
$sql.= ", ".$this->typeid;
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", ".(! empty($this->import_key) ? "'".$this->import_key."'":"null");
|
$sql.= ", ".(! empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'":"null");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||||
@ -439,17 +447,17 @@ class Adherent extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||||
$sql.= " civility = ".(!is_null($this->civility_id)?"'".$this->civility_id."'":"null");
|
$sql.= " civility = ".(!is_null($this->civility_id)?$this->db->escape($this->civility_id):"null");
|
||||||
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
$sql.= ", firstname = ".($this->firstname?"'".$this->db->escape($this->firstname)."'":"null");
|
||||||
$sql.= ", lastname=" .($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
$sql.= ", lastname=" .($this->lastname?"'".$this->db->escape($this->lastname)."'":"null");
|
||||||
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
|
$sql.= ", login=" .($this->login?"'".$this->db->escape($this->login)."'":"null");
|
||||||
$sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
$sql.= ", societe=" .($this->societe?"'".$this->db->escape($this->societe)."'":"null");
|
||||||
$sql.= ", fk_soc=" .($this->fk_soc > 0?"'".$this->fk_soc."'":"null");
|
$sql.= ", fk_soc=" .($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null");
|
||||||
$sql.= ", address=" .($this->address?"'".$this->db->escape($this->address)."'":"null");
|
$sql.= ", address=" .($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||||
$sql.= ", zip=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
$sql.= ", zip=" .($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||||
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||||
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
$sql.= ", country=".($this->country_id>0?$this->db->escape($this->country_id):"null");
|
||||||
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ", state_id=".($this->state_id>0?$this->db->escape($this->state_id):"null");
|
||||||
$sql.= ", email='".$this->db->escape($this->email)."'";
|
$sql.= ", email='".$this->db->escape($this->email)."'";
|
||||||
$sql.= ", skype='".$this->db->escape($this->skype)."'";
|
$sql.= ", skype='".$this->db->escape($this->skype)."'";
|
||||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||||
@ -457,7 +465,7 @@ class Adherent extends CommonObject
|
|||||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
$sql.= ", photo=" .($this->photo?"'".$this->db->escape($this->photo)."'":"null");
|
||||||
$sql.= ", public='".$this->db->escape($this->public)."'";
|
$sql.= ", public='".$this->db->escape($this->public)."'";
|
||||||
$sql.= ", statut=" .$this->statut;
|
$sql.= ", statut=" .$this->statut;
|
||||||
$sql.= ", fk_adherent_type=".$this->typeid;
|
$sql.= ", fk_adherent_type=".$this->typeid;
|
||||||
|
|||||||
@ -138,8 +138,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -789,14 +789,10 @@ if ($rowid > 0)
|
|||||||
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
if ($object->statut > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'&action=addsubscription">'.$langs->trans("AddSubscription")."</a></div>";
|
||||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("AddSubscription").'</a></div>';
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of subscriptions
|
* List of subscriptions
|
||||||
*/
|
*/
|
||||||
@ -882,23 +878,20 @@ if ($rowid > 0)
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Link for paypal payment
|
// Shon online payment link
|
||||||
if (! empty($conf->paypal->enabled))
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
|
if ($useonlinepayment)
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
print '<br>';
|
||||||
print showPaypalPaymentUrl('membersubscription',$object->ref);
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('membersubscription', $object->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link for stripe payment
|
|
||||||
if (! empty($conf->stripe->enabled))
|
|
||||||
{
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/stripe/lib/stripe.lib.php';
|
|
||||||
print showStripePaymentUrl('membersubscription',$object->ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add new subscription form
|
* Add new subscription form
|
||||||
|
|||||||
@ -39,7 +39,7 @@ $errmsg='';
|
|||||||
$action=GETPOST("action",'alpha');
|
$action=GETPOST("action",'alpha');
|
||||||
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
$rowid=GETPOST("rowid","int")?GETPOST("rowid","int"):GETPOST("id","int");
|
||||||
$typeid=GETPOST("typeid","int");
|
$typeid=GETPOST("typeid","int");
|
||||||
$cancel=GETPOST('cancel');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
|
|
||||||
if (! $user->rights->adherent->cotisation->lire)
|
if (! $user->rights->adherent->cotisation->lire)
|
||||||
@ -402,21 +402,15 @@ if ($rowid && $action != 'edit')
|
|||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||||
|
|
||||||
// Link for paypal payment
|
|
||||||
/*
|
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
|
||||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
// List of actions on element
|
// List of actions on element
|
||||||
/*
|
/*
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
|||||||
@ -75,8 +75,8 @@ $result=restrictedArea($user,'adherent','','','cotisation');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -165,6 +165,8 @@ if (! empty($triggers))
|
|||||||
if ($module == 'shipping') $module = 'expedition_bon';
|
if ($module == 'shipping') $module = 'expedition_bon';
|
||||||
if ($module == 'member') $module = 'adherent';
|
if ($module == 'member') $module = 'adherent';
|
||||||
if ($module == 'project') $module = 'projet';
|
if ($module == 'project') $module = 'projet';
|
||||||
|
if ($module == 'proposal_supplier') $module = 'supplier_proposal';
|
||||||
|
|
||||||
//print 'module='.$module.'<br>';
|
//print 'module='.$module.'<br>';
|
||||||
if (! empty($conf->$module->enabled))
|
if (! empty($conf->$module->enabled))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -373,11 +373,12 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG
|
|||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// AGENDA_DEFAULT_FILTER_STATUS
|
// AGENDA_DEFAULT_FILTER_STATUS
|
||||||
|
// TODO Remove to use the default generic feature
|
||||||
print '<tr class="oddeven">'."\n";
|
print '<tr class="oddeven">'."\n";
|
||||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
|
||||||
print '<td align="center"> </td>'."\n";
|
print '<td align="center"> </td>'."\n";
|
||||||
print '<td align="right">'."\n";
|
print '<td align="right">'."\n";
|
||||||
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
|
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
// AGENDA_DEFAULT_VIEW
|
// AGENDA_DEFAULT_VIEW
|
||||||
|
|||||||
@ -399,7 +399,7 @@ print '</table>';
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<br /><br />';
|
print '<br><br>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -157,7 +157,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
|
|||||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_OBJECT", GETPOST("object",'nohtml'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("fiscalmonthstart",'alpha'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "SOCIETE_FISCAL_MONTH_START", GETPOST("SOCIETE_FISCAL_MONTH_START",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
|
dolibarr_set_const($db, "FACTURE_TVAOPTION", GETPOST("optiontva",'alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
@ -547,8 +547,8 @@ if ($action == 'edit' || $action == 'updateedit')
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="fiscalmonthstart">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||||
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '</td></tr>';
|
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'SOCIETE_FISCAL_MONTH_START',0,1) . '</td></tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
@ -162,7 +162,7 @@ foreach ($list as $key)
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
print '<br><br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -69,8 +69,8 @@ $hookmanager->initHooks(array('admindefaultvalues','globaladmin'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -248,8 +248,8 @@ print '<table class="noborder" width="100%">';
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
// Page
|
// Page
|
||||||
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
||||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php');
|
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
|
||||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
|
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2');
|
||||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||||
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
|
||||||
// Field
|
// Field
|
||||||
|
|||||||
@ -662,7 +662,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||||
@ -1142,7 +1142,7 @@ if ($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($id == 4) print '<td></td>';
|
if ($id == 4) print '<td></td>';
|
||||||
print '<td colspan="3" align="right">';
|
print '<td colspan="3" align="center">';
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
{
|
{
|
||||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||||
|
|||||||
@ -286,7 +286,7 @@ class PrestaShopWebservice
|
|||||||
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
* $xml = $ws->get(array('resource' => 'orders', 'id' => 1));
|
||||||
* // Here in $xml, a SimpleXMLElement object you can parse
|
* // Here in $xml, a SimpleXMLElement object you can parse
|
||||||
* foreach ($xml->children()->children() as $attName => $attValue)
|
* foreach ($xml->children()->children() as $attName => $attValue)
|
||||||
* echo $attName.' = '.$attValue.'<br />';
|
* echo $attName.' = '.$attValue.'<br>';
|
||||||
* }
|
* }
|
||||||
* catch (PrestaShopWebserviceException $ex)
|
* catch (PrestaShopWebserviceException $ex)
|
||||||
* {
|
* {
|
||||||
@ -387,48 +387,6 @@ class PrestaShopWebservice
|
|||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
self::checkStatusCode($request['status_code']);// check the response validity
|
||||||
return self::parseXML($request['response']);
|
return self::parseXML($request['response']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete (DELETE) a resource.
|
|
||||||
* Unique parameter must take : <br><br>
|
|
||||||
* 'resource' => Resource name<br>
|
|
||||||
* 'id' => ID or array which contains IDs of a resource(s) you want to delete<br><br>
|
|
||||||
* <code>
|
|
||||||
* <?php
|
|
||||||
* require_once('./PrestaShopWebservice.php');
|
|
||||||
* try
|
|
||||||
* {
|
|
||||||
* $ws = new PrestaShopWebservice('http://mystore.com/', 'ZQ88PRJX5VWQHCWE4EE7SQ7HPNX00RAJ', false);
|
|
||||||
* $xml = $ws->delete(array('resource' => 'orders', 'id' => 1));
|
|
||||||
* // Following code will not be executed if an exception is thrown.
|
|
||||||
* echo 'Successfully deleted.';
|
|
||||||
* }
|
|
||||||
* catch (PrestaShopWebserviceException $ex)
|
|
||||||
* {
|
|
||||||
* echo 'Error : '.$ex->getMessage();
|
|
||||||
* }
|
|
||||||
* ?>
|
|
||||||
* </code>
|
|
||||||
* @param array $options Array representing resource to delete.
|
|
||||||
* @return boolean true
|
|
||||||
*/
|
|
||||||
public function delete($options)
|
|
||||||
{
|
|
||||||
if (isset($options['url']))
|
|
||||||
$url = $options['url'];
|
|
||||||
elseif (isset($options['resource']) && isset($options['id']))
|
|
||||||
if (is_array($options['id']))
|
|
||||||
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
|
|
||||||
else
|
|
||||||
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
|
|
||||||
if (isset($options['id_shop']))
|
|
||||||
$url .= '&id_shop='.$options['id_shop'];
|
|
||||||
if (isset($options['id_group_shop']))
|
|
||||||
$url .= '&id_group_shop='.$options['id_group_shop'];
|
|
||||||
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
|
|
||||||
self::checkStatusCode($request['status_code']);// check the response validity
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,13 +20,129 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Dolistore
|
||||||
|
*/
|
||||||
|
class Dolistore
|
||||||
|
{
|
||||||
|
// params
|
||||||
|
public $start // beginning of pagination
|
||||||
|
, $end // end of pagination
|
||||||
|
, $per_page // pagination: display per page
|
||||||
|
, $categorie // the current categorie
|
||||||
|
, $search // the search keywords
|
||||||
|
// setups
|
||||||
|
, $url // the url of this page
|
||||||
|
, $shop_url // the url of the shop
|
||||||
|
, $vat_rate // the vat rate used in the shop (prices are provided without vat)
|
||||||
|
, $lang // the integer representing the lang in the store
|
||||||
|
, $debug_api; // usefull if no dialog
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DolistoreModel
|
* Constructor
|
||||||
*/
|
*/
|
||||||
class DolistoreModel
|
function __construct()
|
||||||
{
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
||||||
|
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
||||||
|
$this->vat_rate = 1.2; // 20% de TVA
|
||||||
|
$this->debug_api = false;
|
||||||
|
|
||||||
|
$langtmp = explode('_', $langs->defaultlang);
|
||||||
|
$lang = $langtmp[0];
|
||||||
|
$lang_array = array('en'=>0, 'fr'=>1, 'es'=>2, 'it'=>3, 'de'=>4); // Into table ps_lang of Prestashop - 1
|
||||||
|
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
||||||
|
$this->lang = $lang_array[$lang];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data from remote Dolistore market place.
|
||||||
|
* This fills ->categories
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$this->start = $options['start'];
|
||||||
|
$this->end = $options['end'];
|
||||||
|
$this->per_page = $options['per_page'];
|
||||||
|
$this->categorie = $options['categorie'];
|
||||||
|
$this->search = $options['search'];
|
||||||
|
|
||||||
|
if ($this->end == 0) {
|
||||||
|
$this->end = $this->per_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
||||||
|
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
||||||
|
|
||||||
|
// Here we set the option array for the Webservice : we want products resources
|
||||||
|
$opt = array();
|
||||||
|
$opt['resource'] = 'products';
|
||||||
|
|
||||||
|
// make a search to limit the id returned.
|
||||||
|
if ($this->search != '') {
|
||||||
|
$opt2 = array();
|
||||||
|
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
|
||||||
|
// Call
|
||||||
|
$xml = $this->api->get($opt2);
|
||||||
|
$products = array();
|
||||||
|
foreach ($xml->products->children() as $product) {
|
||||||
|
$products[] = (int) $product['id'];
|
||||||
|
}
|
||||||
|
$opt['filter[id]'] = '['.implode('|', $products).']';
|
||||||
|
} elseif ($this->categorie != 0) {
|
||||||
|
$opt2 = array();
|
||||||
|
$opt2['resource'] = 'categories';
|
||||||
|
$opt2['id'] = $this->categorie;
|
||||||
|
// Call
|
||||||
|
$xml = $this->api->get($opt2);
|
||||||
|
$products = array();
|
||||||
|
foreach ($xml->category->associations->products->children() as $product) {
|
||||||
|
$products[] = (int) $product->id;
|
||||||
|
}
|
||||||
|
$opt['filter[id]'] = '['.implode('|', $products).']';
|
||||||
|
}
|
||||||
|
$opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]';
|
||||||
|
$opt['sort'] = 'id_desc';
|
||||||
|
$opt['filter[active]'] = '[1]';
|
||||||
|
$opt['limit'] = "$this->start,$this->end";
|
||||||
|
// $opt['filter[id]'] contais list of product id that are result of search
|
||||||
|
|
||||||
|
// Call API to get the detail
|
||||||
|
$xml = $this->api->get($opt);
|
||||||
|
$this->products = $xml->products->children();
|
||||||
|
|
||||||
|
|
||||||
|
// Here we set the option array for the Webservice : we want categories resources
|
||||||
|
$opt = array();
|
||||||
|
$opt['resource'] = 'categories';
|
||||||
|
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
|
||||||
|
$opt['sort'] = 'id_asc';
|
||||||
|
// Call
|
||||||
|
$xml = $this->api->get($opt);
|
||||||
|
$this->categories = $xml->categories->children();
|
||||||
|
} catch (PrestaShopWebserviceException $e) {
|
||||||
|
// Here we are dealing with errors
|
||||||
|
$trace = $e->getTrace();
|
||||||
|
if ($trace[0]['args'][0] == 404) die('Bad ID');
|
||||||
|
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
||||||
|
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return tree of Dolistore categories. $this->categories must have been loaded before.
|
||||||
|
*
|
||||||
|
* @param int $parent Id of parent category
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function get_categories($parent = 0)
|
function get_categories($parent = 0)
|
||||||
{
|
{
|
||||||
if (!isset($this->categories)) die('not possible');
|
if (!isset($this->categories)) die('not possible');
|
||||||
@ -68,6 +184,11 @@ class DolistoreModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of product formated for output
|
||||||
|
*
|
||||||
|
* @return string HTML output
|
||||||
|
*/
|
||||||
function get_products()
|
function get_products()
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
@ -90,22 +211,21 @@ class DolistoreModel
|
|||||||
|
|
||||||
// add image or default ?
|
// add image or default ?
|
||||||
if ($product->id_default_image != '') {
|
if ($product->id_default_image != '') {
|
||||||
$image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image;
|
$image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image;
|
||||||
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
$images = '<a href="'.$image_url.'" class="fancybox" rel="gallery'.$product->id.'" title="'.$product->name->language[$this->lang].', '.$langs->trans('Version').' '.$product->module_version.'">'.
|
||||||
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
'<img src="'.$image_url.'&quality=home_default" style="max-height:250px;max-width: 210px;" alt="" /></a>';
|
||||||
} else {
|
} else {
|
||||||
$images = '<img src="'.dol_buildPath('/dolistore/img/NoImageAvailable.png', 2).'" />';
|
$images = '<img src="'.DOL_URL_ROOT.'/admin/dolistore/img/NoImageAvailable.png" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
// free or pay ?
|
// free or pay ?
|
||||||
if ($product->price > 0) {
|
if ($product->price > 0) {
|
||||||
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
$price = '<h3>'.price(round((float) $product->price * $this->vat_rate, 2)).' €</h3>';
|
||||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/follow.png',
|
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
2).'" /></a>';
|
|
||||||
} else {
|
} else {
|
||||||
$price = $langs->trans('Free');
|
$price = '<h3>'.$langs->trans('Free').'</h3>';
|
||||||
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.dol_buildPath('/dolistore/img/Download-128.png',
|
$download_link = '<a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/Download-128.png" /></a>';
|
||||||
2).'" /></a>';
|
$download_link.= '<br><br><a target="_blank" href="'.$this->shop_url.$product->id.'"><img width="32" src="'.DOL_URL_ROOT.'/admin/dolistore/img/follow.png" /></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//checking versions
|
//checking versions
|
||||||
@ -128,14 +248,17 @@ class DolistoreModel
|
|||||||
$compatible = 'NotCompatible';
|
$compatible = 'NotCompatible';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//.'<br><a class="inline-block valignmiddle" target="_blank" href="'.$this->shop_url.$product->id.'"><span class="details button">'.$langs->trans("SeeInMarkerPlace").'</span></a>
|
||||||
|
|
||||||
//output template
|
//output template
|
||||||
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
$html .= '<tr class="app '.$parity.' '.$compatible.'">
|
||||||
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
<td align="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
||||||
<td class="margeCote"><h2 class="appTitle"><a target="_blank" href="'.$this->shop_url.$product->id.'">'.$product->name->language[$this->lang].'</a><span class="details button">Details</span>'
|
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang]
|
||||||
.'<br/><small>'.$version.'</small></h2>
|
.'<br/><small>'.$version.'</small></h2>
|
||||||
<small> '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang].'</td>
|
||||||
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
<td style="display:none;" class="long_description">'.$product->description->language[$this->lang].'</td>
|
||||||
<td class="margeCote" align="right">'.$price.'</td>
|
<td class="margeCote" align="center">'.$price.'
|
||||||
|
</td>
|
||||||
<td class="margeCote">'.$download_link.'</td>
|
<td class="margeCote">'.$download_link.'</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
@ -151,108 +274,6 @@ class DolistoreModel
|
|||||||
{
|
{
|
||||||
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Dolistore
|
|
||||||
*/
|
|
||||||
class Dolistore extends DolistoreModel
|
|
||||||
{
|
|
||||||
// params
|
|
||||||
public $start // beginning of pagination
|
|
||||||
, $end // end of pagination
|
|
||||||
, $per_page // pagination: display per page
|
|
||||||
, $categorie // the current categorie
|
|
||||||
, $search // the search keywords
|
|
||||||
// setups
|
|
||||||
, $url // the url of this page
|
|
||||||
, $shop_url // the url of the shop
|
|
||||||
, $vat_rate // the vat rate used in the shop (prices are provided without vat)
|
|
||||||
, $lang // the integer representing the lang in the store
|
|
||||||
, $debug_api; // usefull if no dialog
|
|
||||||
|
|
||||||
function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
|
|
||||||
{
|
|
||||||
global $conf, $langs;
|
|
||||||
|
|
||||||
$this->start = $options['start'];
|
|
||||||
$this->end = $options['end'];
|
|
||||||
$this->per_page = $options['per_page'];
|
|
||||||
$this->categorie = $options['categorie'];
|
|
||||||
$this->search = $options['search'];
|
|
||||||
|
|
||||||
$this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace';
|
|
||||||
$this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product=';
|
|
||||||
$this->vat_rate = 1.2; // 20% de TVA
|
|
||||||
$this->debug_api = false;
|
|
||||||
|
|
||||||
if ($this->end == 0) {
|
|
||||||
$this->end = $this->per_page;
|
|
||||||
}
|
|
||||||
|
|
||||||
$langtmp = explode('_', $langs->defaultlang);
|
|
||||||
$lang = $langtmp[0];
|
|
||||||
$lang_array = array('fr'=>1, 'en'=>2, 'es'=>3, 'it'=>4, 'de'=>5);
|
|
||||||
if (! in_array($lang, array_keys($lang_array))) $lang = 'en';
|
|
||||||
$this->lang = $lang_array[$lang]; // 1=fr 2=en ...
|
|
||||||
|
|
||||||
try {
|
|
||||||
$this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV,
|
|
||||||
$conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api);
|
|
||||||
|
|
||||||
// Here we set the option array for the Webservice : we want products resources
|
|
||||||
$opt = array();
|
|
||||||
$opt['resource'] = 'products';
|
|
||||||
// make a search to limit the id returned.
|
|
||||||
if ($this->search != '') {
|
|
||||||
$opt2 = array();
|
|
||||||
$opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang;
|
|
||||||
// Call
|
|
||||||
$xml = $this->api->get($opt2);
|
|
||||||
$products = array();
|
|
||||||
foreach ($xml->products->children() as $product) {
|
|
||||||
$products[] = (int) $product['id'];
|
|
||||||
}
|
|
||||||
$opt['filter[id]'] = '['.implode('|', $products).']';
|
|
||||||
} elseif ($this->categorie != 0) {
|
|
||||||
$opt2 = array();
|
|
||||||
$opt2['resource'] = 'categories';
|
|
||||||
$opt2['id'] = $this->categorie;
|
|
||||||
// Call
|
|
||||||
$xml = $this->api->get($opt2);
|
|
||||||
$products = array();
|
|
||||||
foreach ($xml->category->associations->products->children() as $product) {
|
|
||||||
$products[] = (int) $product->id;
|
|
||||||
}
|
|
||||||
$opt['filter[id]'] = '['.implode('|', $products).']';
|
|
||||||
}
|
|
||||||
$opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]';
|
|
||||||
$opt['sort'] = 'id_desc';
|
|
||||||
$opt['filter[active]'] = '[1]';
|
|
||||||
$opt['limit'] = "$this->start,$this->end";
|
|
||||||
// Call
|
|
||||||
$xml = $this->api->get($opt);
|
|
||||||
$this->products = $xml->products->children();
|
|
||||||
|
|
||||||
|
|
||||||
// Here we set the option array for the Webservice : we want categories resources
|
|
||||||
$opt = array();
|
|
||||||
$opt['resource'] = 'categories';
|
|
||||||
$opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]';
|
|
||||||
$opt['sort'] = 'id_asc';
|
|
||||||
// Call
|
|
||||||
$xml = $this->api->get($opt);
|
|
||||||
$this->categories = $xml->categories->children();
|
|
||||||
} catch (PrestaShopWebserviceException $e) {
|
|
||||||
// Here we are dealing with errors
|
|
||||||
$trace = $e->getTrace();
|
|
||||||
if ($trace[0]['args'][0] == 404) die('Bad ID');
|
|
||||||
else if ($trace[0]['args'][0] == 401) die('Bad auth key');
|
|
||||||
else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_previous_url()
|
function get_previous_url()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,72 +0,0 @@
|
|||||||
<html><head><title>CRUD Tutorial - Customer's list</title></head><body>
|
|
||||||
<?php
|
|
||||||
/*
|
|
||||||
* 2007-2013 PrestaShop
|
|
||||||
*
|
|
||||||
* NOTICE OF LICENSE
|
|
||||||
*
|
|
||||||
* This source file is subject to the Open Software License (OSL 3.0)
|
|
||||||
* that is bundled with this package in the file LICENSE.txt.
|
|
||||||
* It is also available through the world-wide-web at this URL:
|
|
||||||
* http://opensource.org/licenses/osl-3.0.php
|
|
||||||
* If you did not receive a copy of the license and are unable to
|
|
||||||
* obtain it through the world-wide-web, please send an email
|
|
||||||
* to license@prestashop.com so we can send you a copy immediately.
|
|
||||||
*
|
|
||||||
* DISCLAIMER
|
|
||||||
*
|
|
||||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
|
||||||
* versions in the future. If you wish to customize PrestaShop for your
|
|
||||||
* needs please refer to http://www.prestashop.com for more information.
|
|
||||||
*
|
|
||||||
* @author PrestaShop SA <contact@prestashop.com>
|
|
||||||
* @copyright 2007-2013 PrestaShop SA
|
|
||||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
|
||||||
* International Registered Trademark & Property of PrestaShop SA
|
|
||||||
* PrestaShop Webservice Library
|
|
||||||
* @package PrestaShopWebservice
|
|
||||||
*/
|
|
||||||
// Here we define constants /!\ You need to replace this parameters
|
|
||||||
//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/
|
|
||||||
define('DEBUG', true); // Debug mode
|
|
||||||
define('PS_SHOP_PATH', 'https://www.dolistore.com/'); // Root path of your PrestaShop store
|
|
||||||
define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office)
|
|
||||||
require_once('./PSWebServiceLibrary.php');
|
|
||||||
// Here we make the WebService Call
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
|
|
||||||
|
|
||||||
// Here we set the option array for the Webservice : we want customers resources
|
|
||||||
$opt['resource'] = 'categories';
|
|
||||||
$opt['id'] = '1';
|
|
||||||
|
|
||||||
// Call
|
|
||||||
$xml = $webService->get($opt);
|
|
||||||
// Here we get the elements from children of customers markup "customer"
|
|
||||||
$resources = $xml->categories->children();
|
|
||||||
}
|
|
||||||
catch (PrestaShopWebserviceException $e)
|
|
||||||
{
|
|
||||||
// Here we are dealing with errors
|
|
||||||
$trace = $e->getTrace();
|
|
||||||
if ($trace[0]['args'][0] == 404) echo 'Bad ID';
|
|
||||||
else if ($trace[0]['args'][0] == 401) echo 'Bad auth key';
|
|
||||||
else echo 'Other error';
|
|
||||||
}
|
|
||||||
// We set the Title
|
|
||||||
echo "<h1>Categories's List</h1>";
|
|
||||||
echo '<table border="5">';
|
|
||||||
// if $resources is set we can lists element in it otherwise do nothing cause there's an error
|
|
||||||
if (isset($resources))
|
|
||||||
{
|
|
||||||
echo '<tr><th>Id</th></tr>';
|
|
||||||
foreach ($resources as $resource)
|
|
||||||
{
|
|
||||||
// Iterates on the found IDs
|
|
||||||
echo '<tr><td>'.$resource->attributes().'</td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo '</table>';
|
|
||||||
?>
|
|
||||||
</body></html>
|
|
||||||
@ -115,7 +115,9 @@ div.divsearchfield {
|
|||||||
tr.app {
|
tr.app {
|
||||||
height:250px;
|
height:250px;
|
||||||
}
|
}
|
||||||
|
tr.app td {
|
||||||
|
border-bottom: 1px solid #888;
|
||||||
|
}
|
||||||
div#newsDoli.tabBar {
|
div#newsDoli.tabBar {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
margin-right: 30px;
|
margin-right: 30px;
|
||||||
@ -225,6 +227,7 @@ tr.NotCompatible:hover{
|
|||||||
}
|
}
|
||||||
#listing-content{
|
#listing-content{
|
||||||
width: 75%;
|
width: 75%;
|
||||||
|
float: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
span.details{
|
span.details{
|
||||||
|
|||||||
@ -55,7 +55,7 @@ if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
|||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel'))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,13 +70,13 @@ if (! empty($conf->global->MAIN_MOTD_SETUPPAGE))
|
|||||||
|
|
||||||
print $langs->trans("SetupDescription1").' ';
|
print $langs->trans("SetupDescription1").' ';
|
||||||
print $langs->trans("AreaForAdminOnly").' ';
|
print $langs->trans("AreaForAdminOnly").' ';
|
||||||
print $langs->trans("SetupDescription2", $langs->trans("MenuCompanySetup"), $langs->trans("Modules"))."<br><br>";
|
print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"))."<br><br>";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Show info setup company
|
// Show info setup company
|
||||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||||
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->trans("Setup"), $langs->trans("MenuCompanySetup"));
|
print img_picto('','puce').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
|
||||||
if (! empty($setupcompanynotcomplete))
|
if (! empty($setupcompanynotcomplete))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -88,7 +88,7 @@ print '<br>';
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// Show info setup module
|
// Show info setup module
|
||||||
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->trans("Setup"), $langs->trans("Modules"));
|
print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
|
||||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2005 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
@ -38,10 +38,19 @@ if (!$user->admin)
|
|||||||
|
|
||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('adminldap','globaladmin'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
if ($action == 'setvalue' && $user->admin)
|
if ($action == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -71,8 +80,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -149,6 +157,11 @@ if (! empty($conf->adherent->enabled))
|
|||||||
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
|
print '</td><td>'.$langs->trans("LDAPDnMemberActiveExample").'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('addAdminLdapOptions',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||||
print '<td>'.$langs->trans("Value").'</td>';
|
print '<td>'.$langs->trans("Value").'</td>';
|
||||||
|
|||||||
@ -120,7 +120,7 @@ print '</tr>';
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
print '<br><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
@ -179,8 +179,8 @@ $id = 25;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -51,11 +51,11 @@ $search_version=GETPOST('search_version','alpha');
|
|||||||
// For dolistore search
|
// For dolistore search
|
||||||
$options = array();
|
$options = array();
|
||||||
$options['per_page'] = 20;
|
$options['per_page'] = 20;
|
||||||
$options['categorie'] = GETPOST('categorie', 'int') + 0;
|
$options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'):0) + 0);
|
||||||
$options['start'] = GETPOST('start', 'int') + 0;
|
$options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
|
||||||
$options['end'] = GETPOST('end', 'int') + 0;
|
$options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
|
||||||
$options['search'] = GETPOST('search_keyword', 'alpha');
|
$options['search'] = GETPOST('search_keyword', 'alpha');
|
||||||
$dolistore = new Dolistore($options);
|
$dolistore = new Dolistore();
|
||||||
|
|
||||||
|
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
@ -254,7 +254,7 @@ if ($action == 'reset' && $user->admin)
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$morejs = array("/admin/dolistore/js/dolistore.js.php");
|
//$morejs = array("/admin/dolistore/js/dolistore.js.php");
|
||||||
$morecss = array("/admin/dolistore/css/dolistore.css");
|
$morecss = array("/admin/dolistore/css/dolistore.css");
|
||||||
|
|
||||||
// Set dir where external modules are installed
|
// Set dir where external modules are installed
|
||||||
@ -832,44 +832,54 @@ if ($mode == 'marketplace')
|
|||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||||
{
|
{
|
||||||
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span>';
|
// $options is array with filter criterias
|
||||||
|
//var_dump($options);
|
||||||
|
$dolistore->getRemoteData($options);
|
||||||
|
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
|
||||||
|
|
||||||
|
$previouslink = $dolistore->get_previous_link();
|
||||||
|
$nextlink = $dolistore->get_next_link();
|
||||||
|
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<br><br>
|
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
||||||
|
|
||||||
<div class="tabBar">
|
|
||||||
<form method="POST" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
|
||||||
<input type="hidden" name="mode" value="marketplace" />
|
<input type="hidden" name="mode" value="marketplace" />
|
||||||
<div class="divsearchfield"><?php echo $langs->trans('Mot-cle') ?>:
|
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
|
||||||
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
||||||
</div>
|
</div>
|
||||||
<div class="divsearchfield">
|
<div class="divsearchfield">
|
||||||
<input class="button butAction searchDolistore" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
|
<input class="button" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
|
||||||
<a class="button butActionDelete" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Tout afficher') ?></a>
|
<a class="button" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
|
||||||
</div><br><br><br style="clear: both">
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="divsearchfield right">
|
||||||
|
<?php
|
||||||
|
print $previouslink;
|
||||||
|
print $nextlink;
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
print '</div></div>';
|
||||||
|
print '<div class="clearboth"></div>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="category-tree-left">
|
<div id="category-tree-left">
|
||||||
<ul class="tree">
|
<ul class="tree">
|
||||||
<?php echo $dolistore->get_categories(); ?>
|
<?php echo $dolistore->get_categories(); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="listing-content">
|
<div id="listing-content">
|
||||||
<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">
|
<table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
|
||||||
<thead>
|
|
||||||
<tr class="liste_titre">
|
|
||||||
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="listOfModules">
|
<tbody id="listOfModules">
|
||||||
<?php echo $dolistore->get_products($categorie); ?>
|
<?php echo $dolistore->get_products($categorie); ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
|
||||||
<tr class="liste_titre">
|
|
||||||
<td colspan="100%"><?php echo $dolistore->get_previous_link() ?> <?php echo $dolistore->get_next_link() ?> <span style="float:right"><?php echo $langs->trans('AchatTelechargement') ?></span></td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -235,7 +235,7 @@ print '</td></tr>';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
print '<br>';
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||||
{
|
{
|
||||||
@ -293,7 +293,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '<br />';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -233,7 +233,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print "<br />";
|
print "<br>";
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,10 @@ if($action)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
|
if ($action == 'STOCK_SUPPORTS_SERVICES')
|
||||||
|
{
|
||||||
|
$res = dolibarr_set_const($db, "STOCK_SUPPORTS_SERVICES", GETPOST('STOCK_SUPPORTS_SERVICES','alpha'),'chaine',0,'',$conf->entity);
|
||||||
|
}
|
||||||
if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
|
if ($action == 'STOCK_USERSTOCK_AUTOCREATE')
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "STOCK_USERSTOCK_AUTOCREATE", GETPOST('STOCK_USERSTOCK_AUTOCREATE','alpha'),'chaine',0,'',$conf->entity);
|
||||||
@ -164,8 +168,8 @@ $found=0;
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("DeStockOnBill").'</td>';
|
print '<td>'.$langs->trans("DeStockOnBill").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->facture->enabled))
|
if (! empty($conf->facture->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -184,8 +188,8 @@ $found++;
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("DeStockOnValidateOrder").'</td>';
|
print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->commande->enabled))
|
if (! empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -206,8 +210,8 @@ $found++;
|
|||||||
//{
|
//{
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("DeStockOnShipment").'</td>';
|
print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->expedition->enabled))
|
if (! empty($conf->expedition->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -226,8 +230,8 @@ $found++;
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
|
print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->expedition->enabled))
|
if (! empty($conf->expedition->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -268,8 +272,8 @@ $found=0;
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("ReStockOnBill").'</td>';
|
print '<td>'.$langs->trans("ReStockOnBill").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -289,8 +293,8 @@ $found++;
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("ReStockOnValidateOrder").'</td>';
|
print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -309,8 +313,8 @@ $found++;
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
@ -346,8 +350,8 @@ print '</tr>'."\n";
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
|
print '<td>'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_NEGATIVE_TRANSFER\">";
|
||||||
@ -361,8 +365,8 @@ print "</tr>\n";
|
|||||||
if($conf->invoice->enabled) {
|
if($conf->invoice->enabled) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_INVOICE\">";
|
||||||
@ -376,8 +380,8 @@ if($conf->invoice->enabled) {
|
|||||||
if($conf->order->enabled) {
|
if($conf->order->enabled) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_ORDER\">";
|
||||||
@ -391,8 +395,8 @@ if($conf->order->enabled) {
|
|||||||
if($conf->expedition->enabled) {
|
if($conf->expedition->enabled) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT\">";
|
||||||
@ -404,6 +408,9 @@ if($conf->expedition->enabled) {
|
|||||||
}
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
$virtualdiffersfromphysical=0;
|
$virtualdiffersfromphysical=0;
|
||||||
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
||||||
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
|
||||||
@ -411,7 +418,6 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|
|||||||
|
|
||||||
if ($virtualdiffersfromphysical)
|
if ($virtualdiffersfromphysical)
|
||||||
{
|
{
|
||||||
print '<br>';
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
|
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
|
||||||
@ -419,8 +425,8 @@ if ($virtualdiffersfromphysical)
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("UseVirtualStockByDefault").'</td>';
|
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
|
||||||
print '<td width="160" align="right">';
|
print '<td align="right">';
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USE_VIRTUAL_STOCK\">";
|
||||||
@ -430,10 +436,71 @@ if ($virtualdiffersfromphysical)
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<br />';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print " <td>".$langs->trans("Other")."</td>\n";
|
||||||
|
print " <td align=\"right\" width=\"160\"> </td>\n";
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$langs->trans("UserWarehouseAutoCreate").'</td>';
|
||||||
|
print '<td class="width100" align="right">';
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
|
||||||
|
print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</form>';
|
||||||
|
print "</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>';
|
||||||
|
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc")).'</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_SUPPORTS_SERVICES\">";
|
||||||
|
print $form->selectyesno("STOCK_SUPPORTS_SERVICES",$conf->global->STOCK_SUPPORTS_SERVICES,1);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</form>';
|
||||||
|
print "</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
|
||||||
|
print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print '</form>';
|
||||||
|
print "</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.$langs->trans("UseDispatchStatus").'</td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
|
||||||
|
print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print "</form>\n";
|
||||||
|
print "</td>\n</tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -484,54 +551,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print " <td>".$langs->trans("Other")."</td>\n";
|
|
||||||
print " <td align=\"right\" width=\"160\"> </td>\n";
|
|
||||||
print '</tr>'."\n";
|
|
||||||
|
|
||||||
if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td width="60%">'.$langs->trans("UseDispatchStatus").'</td>';
|
|
||||||
print '<td width="160" align="right">';
|
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"SUPPLIER_ORDER_USE_DISPATCH_STATUS\">";
|
|
||||||
print $form->selectyesno("SUPPLIER_ORDER_USE_DISPATCH_STATUS",$conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS,1);
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
|
||||||
print "</form>\n";
|
|
||||||
print "</td>\n</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td width="60%">'.$langs->trans("UserWarehouseAutoCreate").'</td>';
|
|
||||||
print '<td width="160" align="right">';
|
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_USERSTOCK_AUTOCREATE\">";
|
|
||||||
print $form->selectyesno("STOCK_USERSTOCK_AUTOCREATE",$conf->global->STOCK_USERSTOCK_AUTOCREATE,1);
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
|
||||||
print '</form>';
|
|
||||||
print "</td>\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td width="60%">'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
|
|
||||||
|
|
||||||
print '<td width="160" align="right">';
|
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE\">";
|
|
||||||
print $form->selectyesno("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE",$conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE,1);
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
|
||||||
print '</form>';
|
|
||||||
print "</td>\n";
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
||||||
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
||||||
if ($conf->global->PRODUIT_SOUSPRODUITS)
|
if ($conf->global->PRODUIT_SOUSPRODUITS)
|
||||||
@ -539,9 +558,8 @@ if ($conf->global->PRODUIT_SOUSPRODUITS)
|
|||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td width="60%">'.$langs->trans("IndependantSubProductStock").'</td>';
|
print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
|
||||||
|
print '<td align="right">';
|
||||||
print '<td width="160" align="right">';
|
|
||||||
print "<form method=\"post\" action=\"stock.php\">";
|
print "<form method=\"post\" action=\"stock.php\">";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"INDEPENDANT_SUBPRODUCT_STOCK\">";
|
print "<input type=\"hidden\" name=\"action\" value=\"INDEPENDANT_SUBPRODUCT_STOCK\">";
|
||||||
@ -553,8 +571,6 @@ if ($conf->global->PRODUIT_SOUSPRODUITS)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
@ -336,7 +336,7 @@ jQuery(document).ready(function() {
|
|||||||
var compjsphpstring;
|
var compjsphpstring;
|
||||||
getjsphpurl = $.ajax({
|
getjsphpurl = $.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: \''.DOL_URL_ROOT.'/core/js/datepicker.js.php\',
|
url: \''.DOL_URL_ROOT.'/core/js/lib_head.js.php\',
|
||||||
cache: false,
|
cache: false,
|
||||||
/* async: false, */
|
/* async: false, */
|
||||||
/* crossDomain: true,*/
|
/* crossDomain: true,*/
|
||||||
|
|||||||
@ -64,8 +64,8 @@ $hookmanager->initHooks(array('admintranslation','globaladmin'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -88,7 +88,45 @@ if ($action == 'setMAIN_ENABLE_OVERWRITE_TRANSLATION')
|
|||||||
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
if ($action == 'update')
|
||||||
|
{
|
||||||
|
if ($transvalue == '')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."overwrite_trans set transvalue = '".$db->escape($transvalue)."' WHERE rowid = ".GETPOST('rowid','int');
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
|
$action="";
|
||||||
|
$transkey="";
|
||||||
|
$transvalue="";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
$db->rollback();
|
||||||
|
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($db->lasterror(), null, 'errors');
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -209,7 +247,6 @@ print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?
|
|||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
@ -230,8 +267,7 @@ if ($mode == 'overwrite')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="action" value="'.($action=='edit'?'update':'add').'">';
|
||||||
print '<input type="hidden" id="action" name="action" value="">';
|
|
||||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
@ -248,13 +284,16 @@ if ($mode == 'overwrite')
|
|||||||
// Line to add new record
|
// Line to add new record
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
|
$disablededit='';
|
||||||
|
if ($action == 'edit') $disablededit=' disabled';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1);
|
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="">';
|
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="">';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="">';
|
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Limit to superadmin
|
// Limit to superadmin
|
||||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||||
@ -270,7 +309,7 @@ if ($mode == 'overwrite')
|
|||||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||||
//}
|
//}
|
||||||
$disabled='';
|
$disabled='';
|
||||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
|
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disabled=' disabled="disabled"';
|
||||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
|
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add">';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -308,11 +347,30 @@ if ($mode == 'overwrite')
|
|||||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||||
*/
|
*/
|
||||||
|
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||||
|
{
|
||||||
|
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$obj->transvalue.'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
print $obj->transvalue;
|
print $obj->transvalue;
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
|
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||||
|
{
|
||||||
|
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||||
|
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_edit().'</a>';
|
||||||
|
print ' ';
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
|
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -389,7 +447,6 @@ if ($mode == 'searchkey')
|
|||||||
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')';
|
if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.')';
|
||||||
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
|
print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n";
|
||||||
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" id="action" name="action" value="search">';
|
print '<input type="hidden" id="action" name="action" value="search">';
|
||||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||||
|
|
||||||
|
|||||||
@ -128,7 +128,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
|
|||||||
|
|
||||||
// Show message
|
// Show message
|
||||||
$message='';
|
$message='';
|
||||||
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&userpassword=<strong>thepassword</strong>[&reset=1]';
|
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
|
||||||
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
||||||
$message.=img_picto('','object_globe.png').' '.$url;
|
$message.=img_picto('','object_globe.png').' '.$url;
|
||||||
print $message;
|
print $message;
|
||||||
|
|||||||
@ -37,6 +37,10 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not lo
|
|||||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
|
|
||||||
|
// Force entity if a value provided int HTTP header. Otherwise, will use the entity of user of token used.
|
||||||
|
if (! empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||||
|
|
||||||
|
|
||||||
$res=0;
|
$res=0;
|
||||||
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
|
||||||
if (! $res) die("Include of main fails");
|
if (! $res) die("Include of main fails");
|
||||||
|
|||||||
@ -63,7 +63,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (GETPOST("cancel"))
|
if (GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
|
|||||||
@ -119,14 +119,12 @@ class Bookmark extends CommonObject
|
|||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_user,dateb,url,target";
|
||||||
$sql.= ",title,favicon,position";
|
$sql.= ",title,favicon,position";
|
||||||
$sql.= ",entity";
|
$sql.= ",entity";
|
||||||
if ($this->fk_soc) $sql.=",fk_soc";
|
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= ($this->fk_user > 0?"'".$this->fk_user."'":"0").",";
|
$sql.= ($this->fk_user > 0 ? $this->fk_user:"0").",";
|
||||||
$sql.= " '".$this->db->idate($now)."',";
|
$sql.= " '".$this->db->idate($now)."',";
|
||||||
$sql.= " '".$this->url."', '".$this->target."',";
|
$sql.= " '".$this->db->escape($this->url)."', '".$this->db->escape($this->target)."',";
|
||||||
$sql.= " '".$this->db->escape($this->title)."', '".$this->favicon."', '".$this->position."'";
|
$sql.= " '".$this->db->escape($this->title)."', '".$this->db->escape($this->favicon)."', '".$this->db->escape($this->position)."'";
|
||||||
$sql.= ", '".$conf->entity."'";
|
$sql.= ", ".$this->db->escape($conf->entity);
|
||||||
if ($this->fk_soc) $sql.=",".$this->fk_soc;
|
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("Bookmark::update", LOG_DEBUG);
|
dol_syslog("Bookmark::update", LOG_DEBUG);
|
||||||
@ -170,7 +168,7 @@ class Bookmark extends CommonObject
|
|||||||
if (empty($this->position)) $this->position=0;
|
if (empty($this->position)) $this->position=0;
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bookmark";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bookmark";
|
||||||
$sql.= " SET fk_user = ".($this->fk_user > 0?"'".$this->fk_user."'":"0");
|
$sql.= " SET fk_user = ".($this->fk_user > 0 ? $this->fk_user :"0");
|
||||||
$sql.= " ,dateb = '".$this->db->idate($this->datec)."'";
|
$sql.= " ,dateb = '".$this->db->idate($this->datec)."'";
|
||||||
$sql.= " ,url = '".$this->db->escape($this->url)."'";
|
$sql.= " ,url = '".$this->db->escape($this->url)."'";
|
||||||
$sql.= " ,target = '".$this->db->escape($this->target)."'";
|
$sql.= " ,target = '".$this->db->escape($this->target)."'";
|
||||||
|
|||||||
@ -311,7 +311,7 @@ class Categorie extends CommonObject
|
|||||||
$sql.= " import_key,";
|
$sql.= " import_key,";
|
||||||
$sql.= " entity";
|
$sql.= " entity";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= $this->fk_parent.",";
|
$sql.= $this->db->escape($this->fk_parent).",";
|
||||||
$sql.= "'".$this->db->escape($this->label)."',";
|
$sql.= "'".$this->db->escape($this->label)."',";
|
||||||
$sql.= "'".$this->db->escape($this->description)."',";
|
$sql.= "'".$this->db->escape($this->description)."',";
|
||||||
$sql.= "'".$this->db->escape($this->color)."',";
|
$sql.= "'".$this->db->escape($this->color)."',";
|
||||||
@ -319,10 +319,10 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql.= ($this->socid != -1 ? $this->socid : 'null').",";
|
$sql.= ($this->socid != -1 ? $this->socid : 'null').",";
|
||||||
}
|
}
|
||||||
$sql.= "'".$this->visible."',";
|
$sql.= "'".$this->db->escape($this->visible)."',";
|
||||||
$sql.= $type.",";
|
$sql.= $this->db->escape($type).",";
|
||||||
$sql.= (! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":'null').",";
|
$sql.= (! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":'null').",";
|
||||||
$sql.= $conf->entity;
|
$sql.= $this->db->escape($conf->entity);
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
@ -1548,20 +1548,35 @@ class Categorie extends CommonObject
|
|||||||
dol_mkdir($dir);
|
dol_mkdir($dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir)) {
|
||||||
|
if (is_array($file['name']) && count($file['name']) > 0)
|
||||||
{
|
{
|
||||||
|
$nbfile = count($file['name']);
|
||||||
|
for ($i = 0; $i <= $nbfile; $i ++) {
|
||||||
|
|
||||||
|
$originImage = $dir . $file['name'][$i];
|
||||||
|
|
||||||
|
// Cree fichier en taille origine
|
||||||
|
dol_move_uploaded_file($file['tmp_name'][$i], $originImage, 1, 0, 0);
|
||||||
|
|
||||||
|
if (file_exists($originImage)) {
|
||||||
|
// Create thumbs
|
||||||
|
$this->addThumbs($originImage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$originImage = $dir . $file['name'];
|
$originImage = $dir . $file['name'];
|
||||||
|
|
||||||
// Cree fichier en taille origine
|
// Cree fichier en taille origine
|
||||||
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
|
dol_move_uploaded_file($file['tmp_name'], $originImage, 1, 0, 0);
|
||||||
|
|
||||||
if (file_exists($originImage))
|
if (file_exists($originImage)) {
|
||||||
{
|
|
||||||
// Create thumbs
|
// Create thumbs
|
||||||
$this->addThumbs($originImage);
|
$this->addThumbs($originImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return tableau de toutes les photos de la categorie
|
* Return tableau de toutes les photos de la categorie
|
||||||
|
|||||||
@ -36,7 +36,7 @@ $ref=GETPOST('ref');
|
|||||||
$type=GETPOST('type');
|
$type=GETPOST('type');
|
||||||
$action=GETPOST('action','aZ09');
|
$action=GETPOST('action','aZ09');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
$cancel=GETPOST('cancel');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
|
|
||||||
$socid=GETPOST('socid','int');
|
$socid=GETPOST('socid','int');
|
||||||
$label=GETPOST('label');
|
$label=GETPOST('label');
|
||||||
|
|||||||
@ -397,7 +397,7 @@ if ($action == 'update')
|
|||||||
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
|
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
|
||||||
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
|
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
|
||||||
|
|
||||||
$object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
|
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
|
||||||
$object->label = GETPOST("label");
|
$object->label = GETPOST("label");
|
||||||
$object->datep = $datep;
|
$object->datep = $datep;
|
||||||
$object->datef = $datef;
|
$object->datef = $datef;
|
||||||
@ -407,8 +407,6 @@ if ($action == 'update')
|
|||||||
$object->location = GETPOST('location');
|
$object->location = GETPOST('location');
|
||||||
$object->socid = GETPOST("socid");
|
$object->socid = GETPOST("socid");
|
||||||
$object->contactid = GETPOST("contactid",'int');
|
$object->contactid = GETPOST("contactid",'int');
|
||||||
//$object->societe->id = $_POST["socid"]; // deprecated
|
|
||||||
//$object->contact->id = $_POST["contactid"]; // deprecated
|
|
||||||
$object->fk_project = GETPOST("projectid",'int');
|
$object->fk_project = GETPOST("projectid",'int');
|
||||||
$object->note = GETPOST("note");
|
$object->note = GETPOST("note");
|
||||||
$object->pnote = GETPOST("note");
|
$object->pnote = GETPOST("note");
|
||||||
@ -670,7 +668,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Label").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||||
|
|
||||||
// Full day
|
// Full day
|
||||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
||||||
@ -869,7 +867,7 @@ if ($id > 0)
|
|||||||
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
|
$datep=dol_mktime($fulldayevent?'00':$aphour, $fulldayevent?'00':$apmin, 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
|
||||||
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
|
$datef=dol_mktime($fulldayevent?'23':$p2hour, $fulldayevent?'59':$p2min, $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
|
||||||
|
|
||||||
$object->fk_action = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
|
$object->type_id = dol_getIdFromCode($db, GETPOST("actioncode"), 'c_actioncomm');
|
||||||
$object->label = GETPOST("label");
|
$object->label = GETPOST("label");
|
||||||
$object->datep = $datep;
|
$object->datep = $datep;
|
||||||
$object->datef = $datef;
|
$object->datef = $datef;
|
||||||
@ -879,8 +877,6 @@ if ($id > 0)
|
|||||||
$object->location = GETPOST('location');
|
$object->location = GETPOST('location');
|
||||||
$object->socid = GETPOST("socid");
|
$object->socid = GETPOST("socid");
|
||||||
$object->contactid = GETPOST("contactid",'int');
|
$object->contactid = GETPOST("contactid",'int');
|
||||||
//$object->societe->id = $_POST["socid"]; // deprecated
|
|
||||||
//$object->contact->id = $_POST["contactid"]; // deprecated
|
|
||||||
$object->fk_project = GETPOST("projectid",'int');
|
$object->fk_project = GETPOST("projectid",'int');
|
||||||
|
|
||||||
$object->note = GETPOST("note");
|
$object->note = GETPOST("note");
|
||||||
|
|||||||
@ -299,20 +299,20 @@ class ActionComm extends CommonObject
|
|||||||
$sql.= "'".$this->db->idate($now)."', ";
|
$sql.= "'".$this->db->idate($now)."', ";
|
||||||
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").", ";
|
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").", ";
|
||||||
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").", ";
|
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").", ";
|
||||||
$sql.= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '')?"'".$this->durationp."'":"null").","; // deprecated
|
$sql.= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '')?"'".$this->db->escape($this->durationp)."'":"null").", "; // deprecated
|
||||||
$sql.= (isset($this->type_id)?$this->type_id:"null").",";
|
$sql.= (isset($this->type_id)?$this->type_id:"null").",";
|
||||||
$sql.= (isset($this->type_code)?" '".$this->type_code."'":"null").",";
|
$sql.= (isset($this->type_code)?" '".$this->db->escape($this->type_code)."'":"null").", ";
|
||||||
$sql.= ((isset($this->socid) && $this->socid > 0)?" '".$this->socid."'":"null").",";
|
$sql.= ((isset($this->socid) && $this->socid > 0) ? $this->socid:"null").", ";
|
||||||
$sql.= ((isset($this->fk_project) && $this->fk_project > 0)?" '".$this->fk_project."'":"null").",";
|
$sql.= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project:"null").", ";
|
||||||
$sql.= " '".$this->db->escape($this->note)."', ";
|
$sql.= " '".$this->db->escape($this->note)."', ";
|
||||||
$sql.= ((isset($this->contactid) && $this->contactid > 0)?"'".$this->contactid."'":"null").",";
|
$sql.= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid:"null").", ";
|
||||||
$sql.= (isset($user->id) && $user->id > 0 ? "'".$user->id."'":"null").",";
|
$sql.= (isset($user->id) && $user->id > 0 ? $user->id:"null").", ";
|
||||||
$sql.= ($userownerid>0?"'".$userownerid."'":"null").",";
|
$sql.= ($userownerid>0 ? $userownerid:"null").", ";
|
||||||
$sql.= ($userdoneid>0?"'".$userdoneid."'":"null").",";
|
$sql.= ($userdoneid>0 ? $userdoneid:"null").", ";
|
||||||
$sql.= "'".$this->db->escape($this->label)."','".$this->percentage."','".$this->priority."','".$this->fulldayevent."','".$this->db->escape($this->location)."','".$this->punctual."',";
|
$sql.= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."','".$this->db->escape($this->punctual)."', ";
|
||||||
$sql.= "'".$this->transparency."',";
|
$sql.= "'".$this->db->escape($this->transparency)."', ";
|
||||||
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").", ";
|
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").", ";
|
||||||
$sql.= (! empty($this->elementtype)?"'".$this->elementtype."'":"null").",";
|
$sql.= (! empty($this->elementtype)?"'".$this->db->escape($this->elementtype)."'":"null").", ";
|
||||||
$sql.= $conf->entity;
|
$sql.= $conf->entity;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
@ -754,15 +754,15 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm ";
|
||||||
$sql.= " SET percent = '".$this->db->escape($this->percentage)."'";
|
$sql.= " SET percent = '".$this->db->escape($this->percentage)."'";
|
||||||
if ($this->fk_action > 0) $sql.= ", fk_action = '".$this->db->escape($this->fk_action)."'";
|
if ($this->type_id > 0) $sql.= ", fk_action = '".$this->db->escape($this->type_id)."'";
|
||||||
$sql.= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'":"null");
|
$sql.= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'":"null");
|
||||||
$sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
$sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null');
|
||||||
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
|
||||||
$sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated
|
$sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->db->escape($this->durationp)."'":"null"); // deprecated
|
||||||
$sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null");
|
$sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null");
|
||||||
$sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null");
|
$sql.= ", fk_project =". ($this->fk_project > 0 ? $this->fk_project:"null");
|
||||||
$sql.= ", fk_soc =". ($socid > 0 ? "'".$socid."'":"null");
|
$sql.= ", fk_soc =". ($socid > 0 ? $socid:"null");
|
||||||
$sql.= ", fk_contact =". ($contactid > 0 ? "'".$contactid."'":"null");
|
$sql.= ", fk_contact =". ($contactid > 0 ? $contactid:"null");
|
||||||
$sql.= ", priority = '".$this->db->escape($this->priority)."'";
|
$sql.= ", priority = '".$this->db->escape($this->priority)."'";
|
||||||
$sql.= ", fulldayevent = '".$this->db->escape($this->fulldayevent)."'";
|
$sql.= ", fulldayevent = '".$this->db->escape($this->fulldayevent)."'";
|
||||||
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
|
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
|
||||||
@ -770,8 +770,8 @@ class ActionComm extends CommonObject
|
|||||||
$sql.= ", fk_user_mod = ".$user->id;
|
$sql.= ", fk_user_mod = ".$user->id;
|
||||||
$sql.= ", fk_user_action=".($userownerid > 0 ? "'".$userownerid."'":"null");
|
$sql.= ", fk_user_action=".($userownerid > 0 ? "'".$userownerid."'":"null");
|
||||||
$sql.= ", fk_user_done=".($userdoneid > 0 ? "'".$userdoneid."'":"null");
|
$sql.= ", fk_user_done=".($userdoneid > 0 ? "'".$userdoneid."'":"null");
|
||||||
if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->fk_element:"null");
|
if (! empty($this->fk_element)) $sql.= ", fk_element=".($this->fk_element?$this->db->escape($this->fk_element):"null");
|
||||||
if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->elementtype."'":"null");
|
if (! empty($this->elementtype)) $sql.= ", elementtype=".($this->elementtype?"'".$this->db->escape($this->elementtype)."'":"null");
|
||||||
$sql.= " WHERE id=".$this->id;
|
$sql.= " WHERE id=".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
@ -851,7 +851,8 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all objects with filters
|
* Load all objects with filters.
|
||||||
|
* WARNING: This make a fetch on all records instead of making one request with a join.
|
||||||
*
|
*
|
||||||
* @param DoliDb $db Database handler
|
* @param DoliDb $db Database handler
|
||||||
* @param int $socid Filter by thirdparty
|
* @param int $socid Filter by thirdparty
|
||||||
@ -860,9 +861,10 @@ class ActionComm extends CommonObject
|
|||||||
* @param string $filter Other filter
|
* @param string $filter Other filter
|
||||||
* @param string $sortfield Sort on this field
|
* @param string $sortfield Sort on this field
|
||||||
* @param string $sortorder ASC or DESC
|
* @param string $sortorder ASC or DESC
|
||||||
|
* @param string $limit Limit number of answers
|
||||||
* @return array or string Error string if KO, array with actions if OK
|
* @return array or string Error string if KO, array with actions if OK
|
||||||
*/
|
*/
|
||||||
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='', $sortorder='')
|
static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='a.datep', $sortorder='DESC', $limit=0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -879,6 +881,7 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
if (! empty($filter)) $sql.= $filter;
|
if (! empty($filter)) $sql.= $filter;
|
||||||
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
|
||||||
|
$sql.=$db->plimit($limit, 0);
|
||||||
|
|
||||||
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
dol_syslog(get_class()."::getActions", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -371,6 +371,7 @@ if ($resql)
|
|||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
print '<td class="liste_titre"><input type="text" name="search_title" value="'.$search_title.'"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
@ -382,7 +383,6 @@ if ($resql)
|
|||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print '<td class="liste_titre"></td>';
|
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -395,7 +395,8 @@ if ($resql)
|
|||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
|
||||||
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||||
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||||
@ -403,7 +404,6 @@ if ($resql)
|
|||||||
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||||
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
|
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
|
||||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre("");
|
print_liste_field_titre("");
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -437,13 +437,23 @@ if ($resql)
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
// Action (type)
|
// Ref
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $actionstatic->getNomUrl(1,-1);
|
print $actionstatic->getNomUrl(1,-1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Action (type)
|
// User owner
|
||||||
print '<td>';
|
print '<td class="tdoverflowmax100">';
|
||||||
|
if ($obj->fk_user_action > 0)
|
||||||
|
{
|
||||||
|
$userstatic->fetch($obj->fk_user_action);
|
||||||
|
print $userstatic->getNomUrl(-1);
|
||||||
|
}
|
||||||
|
else print ' ';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<td class="tdoverflowmax300">';
|
||||||
print $actionstatic->label;
|
print $actionstatic->label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -482,7 +492,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
print '<td>';
|
print '<td class="tdoverflowmax100">';
|
||||||
if ($obj->socid)
|
if ($obj->socid)
|
||||||
{
|
{
|
||||||
$societestatic->id=$obj->socid;
|
$societestatic->id=$obj->socid;
|
||||||
@ -520,16 +530,6 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// User owner
|
|
||||||
print '<td align="left">';
|
|
||||||
if ($obj->fk_user_action > 0)
|
|
||||||
{
|
|
||||||
$userstatic->fetch($obj->fk_user_action);
|
|
||||||
print $userstatic->getNomUrl(-1);
|
|
||||||
}
|
|
||||||
else print ' ';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Status/Percent
|
// Status/Percent
|
||||||
$datep=$db->jdate($obj->datep);
|
$datep=$db->jdate($obj->datep);
|
||||||
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>';
|
print '<td align="center" class="nowrap">'.$actionstatic->LibStatut($obj->percent,3,0,$datep).'</td>';
|
||||||
|
|||||||
@ -52,7 +52,7 @@ $object = new Address($db);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
if (GETPOST("cancel") && ! empty($backtopage))
|
if (GETPOST('cancel','alpha') && ! empty($backtopage))
|
||||||
{
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.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.class.php';
|
||||||
|
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
||||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
if (! empty($conf->expedition->enabled)) require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||||
@ -72,7 +73,7 @@ $pageprev = $page - 1;
|
|||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="nom";
|
if (! $sortfield) $sortfield="nom";
|
||||||
$cancelbutton = GETPOST('cancel');
|
$cancelbutton = GETPOST('cancel','alpha');
|
||||||
|
|
||||||
$object = new Client($db);
|
$object = new Client($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
@ -330,6 +331,8 @@ if ($id > 0)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if (! empty($conf->banque->enabled))
|
||||||
|
{
|
||||||
// Compte bancaire par défaut
|
// Compte bancaire par défaut
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||||
@ -348,7 +351,7 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
@ -951,6 +954,107 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Last invoices templates
|
||||||
|
*/
|
||||||
|
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
|
{
|
||||||
|
$invoicetemplate = new FactureRec($db);
|
||||||
|
|
||||||
|
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
|
||||||
|
$sql.= ', f.total as total_ht';
|
||||||
|
$sql.= ', f.tva as total_tva';
|
||||||
|
$sql.= ', f.total_ttc';
|
||||||
|
$sql.= ', f.datec as dc';
|
||||||
|
$sql.= ', f.date_last_gen';
|
||||||
|
$sql.= ', f.frequency';
|
||||||
|
$sql.= ', f.unit_frequency';
|
||||||
|
$sql.= ', f.suspended as suspended';
|
||||||
|
$sql.= ', s.nom, s.rowid as socid';
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||||
|
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||||
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
|
$sql.= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
|
||||||
|
$sql.= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
|
||||||
|
$sql.= ' f.suspended,';
|
||||||
|
$sql.= ' s.nom, s.rowid';
|
||||||
|
$sql.= " ORDER BY f.date_last_gen, f.datec DESC";
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$var=true;
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
|
||||||
|
print '</tr></table></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($i < $num && $i < $MAXLIST)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
$invoicetemplate->id = $objp->id;
|
||||||
|
$invoicetemplate->ref = $objp->ref;
|
||||||
|
$invoicetemplate->suspended = $objp->suspended;
|
||||||
|
$invoicetemplate->frequency = $objp->frequency;
|
||||||
|
$invoicetemplate->unit_frequency = $objp->unit_frequency;
|
||||||
|
$invoicetemplate->total_ht = $objp->total_ht;
|
||||||
|
$invoicetemplate->total_tva = $objp->total_tva;
|
||||||
|
$invoicetemplate->total_ttc = $objp->total_ttc;
|
||||||
|
print $invoicetemplate->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
if ($objp->frequency && $objp->date_last_gen > 0)
|
||||||
|
{
|
||||||
|
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen),'day').'</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($objp->dc > 0)
|
||||||
|
{
|
||||||
|
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc),'day').'</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td align="right"><b>!!!</b></td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<td align="right" style="min-width: 60px">';
|
||||||
|
print price($objp->total_ht);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
|
||||||
|
{
|
||||||
|
print '<td align="right" style="min-width: 60px">';
|
||||||
|
print price($objp->total_ttc);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td align="right" class="nowrap" style="min-width: 60px">';
|
||||||
|
print $langs->trans('FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).' - ';
|
||||||
|
print ($invoicetemplate->LibStatut($invoicetemplate->frequency,$invoicetemplate->suspended,5,0));
|
||||||
|
print '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
|
if ($num > 0) print "</table>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Last invoices
|
* Last invoices
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -45,13 +45,13 @@ if (! empty($conf->categorie->enabled)) {
|
|||||||
if (! $user->rights->mailing->lire || $user->societe_id > 0)
|
if (! $user->rights->mailing->lire || $user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
// Load variable for pagination
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$page = GETPOST("page", 'int');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
if ($page == - 1) {
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$page = 0;
|
$page = GETPOST('page','int');
|
||||||
}
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
$offset = $conf->liste_limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if (! $sortorder)
|
if (! $sortorder)
|
||||||
|
|||||||
@ -189,8 +189,9 @@ if (empty($reshook))
|
|||||||
|
|
||||||
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
|
while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB)
|
||||||
{
|
{
|
||||||
|
// Here code is common with same loop ino mailing-send.php
|
||||||
$res=1;
|
$res=1;
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
@ -222,6 +223,27 @@ if (empty($reshook))
|
|||||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>',
|
||||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>'
|
||||||
);
|
);
|
||||||
|
$onlinepaymentenabled = 0;
|
||||||
|
if (! empty($conf->paypal->enabled)) $onlinepaymentenabled++;
|
||||||
|
if (! empty($conf->paybox->enabled)) $onlinepaymentenabled++;
|
||||||
|
if (! empty($conf->stripe->enabled)) $onlinepaymentenabled++;
|
||||||
|
if ($onlinepaymentenabled && ! empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
||||||
|
{
|
||||||
|
$substitutionarray['__SECUREKEYPAYMENT__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||||
|
|
||||||
|
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||||
|
else $substitutionarray['__SECUREKEYPAYMENT_MEMBER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
|
||||||
|
|
||||||
|
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||||
|
else $substitutionarray['__SECUREKEYPAYMENT_ORDER__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
|
||||||
|
|
||||||
|
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||||
|
else $substitutionarray['__SECUREKEYPAYMENT_INVOICE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
|
||||||
|
|
||||||
|
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||||
|
else $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
|
||||||
|
}
|
||||||
|
/* For backward compatibility */
|
||||||
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
|
||||||
{
|
{
|
||||||
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||||
@ -738,7 +760,7 @@ if ($action == 'create')
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTopic").'</td><td><input class="flat minwidth200 quatrevingtpercent" name="sujet" value="'.dol_escape_htmltag(GETPOST('sujet')).'"></td></tr>';
|
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("MailTopic").'</td><td><input class="flat minwidth200 quatrevingtpercent" name="sujet" value="'.dol_escape_htmltag(GETPOST('sujet')).'"></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||||
print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','new_mailing',0);
|
print $htmlother->selectColor($_POST['bgcolor'],'bgcolor','',0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -930,7 +952,7 @@ else
|
|||||||
* Boutons d'action
|
* Boutons d'action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("cancel") || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone')))
|
if (GETPOST('cancel','alpha') || $confirm=='no' || $action == '' || in_array($action,array('settodraft', 'valid','delete','sendall','clone')))
|
||||||
{
|
{
|
||||||
print "\n\n<div class=\"tabsAction\">\n";
|
print "\n\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
@ -940,8 +962,15 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
|
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
|
||||||
|
{
|
||||||
|
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_MAILING))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditWithTextEditor").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax)) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
|
if (! empty($conf->use_javascript_ajax)) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edithtml&id='.$object->id.'">'.$langs->trans("EditHTMLSource").'</a>';
|
||||||
}
|
}
|
||||||
@ -1091,19 +1120,19 @@ else
|
|||||||
|
|
||||||
// Background color
|
// Background color
|
||||||
/*print '<tr><td width="15%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
/*print '<tr><td width="15%">'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||||
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
|
print $htmlother->selectColor($object->bgcolor,'bgcolor','',0);
|
||||||
print '</td></tr>';*/
|
print '</td></tr>';*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
print '<div style="padding-top: 10px" bgcolor="'.($object->bgcolor?(preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor:'white').'">';
|
print '<div style="padding-top: 10px; background: '.($object->bgcolor?(preg_match('/^#/',$object->bgcolor)?'':'#').$object->bgcolor:'white').'">';
|
||||||
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff')
|
if (empty($object->bgcolor) || strtolower($object->bgcolor) == 'ffffff') // CKEditor does not apply the color of the div into its content area
|
||||||
{
|
{
|
||||||
$readonly=1;
|
$readonly=1;
|
||||||
// Editeur wysiwyg
|
// Editeur wysiwyg
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,$readonly);
|
$doleditor=new DolEditor('bodyemail',$object->body,'',600,'dolibarr_mailings','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,'90%',$readonly);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
}
|
}
|
||||||
else print dol_htmlentitiesbr($object->body);
|
else print dol_htmlentitiesbr($object->body);
|
||||||
@ -1195,7 +1224,6 @@ else
|
|||||||
// Print mail content
|
// Print mail content
|
||||||
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic');
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_head(null, '', '', -1);
|
dol_fiche_head(null, '', '', -1);
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -1245,7 +1273,7 @@ else
|
|||||||
|
|
||||||
// Background color
|
// Background color
|
||||||
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans("BackgroundColorByDefault").'</td><td colspan="3">';
|
||||||
print $htmlother->selectColor($object->bgcolor,'bgcolor','edit_mailing',0);
|
print $htmlother->selectColor($object->bgcolor,'bgcolor','',0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -121,7 +121,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
|
|
||||||
$sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").",";
|
$sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").",";
|
||||||
$sql.= " ".$conf->entity.",";
|
$sql.= " ".$conf->entity.",";
|
||||||
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
|
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->db->escape($this->fk_mailing)."'").",";
|
||||||
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
|
||||||
$sql.= " ".$user->id.",";
|
$sql.= " ".$user->id.",";
|
||||||
$sql.= " '".$this->db->idate(dol_now())."',";
|
$sql.= " '".$this->db->idate(dol_now())."',";
|
||||||
@ -640,16 +640,16 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']);
|
$sqlwhere[]=$this->transformToSQL('t.firstname',$arrayquery['contact_firstname']);
|
||||||
}
|
}
|
||||||
if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) {
|
if (!empty($arrayquery['contact_country']) && count($arrayquery['contact_country'])) {
|
||||||
$sqlwhere[]= " (t.fk_pays IN (".$db->escape(implode(',',$arrayquery['contact_country']))."))";
|
$sqlwhere[]= " (t.fk_pays IN (".$this->db->escape(implode(',',$arrayquery['contact_country']))."))";
|
||||||
}
|
}
|
||||||
if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) {
|
if (!empty($arrayquery['contact_status']) && count($arrayquery['contact_status'])>0) {
|
||||||
$sqlwhere[]= " (t.statut IN (".$db->escape(implode(',',$arrayquery['contact_status']))."))";
|
$sqlwhere[]= " (t.statut IN (".$this->db->escape(implode(',',$arrayquery['contact_status']))."))";
|
||||||
}
|
}
|
||||||
if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) {
|
if (!empty($arrayquery['contact_civility']) && count($arrayquery['contact_civility'])>0) {
|
||||||
$sqlwhere[]= " (t.civility IN ('".$db->escape(implode("','",$arrayquery['contact_civility']))."'))";
|
$sqlwhere[]= " (t.civility IN ('".$this->db->escape(implode("','",$arrayquery['contact_civility']))."'))";
|
||||||
}
|
}
|
||||||
if ($arrayquery['contact_no_email']!='') {
|
if ($arrayquery['contact_no_email']!='') {
|
||||||
$sqlwhere[]= " (t.no_email='".$db->escape($arrayquery['contact_no_email'])."')";
|
$sqlwhere[]= " (t.no_email='".$this->db->escape($arrayquery['contact_no_email'])."')";
|
||||||
}
|
}
|
||||||
if ($arrayquery['contact_update_st_dt']!='') {
|
if ($arrayquery['contact_update_st_dt']!='') {
|
||||||
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
|
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";
|
||||||
@ -658,7 +658,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
$sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')";
|
$sqlwhere[]= " (t.datec >= '".$this->db->idate($arrayquery['contact_create_st_dt'])."' AND t.datec <= '".$this->db->idate($arrayquery['contact_create_end_dt'])."')";
|
||||||
}
|
}
|
||||||
if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) {
|
if (!empty($arrayquery['contact_categ']) && count($arrayquery['contact_categ'])>0) {
|
||||||
$sqlwhere[]= " (contactcateg.fk_categorie IN (".$db->escape(implode(",",$arrayquery['contact_categ']))."))";
|
$sqlwhere[]= " (contactcateg.fk_categorie IN (".$this->db->escape(implode(",",$arrayquery['contact_categ']))."))";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Standard Extrafield feature
|
//Standard Extrafield feature
|
||||||
|
|||||||
@ -125,7 +125,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($cancel) $action = '';
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
@ -602,7 +610,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close proposal
|
// Close proposal
|
||||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
|
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
if (! GETPOST('statut')) {
|
if (! GETPOST('statut')) {
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||||
@ -611,7 +619,7 @@ if (empty($reshook))
|
|||||||
// prevent browser refresh from closing proposal several times
|
// prevent browser refresh from closing proposal several times
|
||||||
if ($object->statut == Propal::STATUS_VALIDATED)
|
if ($object->statut == Propal::STATUS_VALIDATED)
|
||||||
{
|
{
|
||||||
$result=$object->cloture($user, GETPOST('statut'), GETPOST('note'));
|
$result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','alpha'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -622,7 +630,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reopen proposal
|
// Reopen proposal
|
||||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
|
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
// prevent browser refresh from reopening proposal several times
|
// prevent browser refresh from reopening proposal several times
|
||||||
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
|
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
|
||||||
@ -638,16 +646,10 @@ if (empty($reshook))
|
|||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Send mail
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$actiontypecode='AC_OTH_AUTO';
|
$actiontypecode='AC_OTH_AUTO';
|
||||||
$trigger_name='PROPAL_SENTBYMAIL';
|
$trigger_name='PROPAL_SENTBYMAIL';
|
||||||
$paramname='id';
|
$autocopy='MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
|
||||||
$mode='emailfromproposal';
|
|
||||||
$trackid='pro'.$object->id;
|
$trackid='pro'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
@ -1106,7 +1108,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel'))
|
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
@ -1376,7 +1378,7 @@ if ($action == 'create')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
@ -1686,6 +1688,18 @@ if ($action == 'create')
|
|||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'statut')
|
||||||
|
{
|
||||||
|
//Form to close proposal (signed or not)
|
||||||
|
$formquestion = array(
|
||||||
|
array('type' => 'select','name' => 'statut','label' => $langs->trans("CloseAs"),'values' => array(2=>$object->labelstatut [2],3=>$object->labelstatut [3])),
|
||||||
|
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
|
||||||
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
||||||
|
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), '', 'setstatut', $formquestion, '', 1, 250);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Confirm delete
|
// Confirm delete
|
||||||
else if ($action == 'delete') {
|
else if ($action == 'delete') {
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
|
||||||
@ -2213,35 +2227,6 @@ if ($action == 'create')
|
|||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
if ($action == 'statut')
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Form to close proposal (signed or not)
|
|
||||||
*/
|
|
||||||
$form_close = '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
|
||||||
$form_close .= '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
|
||||||
$form_close .= '<table class="border" width="100%">';
|
|
||||||
$form_close .= '<tr><td width="150" align="left">' . $langs->trans("CloseAs") . '</td><td align="left">';
|
|
||||||
$form_close .= '<input type="hidden" name="action" value="setstatut">';
|
|
||||||
$form_close .= '<select id="statut" name="statut" class="flat">';
|
|
||||||
$form_close .= '<option value="0"> </option>';
|
|
||||||
$form_close .= '<option value="2">' . $object->labelstatut [2] . '</option>';
|
|
||||||
$form_close .= '<option value="3">' . $object->labelstatut [3] . '</option>';
|
|
||||||
$form_close .= '</select>';
|
|
||||||
$form_close .= '</td></tr>';
|
|
||||||
$form_close .= '<tr><td width="150" align="left">' . $langs->trans('Note') . '</td><td align="left"><textarea cols="70" rows="' . ROWS_3 . '" wrap="soft" name="note">';
|
|
||||||
$form_close .= $object->note;
|
|
||||||
$form_close .= '</textarea></td></tr>';
|
|
||||||
$form_close .= '<tr><td align="center" colspan="2">';
|
|
||||||
$form_close .= '<input type="submit" class="button" name="validate" value="' . $langs->trans('Save') . '">';
|
|
||||||
$form_close .= ' <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '">';
|
|
||||||
$form_close .= '<a name="close"> </a>';
|
|
||||||
$form_close .= '</td>';
|
|
||||||
$form_close .= '</tr></table></form>';
|
|
||||||
|
|
||||||
print $form_close;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons Actions
|
* Boutons Actions
|
||||||
*/
|
*/
|
||||||
@ -2253,7 +2238,7 @@ if ($action == 'create')
|
|||||||
// modified by hook
|
// modified by hook
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($action != 'statut' && $action != 'editline')
|
if ($action != 'editline')
|
||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|
||||||
@ -2373,128 +2358,18 @@ if ($action == 'create')
|
|||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'propal', $socid);
|
$somethingshown = $formactions->showactions($object, 'propal', $socid, 1);
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Presend form
|
||||||
* Action presend
|
$modelmail='propal_send';
|
||||||
*/
|
$defaulttopic='SendPropalRef';
|
||||||
if ($action == 'presend')
|
$diroutput = $conf->propal->dir_output;
|
||||||
{
|
$trackid = 'pro'.$object->id;
|
||||||
$object->fetch_projet();
|
|
||||||
|
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
|
||||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang = '';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
|
||||||
$newlang = $_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
|
|
||||||
if (!empty($newlang))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate('', $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
$outputlangs->load('commercial');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file)) {
|
|
||||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
if ($result <= 0) {
|
|
||||||
dol_print_error($db, $object->error, $object->errors);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
|
||||||
print '<div class="clearboth"></div>';
|
|
||||||
print '<br>';
|
|
||||||
print load_fiche_titre($langs->trans('SendPropalByMail'));
|
|
||||||
|
|
||||||
dol_fiche_head('');
|
|
||||||
|
|
||||||
// Create form object
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
|
||||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
|
||||||
|
|
||||||
if($formmail->fromtype === 'user'){
|
|
||||||
$formmail->fromid = $user->id;
|
|
||||||
|
|
||||||
}
|
|
||||||
$formmail->trackid='pro'.$object->id;
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
|
||||||
{
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
|
|
||||||
}
|
|
||||||
$formmail->withfrom = 1;
|
|
||||||
$liste = array();
|
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
|
||||||
$liste [$key] = $value;
|
|
||||||
$formmail->withto = GETPOST("sendto") ? GETPOST("sendto") : $liste;
|
|
||||||
$formmail->withtocc = $liste;
|
|
||||||
$formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false);
|
|
||||||
if (empty($object->ref_client)) {
|
|
||||||
$formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__');
|
|
||||||
} else if (! empty($object->ref_client)) {
|
|
||||||
$formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__ (__REFCLIENT__)');
|
|
||||||
}
|
|
||||||
$formmail->withfile = 2;
|
|
||||||
$formmail->withbody = 1;
|
|
||||||
$formmail->withdeliveryreceipt = 1;
|
|
||||||
$formmail->withcancel = 1;
|
|
||||||
|
|
||||||
// Tableau des substitutions
|
|
||||||
$formmail->setSubstitFromObject($object);
|
|
||||||
$formmail->substit['__PROPREF__'] = $object->ref; // For backward compatibility
|
|
||||||
|
|
||||||
// Find the good contact adress
|
|
||||||
$custcontact = '';
|
|
||||||
$contactarr = array();
|
|
||||||
$contactarr = $object->liste_contact(- 1, 'external');
|
|
||||||
|
|
||||||
if (is_array($contactarr) && count($contactarr) > 0) {
|
|
||||||
foreach ($contactarr as $contact) {
|
|
||||||
if ($contact ['libelle'] == $langs->trans('TypeContact_propal_external_CUSTOMER')) { // TODO Use code and not label
|
|
||||||
$contactstatic = new Contact($db);
|
|
||||||
$contactstatic->fetch($contact ['id']);
|
|
||||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($custcontact)) {
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires
|
|
||||||
$formmail->param['action'] = 'send';
|
|
||||||
$formmail->param['models'] = 'propal_send';
|
|
||||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
|
||||||
$formmail->param['id'] = $object->id;
|
|
||||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
|
||||||
// Init list of files
|
|
||||||
if (GETPOST("mode") == 'init') {
|
|
||||||
$formmail->clear_attached_files();
|
|
||||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
|
||||||
}
|
|
||||||
|
|
||||||
print $formmail->get_form();
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -3772,28 +3772,28 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
$sql.= ' date_start, date_end';
|
$sql.= ' date_start, date_end';
|
||||||
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc)';
|
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc)';
|
||||||
$sql.= " VALUES (".$this->fk_propal.",";
|
$sql.= " VALUES (".$this->fk_propal.",";
|
||||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
$sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").",";
|
||||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||||
$sql.= " ".($this->fk_product?"'".$this->fk_product."'":"null").",";
|
$sql.= " ".($this->fk_product?"'".$this->db->escape($this->fk_product)."'":"null").",";
|
||||||
$sql.= " '".$this->product_type."',";
|
$sql.= " '".$this->db->escape($this->product_type)."',";
|
||||||
$sql.= " ".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
|
$sql.= " ".($this->fk_remise_except?"'".$this->db->escape($this->fk_remise_except)."'":"null").",";
|
||||||
$sql.= " ".price2num($this->qty).",";
|
$sql.= " ".price2num($this->qty).",";
|
||||||
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
|
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").",";
|
||||||
$sql.= " ".price2num($this->tva_tx).",";
|
$sql.= " ".price2num($this->tva_tx).",";
|
||||||
$sql.= " ".price2num($this->localtax1_tx).",";
|
$sql.= " ".price2num($this->localtax1_tx).",";
|
||||||
$sql.= " ".price2num($this->localtax2_tx).",";
|
$sql.= " ".price2num($this->localtax2_tx).",";
|
||||||
$sql.= " '".$this->localtax1_type."',";
|
$sql.= " '".$this->db->escape($this->localtax1_type)."',";
|
||||||
$sql.= " '".$this->localtax2_type."',";
|
$sql.= " '".$this->db->escape($this->localtax2_type)."',";
|
||||||
$sql.= " ".($this->subprice?price2num($this->subprice):"null").",";
|
$sql.= " ".($this->subprice?price2num($this->subprice):"null").",";
|
||||||
$sql.= " ".price2num($this->remise_percent).",";
|
$sql.= " ".price2num($this->remise_percent).",";
|
||||||
$sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").",";
|
$sql.= " ".(isset($this->info_bits)?"'".$this->db->escape($this->info_bits)."'":"null").",";
|
||||||
$sql.= " ".price2num($this->total_ht).",";
|
$sql.= " ".price2num($this->total_ht).",";
|
||||||
$sql.= " ".price2num($this->total_tva).",";
|
$sql.= " ".price2num($this->total_tva).",";
|
||||||
$sql.= " ".price2num($this->total_localtax1).",";
|
$sql.= " ".price2num($this->total_localtax1).",";
|
||||||
$sql.= " ".price2num($this->total_localtax2).",";
|
$sql.= " ".price2num($this->total_localtax2).",";
|
||||||
$sql.= " ".price2num($this->total_ttc).",";
|
$sql.= " ".price2num($this->total_ttc).",";
|
||||||
$sql.= " ".(!empty($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null").",";
|
$sql.= " ".(!empty($this->fk_fournprice)?"'".$this->db->escape($this->fk_fournprice)."'":"null").",";
|
||||||
$sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").",";
|
$sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").",";
|
||||||
$sql.= ' '.$this->special_code.',';
|
$sql.= ' '.$this->special_code.',';
|
||||||
$sql.= ' '.$this->rang.',';
|
$sql.= ' '.$this->rang.',';
|
||||||
@ -3975,7 +3975,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
$sql.= ", total_localtax1=".price2num($this->total_localtax1)."";
|
$sql.= ", total_localtax1=".price2num($this->total_localtax1)."";
|
||||||
$sql.= ", total_localtax2=".price2num($this->total_localtax2)."";
|
$sql.= ", total_localtax2=".price2num($this->total_localtax2)."";
|
||||||
}
|
}
|
||||||
$sql.= ", fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null");
|
$sql.= ", fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?"'".$this->db->escape($this->fk_fournprice)."'":"null");
|
||||||
$sql.= ", buy_price_ht=".price2num($this->pa_ht);
|
$sql.= ", buy_price_ht=".price2num($this->pa_ht);
|
||||||
if (strlen($this->special_code)) $sql.= ", special_code=".$this->special_code;
|
if (strlen($this->special_code)) $sql.= ", special_code=".$this->special_code;
|
||||||
$sql.= ", fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
|
$sql.= ", fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
|
||||||
|
|||||||
@ -73,6 +73,10 @@ $search_zip=GETPOST('search_zip','alpha');
|
|||||||
$search_state=trim(GETPOST("search_state"));
|
$search_state=trim(GETPOST("search_state"));
|
||||||
$search_country=GETPOST("search_country",'int');
|
$search_country=GETPOST("search_country",'int');
|
||||||
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
$viewstatut=GETPOST('viewstatut','alpha');
|
$viewstatut=GETPOST('viewstatut','alpha');
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
$object_statut=GETPOST('propal_statut','alpha');
|
$object_statut=GETPOST('propal_statut','alpha');
|
||||||
@ -80,9 +84,6 @@ $object_statut=GETPOST('propal_statut','alpha');
|
|||||||
$sall=GETPOST('sall', 'alphanohtml');
|
$sall=GETPOST('sall', 'alphanohtml');
|
||||||
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||||
|
|
||||||
$search_day=GETPOST("search_day","int");
|
|
||||||
$search_month=GETPOST("search_month","int");
|
|
||||||
$search_year=GETPOST("search_year","int");
|
|
||||||
|
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
@ -95,8 +96,8 @@ $pagenext = $page + 1;
|
|||||||
if (! $sortfield) $sortfield='p.ref';
|
if (! $sortfield) $sortfield='p.ref';
|
||||||
if (! $sortorder) $sortorder='DESC';
|
if (! $sortorder) $sortorder='DESC';
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage context to save list fields
|
||||||
$contextpage='proposallist';
|
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'proposallist';
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$module='propal';
|
$module='propal';
|
||||||
@ -168,8 +169,8 @@ $object = new Propal($db); // To be passed as parameter of executeHooks that nee
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -237,7 +238,7 @@ llxHeader('',$langs->trans('Proposal'),$help_url);
|
|||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||||
$sql.= " typent.code as typent_code,";
|
$sql.= " typent.code as typent_code,";
|
||||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||||
$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
$sql.= ' p.rowid, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||||
@ -371,6 +372,7 @@ if ($resql)
|
|||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||||
if ($sall) $param.='&sall='.urlencode($sall);
|
if ($sall) $param.='&sall='.urlencode($sall);
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
|
||||||
@ -411,105 +413,18 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||||
|
|
||||||
if ($massaction == 'presend')
|
if ($massaction == 'presend')
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
|
||||||
|
|
||||||
if (! GETPOST('cancel'))
|
|
||||||
{
|
|
||||||
$objecttmp=new Propal($db);
|
|
||||||
$listofselectedid=array();
|
|
||||||
$listofselectedthirdparties=array();
|
|
||||||
$listofselectedref=array();
|
|
||||||
foreach($arrayofselected as $toselectid)
|
|
||||||
{
|
|
||||||
$result=$objecttmp->fetch($toselectid);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$listofselectedid[$toselectid]=$toselectid;
|
|
||||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
|
||||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
|
||||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
|
|
||||||
dol_fiche_head(null, '', '');
|
|
||||||
|
|
||||||
$topicmail="SendSupplierProposalRef";
|
$topicmail="SendSupplierProposalRef";
|
||||||
$modelmail="supplier_proposal_send";
|
$modelmail="supplier_proposal_send";
|
||||||
|
$objecttmp=new Propal($db);
|
||||||
|
$trackid='ord'.$object->id;
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
$formmail->withform=-1;
|
|
||||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
|
||||||
|
|
||||||
if($formmail->fromtype === 'user'){
|
|
||||||
$formmail->fromid = $user->id;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
|
||||||
{
|
|
||||||
$formmail->trackid='ord'.$object->id;
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
|
||||||
{
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
|
||||||
}
|
|
||||||
$formmail->withfrom=1;
|
|
||||||
$liste=$langs->trans("AllRecipientSelected");
|
|
||||||
if (count($listofselectedthirdparties) == 1)
|
|
||||||
{
|
|
||||||
$liste=array();
|
|
||||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
|
||||||
$soc=new Societe($db);
|
|
||||||
$soc->fetch($thirdpartyid);
|
|
||||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
|
||||||
{
|
|
||||||
$liste[$key]=$value;
|
|
||||||
}
|
|
||||||
$formmail->withtoreadonly=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$formmail->withtoreadonly=1;
|
|
||||||
}
|
|
||||||
$formmail->withto=$liste;
|
|
||||||
$formmail->withtofree=0;
|
|
||||||
$formmail->withtocc=1;
|
|
||||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
|
||||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
|
||||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
|
||||||
$formmail->withbody=1;
|
|
||||||
$formmail->withdeliveryreceipt=1;
|
|
||||||
$formmail->withcancel=1;
|
|
||||||
// Tableau des substitutions
|
|
||||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
|
||||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
|
||||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
|
||||||
$formmail->substit['__PERSONALIZED__']='';
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires du post
|
|
||||||
$formmail->param['action']=$action;
|
|
||||||
$formmail->param['models']=$modelmail;
|
|
||||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
|
||||||
$formmail->param['id']=join(',',$arrayofselected);
|
|
||||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
|
||||||
|
|
||||||
print $formmail->get_form();
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
@ -613,7 +528,7 @@ if ($resql)
|
|||||||
// Date
|
// Date
|
||||||
if (! empty($arrayfields['p.date']['checked']))
|
if (! empty($arrayfields['p.date']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" colspan="1" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
//print $langs->trans('Month').': ';
|
//print $langs->trans('Month').': ';
|
||||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
@ -624,7 +539,7 @@ if ($resql)
|
|||||||
// Date end
|
// Date end
|
||||||
if (! empty($arrayfields['p.fin_validite']['checked']))
|
if (! empty($arrayfields['p.fin_validite']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" colspan="1"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
}
|
}
|
||||||
if (! empty($arrayfields['p.total_ht']['checked']))
|
if (! empty($arrayfields['p.total_ht']['checked']))
|
||||||
{
|
{
|
||||||
@ -811,6 +726,7 @@ if ($resql)
|
|||||||
$companystatic->name=$obj->name;
|
$companystatic->name=$obj->name;
|
||||||
$companystatic->client=$obj->client;
|
$companystatic->client=$obj->client;
|
||||||
$companystatic->code_client=$obj->code_client;
|
$companystatic->code_client=$obj->code_client;
|
||||||
|
$companystatic->email=$obj->email;
|
||||||
|
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
|
|||||||
@ -46,7 +46,7 @@ $backtopage = GETPOST('backtopage','alpha');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel') && ! empty($backtopage))
|
if (GETPOST('cancel','alpha') && ! empty($backtopage))
|
||||||
{
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -49,7 +49,7 @@ if ($user->societe_id > 0)
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel') && ! empty($backtopage))
|
if (GETPOST('cancel','alpha') && ! empty($backtopage))
|
||||||
{
|
{
|
||||||
header("Location: ".$backtopage);
|
header("Location: ".$backtopage);
|
||||||
exit;
|
exit;
|
||||||
@ -125,7 +125,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
|||||||
if ($res > 0 && $newid1 > 0 && $newid2 > 0)
|
if ($res > 0 && $newid1 > 0 && $newid2 > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back
|
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id.($backtopage?'&backtopage='.urlencode($backtopage):'')); // To avoid pb whith back
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -408,9 +408,9 @@ if ($socid > 0)
|
|||||||
if ($user->rights->societe->creer || $user->rights->facture->creer)
|
if ($user->rights->societe->creer || $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else print '<td> </td>';
|
else print '<td> </td>';
|
||||||
@ -441,7 +441,7 @@ if ($socid > 0)
|
|||||||
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
||||||
);
|
);
|
||||||
$langs->load("dict");
|
$langs->load("dict");
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage?'&backtopage='.urlencode($backtopage):''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -118,15 +118,10 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if ($cancel)
|
if ($cancel)
|
||||||
{
|
{
|
||||||
if ($action != 'addlink' && $action != 'updateline')
|
if (! empty($backtopage))
|
||||||
{
|
{
|
||||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/commande/list.php',1);
|
header("Location: ".$backtopage);
|
||||||
header("Location: ".$urltogo);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
|
||||||
if ($id > 0 || ! empty($ref)) {
|
|
||||||
$ret = $object->fetch($id,$ref);
|
|
||||||
$object->fetch_thirdparty();
|
|
||||||
}
|
}
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
@ -398,6 +393,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we create same links to contact than the ones found on origin object
|
// Now we create same links to contact than the ones found on origin object
|
||||||
|
/* Useless, already into the create
|
||||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||||
{
|
{
|
||||||
$originforcontact = $object->origin;
|
$originforcontact = $object->origin;
|
||||||
@ -420,7 +416,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters = array('objFrom' => $srcobject);
|
$parameters = array('objFrom' => $srcobject);
|
||||||
@ -1060,7 +1056,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel') == $langs->trans('Cancel')) {
|
else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
|
||||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -1255,13 +1251,13 @@ if (empty($reshook))
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions when printing a doc from card
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$trigger_name='ORDER_SENTBYMAIL';
|
$trigger_name='ORDER_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfromorder';
|
$autocopy='MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
|
||||||
$trackid='ord'.$object->id;
|
$trackid='ord'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
@ -1440,7 +1436,6 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$note_private = $object->getDefaultCreateValueFor('note_private');
|
$note_private = $object->getDefaultCreateValueFor('note_private');
|
||||||
$note_public = $object->getDefaultCreateValueFor('note_public');
|
$note_public = $object->getDefaultCreateValueFor('note_public');
|
||||||
}
|
}
|
||||||
$absolute_discount=$soc->getAvailableDiscounts();
|
|
||||||
|
|
||||||
|
|
||||||
print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||||
@ -1477,7 +1472,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||||
// reload page to retrieve customer informations
|
// reload page to retrieve customer informations
|
||||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||||
{
|
{
|
||||||
@ -1491,7 +1486,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
@ -2591,139 +2586,18 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'order', $socid);
|
$somethingshown = $formactions->showactions($object, 'order', $socid, 1);
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Presend form
|
||||||
* Action presend
|
|
||||||
*/
|
|
||||||
if ($action == 'presend')
|
|
||||||
{
|
|
||||||
$object->fetch_projet();
|
|
||||||
|
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
|
||||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang = '';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
|
||||||
$newlang = $_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
|
|
||||||
if (!empty($newlang))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate('', $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
$outputlangs->load('commercial');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show email form
|
|
||||||
|
|
||||||
// By default if $action=='presend'
|
|
||||||
$titreform='SendOrderByMail';
|
|
||||||
$topicmail='';
|
|
||||||
if (empty($object->ref_client)) {
|
|
||||||
$topicmail = $outputlangs->trans('SendOrderRef', '__ORDERREF__');
|
|
||||||
} else if (! empty($object->ref_client)) {
|
|
||||||
$topicmail = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)');
|
|
||||||
}
|
|
||||||
$action='send';
|
|
||||||
$modelmail='order_send';
|
$modelmail='order_send';
|
||||||
|
$defaulttopic='SendOrderRef';
|
||||||
|
$diroutput = $conf->commande->dir_output;
|
||||||
|
$trackid = 'ord'.$object->id;
|
||||||
|
|
||||||
// Build document if it not exists
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
if (! $file || ! is_readable($file)) {
|
|
||||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
if ($result <= 0) {
|
|
||||||
dol_print_error($db, $object->error, $object->errors);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
|
||||||
print '<div class="clearboth"></div>';
|
|
||||||
print '<br>';
|
|
||||||
print load_fiche_titre($langs->trans($titreform));
|
|
||||||
|
|
||||||
dol_fiche_head('');
|
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
|
||||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
|
||||||
|
|
||||||
if($formmail->fromtype === 'user'){
|
|
||||||
$formmail->fromid = $user->id;
|
|
||||||
|
|
||||||
}
|
|
||||||
$formmail->trackid='ord'.$object->id;
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
|
||||||
{
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
|
||||||
}
|
|
||||||
$formmail->withfrom = 1;
|
|
||||||
$liste = array();
|
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
|
||||||
$liste [$key] = $value;
|
|
||||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste;
|
|
||||||
$formmail->withtocc = $liste;
|
|
||||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
|
||||||
$formmail->withtopic = $topicmail;
|
|
||||||
$formmail->withfile = 2;
|
|
||||||
$formmail->withbody = 1;
|
|
||||||
$formmail->withdeliveryreceipt = 1;
|
|
||||||
$formmail->withcancel = 1;
|
|
||||||
// Tableau des substitutions
|
|
||||||
$formmail->setSubstitFromObject($object);
|
|
||||||
$formmail->substit ['__ORDERREF__'] = $object->ref;
|
|
||||||
|
|
||||||
$custcontact = '';
|
|
||||||
$contactarr = array();
|
|
||||||
$contactarr = $object->liste_contact(- 1, 'external');
|
|
||||||
|
|
||||||
if (is_array($contactarr) && count($contactarr) > 0)
|
|
||||||
{
|
|
||||||
foreach ($contactarr as $contact)
|
|
||||||
{
|
|
||||||
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
|
|
||||||
$contactstatic = new Contact($db);
|
|
||||||
$contactstatic->fetch($contact ['id']);
|
|
||||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($custcontact)) {
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires
|
|
||||||
$formmail->param['action'] = $action;
|
|
||||||
$formmail->param['models'] = $modelmail;
|
|
||||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
|
||||||
$formmail->param['orderid'] = $object->id;
|
|
||||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
|
||||||
|
|
||||||
// Init list of files
|
|
||||||
if (GETPOST("mode") == 'init') {
|
|
||||||
$formmail->clear_attached_files();
|
|
||||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show form
|
|
||||||
print $formmail->get_form();
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -775,11 +775,11 @@ class Commande extends CommonOrder
|
|||||||
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
||||||
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
|
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
|
||||||
$sql.= ", '".$this->db->escape($this->modelpdf)."'";
|
$sql.= ", '".$this->db->escape($this->modelpdf)."'";
|
||||||
$sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null");
|
$sql.= ", ".($this->cond_reglement_id>0?$this->cond_reglement_id:"null");
|
||||||
$sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"null");
|
$sql.= ", ".($this->mode_reglement_id>0?$this->mode_reglement_id:"null");
|
||||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||||
$sql.= ", ".($this->availability_id>0?"'".$this->availability_id."'":"null");
|
$sql.= ", ".($this->availability_id>0?$this->availability_id:"null");
|
||||||
$sql.= ", ".($this->demand_reason_id>0?"'".$this->demand_reason_id."'":"null");
|
$sql.= ", ".($this->demand_reason_id>0?$this->demand_reason_id:"null");
|
||||||
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
|
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
|
||||||
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL');
|
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL');
|
||||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||||
@ -920,7 +920,8 @@ class Commande extends CommonOrder
|
|||||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||||
{
|
{
|
||||||
$originforcontact = 'commande';
|
$originforcontact = 'commande';
|
||||||
$originidforcontact = $value->id;
|
if (is_object($value)) $originidforcontact = $value->id;
|
||||||
|
else $originidforcontact = $value;
|
||||||
break; // We take first one
|
break; // We take first one
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2233,7 +2234,7 @@ class Commande extends CommonOrder
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||||
$sql.= " SET date_commande = ".($date ? $this->db->idate($date) : 'null');
|
$sql.= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null');
|
||||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
@ -3994,18 +3995,18 @@ class OrderLine extends CommonOrderLine
|
|||||||
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
$sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
$sql.= " VALUES (".$this->fk_commande.",";
|
$sql.= " VALUES (".$this->fk_commande.",";
|
||||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
$sql.= " ".($this->fk_parent_line>0?"'".$this->db->escape($this->fk_parent_line)."'":"null").",";
|
||||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||||
$sql.= " '".price2num($this->qty)."',";
|
$sql.= " '".price2num($this->qty)."',";
|
||||||
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
|
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").",";
|
||||||
$sql.= " '".price2num($this->tva_tx)."',";
|
$sql.= " '".price2num($this->tva_tx)."',";
|
||||||
$sql.= " '".price2num($this->localtax1_tx)."',";
|
$sql.= " '".price2num($this->localtax1_tx)."',";
|
||||||
$sql.= " '".price2num($this->localtax2_tx)."',";
|
$sql.= " '".price2num($this->localtax2_tx)."',";
|
||||||
$sql.= " '".$this->localtax1_type."',";
|
$sql.= " '".$this->db->escape($this->localtax1_type)."',";
|
||||||
$sql.= " '".$this->localtax2_type."',";
|
$sql.= " '".$this->db->escape($this->localtax2_type)."',";
|
||||||
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
|
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
|
||||||
$sql.= " '".$this->product_type."',";
|
$sql.= " '".$this->db->escape($this->product_type)."',";
|
||||||
$sql.= " '".price2num($this->remise_percent)."',";
|
$sql.= " '".price2num($this->remise_percent)."',";
|
||||||
$sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").",";
|
$sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").",";
|
||||||
$sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").",";
|
$sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").",";
|
||||||
@ -4015,7 +4016,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
$sql.= ' '.$this->rang.',';
|
$sql.= ' '.$this->rang.',';
|
||||||
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
|
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
|
||||||
$sql.= ' '.price2num($this->pa_ht).',';
|
$sql.= ' '.price2num($this->pa_ht).',';
|
||||||
$sql.= " '".$this->info_bits."',";
|
$sql.= " '".$this->db->escape($this->info_bits)."',";
|
||||||
$sql.= " '".price2num($this->total_ht)."',";
|
$sql.= " '".price2num($this->total_ht)."',";
|
||||||
$sql.= " '".price2num($this->total_tva)."',";
|
$sql.= " '".price2num($this->total_tva)."',";
|
||||||
$sql.= " '".price2num($this->total_localtax1)."',";
|
$sql.= " '".price2num($this->total_localtax1)."',";
|
||||||
|
|||||||
@ -42,6 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
$langs->loadLangs(array("orders",'sendings','deliveries','companies','compta','bills'));
|
$langs->loadLangs(array("orders",'sendings','deliveries','companies','compta','bills'));
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ $result = restrictedArea($user, 'commande', $id,'');
|
|||||||
|
|
||||||
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
|
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
@ -118,6 +120,7 @@ $checkedtypetiers=0;
|
|||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'c.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1),
|
'c.ref_client'=>array('label'=>$langs->trans("RefCustomerOrder"), 'checked'=>1),
|
||||||
|
'p.project_ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0, 'enabled'=>1),
|
||||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||||
@ -149,8 +152,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -186,6 +189,7 @@ if (empty($reshook))
|
|||||||
$search_deliveryday='';
|
$search_deliveryday='';
|
||||||
$search_deliverymonth='';
|
$search_deliverymonth='';
|
||||||
$search_deliveryyear='';
|
$search_deliveryyear='';
|
||||||
|
$search_project_ref='';
|
||||||
$viewstatut='';
|
$viewstatut='';
|
||||||
$billed='';
|
$billed='';
|
||||||
$toselect='';
|
$toselect='';
|
||||||
@ -203,6 +207,7 @@ if (empty($reshook))
|
|||||||
$permtoread = $user->rights->commande->lire;
|
$permtoread = $user->rights->commande->lire;
|
||||||
$permtodelete = $user->rights->commande->supprimer;
|
$permtodelete = $user->rights->commande->supprimer;
|
||||||
$uploaddir = $conf->commande->dir_output;
|
$uploaddir = $conf->commande->dir_output;
|
||||||
|
$trigger_name='ORDER_SENTBYMAIL';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
|
|
||||||
// TODO Move this into mass action include
|
// TODO Move this into mass action include
|
||||||
@ -438,6 +443,7 @@ $formother = new FormOther($db);
|
|||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
$formcompany=new FormCompany($db);
|
$formcompany=new FormCompany($db);
|
||||||
|
$projectstatic=new Project($db);
|
||||||
|
|
||||||
$title=$langs->trans("Orders");
|
$title=$langs->trans("Orders");
|
||||||
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||||
@ -445,12 +451,13 @@ llxHeader('',$title,$help_url);
|
|||||||
|
|
||||||
$sql = 'SELECT';
|
$sql = 'SELECT';
|
||||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||||
$sql.= " typent.code as typent_code,";
|
$sql.= " typent.code as typent_code,";
|
||||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||||
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||||
$sql.= ' c.date_creation as date_creation, c.tms as date_update';
|
$sql.= ' c.date_creation as date_creation, c.tms as date_update,';
|
||||||
|
$sql.= " p.rowid as project_id, p.ref as project_ref";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -465,6 +472,7 @@ $sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
|||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||||
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
||||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||||
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||||
// We'll need this table joined to the select in order to filter by sale
|
// We'll need this table joined to the select in order to filter by sale
|
||||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
if ($search_user > 0)
|
if ($search_user > 0)
|
||||||
@ -539,6 +547,7 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
|||||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||||
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||||
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||||
|
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
foreach ($search_array_options as $key => $val)
|
foreach ($search_array_options as $key => $val)
|
||||||
{
|
{
|
||||||
@ -626,6 +635,7 @@ if ($resql)
|
|||||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||||
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
||||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
||||||
|
if ($search_project_ref >= 0) $param.="&search_project_ref=".$search_project_ref;
|
||||||
if ($show_files) $param.='&show_files=' .$show_files;
|
if ($show_files) $param.='&show_files=' .$show_files;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
if ($billed != '') $param.='&billed='.$billed;
|
if ($billed != '') $param.='&billed='.$billed;
|
||||||
@ -661,102 +671,17 @@ if ($resql)
|
|||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||||
|
|
||||||
// TODO Move this into an invluce
|
|
||||||
if ($massaction == 'presend')
|
if ($massaction == 'presend')
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
|
||||||
|
|
||||||
if (! GETPOST('cancel'))
|
|
||||||
{
|
|
||||||
$objecttmp=new Commande($db);
|
|
||||||
$listofselectedid=array();
|
|
||||||
$listofselectedthirdparties=array();
|
|
||||||
$listofselectedref=array();
|
|
||||||
foreach($arrayofselected as $toselectid)
|
|
||||||
{
|
|
||||||
$result=$objecttmp->fetch($toselectid);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$listofselectedid[$toselectid]=$toselectid;
|
|
||||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
|
||||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
|
||||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
|
||||||
|
|
||||||
dol_fiche_head(null, '', '');
|
|
||||||
|
|
||||||
$topicmail="SendOrderRef";
|
$topicmail="SendOrderRef";
|
||||||
$modelmail="order_send";
|
$modelmail="order_send";
|
||||||
|
$objecttmp=new Commande($db);
|
||||||
|
$trackid='ord'.$object->id;
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
}
|
||||||
$formmail = new FormMail($db);
|
|
||||||
$formmail->withform=-1;
|
|
||||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
|
||||||
|
|
||||||
if($formmail->fromtype === 'user'){
|
if ($massaction == 'createbills')
|
||||||
$formmail->fromid = $user->id;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
|
||||||
{
|
|
||||||
$formmail->trackid='ord'.$object->id;
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
|
||||||
{
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
|
|
||||||
}
|
|
||||||
$formmail->withfrom=1;
|
|
||||||
$liste=$langs->trans("AllRecipientSelected");
|
|
||||||
if (count($listofselectedthirdparties) == 1)
|
|
||||||
{
|
|
||||||
$liste=array();
|
|
||||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
|
||||||
$soc=new Societe($db);
|
|
||||||
$soc->fetch($thirdpartyid);
|
|
||||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
|
||||||
{
|
|
||||||
$liste[$key]=$value;
|
|
||||||
}
|
|
||||||
$formmail->withtoreadonly=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$formmail->withtoreadonly=1;
|
|
||||||
}
|
|
||||||
$formmail->withto=$liste;
|
|
||||||
$formmail->withtofree=0;
|
|
||||||
$formmail->withtocc=1;
|
|
||||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
|
||||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
|
||||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
|
||||||
$formmail->withbody=1;
|
|
||||||
$formmail->withdeliveryreceipt=1;
|
|
||||||
$formmail->withcancel=1;
|
|
||||||
// Tableau des substitutions
|
|
||||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
|
||||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
|
||||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
|
||||||
$formmail->substit['__PERSONALIZED__']='';
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires du post
|
|
||||||
$formmail->param['action']=$action;
|
|
||||||
$formmail->param['models']=$modelmail;
|
|
||||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
|
||||||
$formmail->param['id']=join(',',$arrayofselected);
|
|
||||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
|
||||||
|
|
||||||
print $formmail->get_form();
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
}
|
|
||||||
elseif ($massaction == 'createbills')
|
|
||||||
{
|
{
|
||||||
//var_dump($_REQUEST);
|
//var_dump($_REQUEST);
|
||||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||||
@ -873,6 +798,11 @@ if ($resql)
|
|||||||
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
|
print '<input class="flat" type="text" size="6" name="search_ref_customer" value="'.$search_ref_customer.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Project ref
|
||||||
|
if (! empty($arrayfields['p.project_ref']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.$search_project_ref.'"></td>';
|
||||||
|
}
|
||||||
// Thirpdarty
|
// Thirpdarty
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
@ -1016,6 +946,7 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['p.project_ref']['checked'])) print_liste_field_titre($arrayfields['p.project_ref']['label'],$_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
||||||
@ -1065,18 +996,18 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
$notshippable=0;
|
$notshippable=0;
|
||||||
$warning = 0;
|
$warning = 0;
|
||||||
$text_info='';
|
$text_info='';
|
||||||
$text_warning='';
|
$text_warning='';
|
||||||
$nbprod=0;
|
$nbprod=0;
|
||||||
|
|
||||||
// Ref
|
$companystatic->id=$obj->socid;
|
||||||
if (! empty($arrayfields['c.ref']['checked']))
|
$companystatic->code_client = $obj->code_client;
|
||||||
{
|
$companystatic->name=$obj->name;
|
||||||
print '<td class="nowrap">';
|
$companystatic->client=$obj->client;
|
||||||
|
$companystatic->email=$obj->email;
|
||||||
|
|
||||||
$generic_commande->id=$obj->rowid;
|
$generic_commande->id=$obj->rowid;
|
||||||
$generic_commande->ref=$obj->ref;
|
$generic_commande->ref=$obj->ref;
|
||||||
$generic_commande->statut = $obj->fk_statut;
|
$generic_commande->statut = $obj->fk_statut;
|
||||||
@ -1086,6 +1017,14 @@ if ($resql)
|
|||||||
$generic_commande->total_ht = $obj->total_ht;
|
$generic_commande->total_ht = $obj->total_ht;
|
||||||
$generic_commande->total_tva = $obj->total_tva;
|
$generic_commande->total_tva = $obj->total_tva;
|
||||||
$generic_commande->total_ttc = $obj->total_ttc;
|
$generic_commande->total_ttc = $obj->total_ttc;
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
if (! empty($arrayfields['c.ref']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
|
||||||
$generic_commande->lines=array();
|
$generic_commande->lines=array();
|
||||||
$generic_commande->getLinesArray();
|
$generic_commande->getLinesArray();
|
||||||
|
|
||||||
@ -1230,10 +1169,16 @@ if ($resql)
|
|||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$companystatic->id=$obj->socid;
|
// Project
|
||||||
$companystatic->code_client = $obj->code_client;
|
if (! empty($arrayfields['p.project_ref']['checked']))
|
||||||
$companystatic->name=$obj->name;
|
{
|
||||||
$companystatic->client=$obj->client;
|
$projectstatic->id=$obj->project_id;
|
||||||
|
$projectstatic->ref=$obj->project_ref;
|
||||||
|
print '<td>';
|
||||||
|
if ($obj->project_id > 0) print $projectstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
|
|||||||
@ -161,8 +161,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|||||||
@ -145,7 +145,7 @@ if ($action == 'add')
|
|||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
// Category association
|
// Category association
|
||||||
$categories = GETPOST('categories');
|
$categories = GETPOST('categories', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||||
@ -239,7 +239,7 @@ if ($action == 'update')
|
|||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Category association
|
// Category association
|
||||||
$categories = GETPOST('categories');
|
$categories = GETPOST('categories', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||||
|
|||||||
@ -573,21 +573,21 @@ class Account extends CommonObject
|
|||||||
$sql.= ", '".$this->db->escape($this->account_number)."'";
|
$sql.= ", '".$this->db->escape($this->account_number)."'";
|
||||||
$sql.= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
|
$sql.= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
|
||||||
$sql.= ", '".$this->db->escape($this->bank)."'";
|
$sql.= ", '".$this->db->escape($this->bank)."'";
|
||||||
$sql.= ", '".$this->code_banque."'";
|
$sql.= ", '".$this->db->escape($this->code_banque)."'";
|
||||||
$sql.= ", '".$this->code_guichet."'";
|
$sql.= ", '".$this->db->escape($this->code_guichet)."'";
|
||||||
$sql.= ", '".$this->number."'";
|
$sql.= ", '".$this->db->escape($this->number)."'";
|
||||||
$sql.= ", '".$this->cle_rib."'";
|
$sql.= ", '".$this->db->escape($this->cle_rib)."'";
|
||||||
$sql.= ", '".$this->bic."'";
|
$sql.= ", '".$this->db->escape($this->bic)."'";
|
||||||
$sql.= ", '".$this->iban."'";
|
$sql.= ", '".$this->db->escape($this->iban)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->domiciliation)."'";
|
$sql.= ", '".$this->db->escape($this->domiciliation)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->proprio)."'";
|
$sql.= ", '".$this->db->escape($this->proprio)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->owner_address)."'";
|
$sql.= ", '".$this->db->escape($this->owner_address)."'";
|
||||||
$sql.= ", '".$this->currency_code."'";
|
$sql.= ", '".$this->db->escape($this->currency_code)."'";
|
||||||
$sql.= ", ".$this->rappro;
|
$sql.= ", ".$this->rappro;
|
||||||
$sql.= ", ".price2num($this->min_allowed);
|
$sql.= ", ".price2num($this->min_allowed);
|
||||||
$sql.= ", ".price2num($this->min_desired);
|
$sql.= ", ".price2num($this->min_desired);
|
||||||
$sql.= ", '".$this->db->escape($this->comment)."'";
|
$sql.= ", '".$this->db->escape($this->comment)."'";
|
||||||
$sql.= ", ".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ", ".($this->state_id>0?$this->state_id:"null");
|
||||||
$sql.= ", ".$this->country_id;
|
$sql.= ", ".$this->country_id;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
@ -702,7 +702,7 @@ class Account extends CommonObject
|
|||||||
$sql.= ",courant = ".$this->courant;
|
$sql.= ",courant = ".$this->courant;
|
||||||
$sql.= ",clos = ".$this->clos;
|
$sql.= ",clos = ".$this->clos;
|
||||||
$sql.= ",rappro = ".$this->rappro;
|
$sql.= ",rappro = ".$this->rappro;
|
||||||
$sql.= ",url = ".($this->url?"'".$this->url."'":"null");
|
$sql.= ",url = ".($this->url?"'".$this->db->escape($this->url)."'":"null");
|
||||||
$sql.= ",account_number = '".$this->db->escape($this->account_number)."'";
|
$sql.= ",account_number = '".$this->db->escape($this->account_number)."'";
|
||||||
$sql.= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
|
$sql.= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
|
||||||
$sql.= ",bank = '".$this->db->escape($this->bank)."'";
|
$sql.= ",bank = '".$this->db->escape($this->bank)."'";
|
||||||
@ -722,7 +722,7 @@ class Account extends CommonObject
|
|||||||
$sql.= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
$sql.= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
||||||
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
|
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
|
||||||
|
|
||||||
$sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ",state_id = ".($this->state_id>0?$this->state_id:"null");
|
||||||
$sql.= ",fk_pays = ".$this->country_id;
|
$sql.= ",fk_pays = ".$this->country_id;
|
||||||
|
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
@ -807,7 +807,7 @@ class Account extends CommonObject
|
|||||||
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||||
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
|
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||||
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||||
$sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
|
$sql.= ",state_id = ".($this->state_id>0?$this->state_id:"null");
|
||||||
$sql.= ",fk_pays = ".$this->country_id;
|
$sql.= ",fk_pays = ".$this->country_id;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
@ -1255,6 +1255,7 @@ class Account extends CommonObject
|
|||||||
$label = '<u>' . $langs->trans("ShowAccount") . '</u>';
|
$label = '<u>' . $langs->trans("ShowAccount") . '</u>';
|
||||||
$label .= '<br><b>' . $langs->trans('BankAccount') . ':</b> ' . $this->label;
|
$label .= '<br><b>' . $langs->trans('BankAccount') . ':</b> ' . $this->label;
|
||||||
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
|
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
|
||||||
|
$label .= '<br><b>' . $langs->trans("AccountCurrency") . ':</b> ' . $this->currency_code;
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
@ -1694,9 +1695,9 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", '".$this->db->idate($this->datev)."'";
|
$sql .= ", '".$this->db->idate($this->datev)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql .= ", ".price2num($this->amount);
|
$sql .= ", ".price2num($this->amount);
|
||||||
$sql .= ", ".($this->fk_user_author > 0 ? "'".$this->fk_user_author."'":"null");
|
$sql .= ", ".($this->fk_user_author > 0 ? $this->fk_user_author :"null");
|
||||||
$sql .= ", ".($this->num_chq ? "'".$this->num_chq."'" : "null");
|
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
||||||
$sql .= ", '".$this->fk_account."'";
|
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
||||||
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
|
||||||
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
||||||
|
|||||||
@ -46,7 +46,7 @@ $toselect = GETPOST('toselect', 'array');
|
|||||||
$search_ref=GETPOST('search_ref','alpha');
|
$search_ref=GETPOST('search_ref','alpha');
|
||||||
$search_label=GETPOST('search_label','alpha');
|
$search_label=GETPOST('search_label','alpha');
|
||||||
$search_number=GETPOST('search_number','alpha');
|
$search_number=GETPOST('search_number','alpha');
|
||||||
$statut=GETPOST('statut')?GETPOST('statut', 'alpha'):'opened'; // 'all' or ''='opened'
|
$search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opened'; // 'all' or ''='opened'
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -111,8 +111,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -123,11 +123,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$statut = 'all';
|
|
||||||
$search_ref='';
|
$search_ref='';
|
||||||
$search_label='';
|
$search_label='';
|
||||||
$search_number='';
|
$search_number='';
|
||||||
$search_statut='';
|
$search_status='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -153,8 +152,8 @@ $sql.=$hookmanager->resPrint;
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bankcacount_extrafields as ef on (c.rowid = ef.fk_object)";
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bankcacount_extrafields as ef on (c.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
|
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
|
||||||
if ($statut == 'opened') $sql.= " AND clos = 0";
|
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
||||||
if ($statut == 'closed') $sql.= " AND clos = 1";
|
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
||||||
if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
|
if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
|
||||||
if ($search_label != '') $sql.=natural_search('b.label', $search_label);
|
if ($search_label != '') $sql.=natural_search('b.label', $search_label);
|
||||||
if ($search_number != '') $sql.=natural_search('b.number', $search_number);
|
if ($search_number != '') $sql.=natural_search('b.number', $search_number);
|
||||||
@ -222,7 +221,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
|||||||
if ($search_ref != '') $param.='&search_ref='.$search_ref;
|
if ($search_ref != '') $param.='&search_ref='.$search_ref;
|
||||||
if ($search_label != '') $param.='&search_label='.$search_label;
|
if ($search_label != '') $param.='&search_label='.$search_label;
|
||||||
if ($search_number != '') $param.='&search_number='.$search_number;
|
if ($search_number != '') $param.='&search_number='.$search_number;
|
||||||
if ($statut != '') $param.='&statut='.$statut;
|
if ($search_status != '') $param.='&search_status='.$search_status;
|
||||||
if ($show_files) $param.='&show_files=' .$show_files;
|
if ($show_files) $param.='&show_files=' .$show_files;
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
@ -377,7 +376,7 @@ if (! empty($arrayfields['b.tms']['checked']))
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Statut
|
// Status
|
||||||
if (! empty($arrayfields['b.clos']['checked']))
|
if (! empty($arrayfields['b.clos']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
@ -385,7 +384,7 @@ if (! empty($arrayfields['b.clos']['checked']))
|
|||||||
'opened'=>$langs->trans("Opened"),
|
'opened'=>$langs->trans("Opened"),
|
||||||
'closed'=>$langs->trans("Closed")
|
'closed'=>$langs->trans("Closed")
|
||||||
);
|
);
|
||||||
print $form->selectarray("statut", $array, $statut, 1);
|
print $form->selectarray("search_status", $array, $search_status, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Balance
|
// Balance
|
||||||
@ -584,7 +583,7 @@ foreach ($accounts as $key=>$type)
|
|||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statut
|
// Status
|
||||||
if (! empty($arrayfields['b.clos']['checked']))
|
if (! empty($arrayfields['b.clos']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">'.$acc->getLibStatut(5).'</td>';
|
print '<td align="center">'.$acc->getLibStatut(5).'</td>';
|
||||||
|
|||||||
@ -48,8 +48,8 @@ $action=GETPOST('action','alpha');
|
|||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
$rowid=GETPOST("rowid",'int');
|
$rowid=GETPOST("rowid",'int');
|
||||||
$orig_account=GETPOST("orig_account");
|
$orig_account=GETPOST("orig_account");
|
||||||
$backtopage=GETPOST('backtopage');
|
$backtopage=GETPOST('backtopage','alpha');
|
||||||
$cancel=GETPOST('cancel');
|
$cancel=GETPOST('cancel','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
|
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class Deplacement extends CommonObject
|
|||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", ".$user->id;
|
$sql.= ", ".$user->id;
|
||||||
$sql.= ", ".$this->fk_user;
|
$sql.= ", ".$this->fk_user;
|
||||||
$sql.= ", '".$this->type."'";
|
$sql.= ", '".$this->db->escape($this->type)."'";
|
||||||
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||||
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
|
||||||
$sql.= ", ".($this->fk_project > 0? $this->fk_project : 0);
|
$sql.= ", ".($this->fk_project > 0? $this->fk_project : 0);
|
||||||
|
|||||||
@ -132,7 +132,15 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($cancel) $action='';
|
if ($cancel)
|
||||||
|
{
|
||||||
|
if (! empty($backtopage))
|
||||||
|
{
|
||||||
|
header("Location: ".$backtopage);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$action='';
|
||||||
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
@ -378,7 +386,9 @@ if (empty($reshook))
|
|||||||
|
|
||||||
else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
// POST[remise_id] ou POST[remise_id_for_payment]
|
// POST[remise_id] or POST[remise_id_for_payment]
|
||||||
|
|
||||||
|
// We use the credit to reduce amount of invoice
|
||||||
if (! empty($_POST["remise_id"])) {
|
if (! empty($_POST["remise_id"])) {
|
||||||
$ret = $object->fetch($id);
|
$ret = $object->fetch($id);
|
||||||
if ($ret > 0) {
|
if ($ret > 0) {
|
||||||
@ -390,16 +400,30 @@ if (empty($reshook))
|
|||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! empty($_POST["remise_id_for_payment"])) {
|
// We use the credit to reduce remain to pay
|
||||||
|
if (! empty($_POST["remise_id_for_payment"]))
|
||||||
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||||
$discount = new DiscountAbsolute($db);
|
$discount = new DiscountAbsolute($db);
|
||||||
$discount->fetch($_POST["remise_id_for_payment"]);
|
$discount->fetch($_POST["remise_id_for_payment"]);
|
||||||
|
|
||||||
|
//var_dump($object->getRemainToPay(0));
|
||||||
|
//var_dump($discount->amount_ttc);exit;
|
||||||
|
if ($discount->amount_ttc > $object->getRemainToPay(0))
|
||||||
|
{
|
||||||
|
// TODO Split the discount in 2 automatically
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$result = $discount->link_to_invoice(0, $id);
|
$result = $discount->link_to_invoice(0, $id);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
@ -890,6 +914,11 @@ if (empty($reshook))
|
|||||||
$line->total_localtax1 = -$line->total_localtax1;
|
$line->total_localtax1 = -$line->total_localtax1;
|
||||||
$line->total_localtax2 = -$line->total_localtax2;
|
$line->total_localtax2 = -$line->total_localtax2;
|
||||||
|
|
||||||
|
$line->multicurrency_subprice = -$line->multicurrency_subprice;
|
||||||
|
$line->multicurrency_total_ht = -$line->multicurrency_total_ht;
|
||||||
|
$line->multicurrency_total_tva = -$line->multicurrency_total_tva;
|
||||||
|
$line->multicurrency_total_ttc = -$line->multicurrency_total_ttc;
|
||||||
|
|
||||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||||
|
|
||||||
$object->lines[] = $line; // insert new line in current object
|
$object->lines[] = $line; // insert new line in current object
|
||||||
@ -1299,6 +1328,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now we create same links to contact than the ones found on origin object
|
// Now we create same links to contact than the ones found on origin object
|
||||||
|
/* Useless, already into the create
|
||||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
||||||
{
|
{
|
||||||
$originforcontact = $object->origin;
|
$originforcontact = $object->origin;
|
||||||
@ -1321,7 +1351,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters = array('objFrom' => $srcobject);
|
$parameters = array('objFrom' => $srcobject);
|
||||||
@ -1761,7 +1791,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel'))
|
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
if (! $object->fetch($id) > 0) dol_print_error($db);
|
if (! $object->fetch($id) > 0) dol_print_error($db);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
@ -1956,20 +1986,17 @@ if (empty($reshook))
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions when printing a doc from card
|
||||||
/*
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
* Send mail
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
if (empty($id)) $id=$facid;
|
if (empty($id)) $id=$facid;
|
||||||
$trigger_name='BILL_SENTBYMAIL';
|
$trigger_name='BILL_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfrominvoice';
|
$autocopy='MAIN_MAIL_AUTOCOPY_INVOICE_TO';
|
||||||
$trackid='inv'.$object->id;
|
$trackid='inv'.$object->id;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = $conf->facture->dir_output;
|
$upload_dir = $conf->facture->dir_output;
|
||||||
$permissioncreate=$user->rights->facture->creer;
|
$permissioncreate=$user->rights->facture->creer;
|
||||||
@ -2002,8 +2029,6 @@ if (empty($reshook))
|
|||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
|
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) {
|
||||||
if ($action == 'addcontact') {
|
if ($action == 'addcontact') {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
@ -2255,7 +2280,7 @@ if ($action == 'create')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>' . "\n";
|
print '</tr>' . "\n";
|
||||||
@ -3206,12 +3231,21 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$facthatreplace->fetch($objectidnext);
|
$facthatreplace->fetch($objectidnext);
|
||||||
print ' (' . $langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)) . ')';
|
print ' (' . $langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
|
||||||
|
$discount = new DiscountAbsolute($db);
|
||||||
|
$result = $discount->fetch(0, $object->id);
|
||||||
|
if ($result > 0){
|
||||||
|
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(), $discount->getNomUrl(1, 'discount')).'<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Relative and absolute discounts
|
// Relative and absolute discounts
|
||||||
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
|
||||||
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
|
$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
|
||||||
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
|
$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
|
||||||
|
$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>';
|
||||||
|
|
||||||
print '<!-- Discounts --><tr><td>' . $langs->trans('Discounts');
|
print '<!-- Discounts --><tr><td>' . $langs->trans('Discounts');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -3221,7 +3255,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print $langs->trans("CompanyHasNoRelativeDiscount");
|
print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||||
// print ' ('.$addrelativediscount.')';
|
// print ' ('.$addrelativediscount.')';
|
||||||
|
|
||||||
// Is there commercial discount or down payment available ?
|
// Is there is commercial discount or down payment available ?
|
||||||
if ($absolute_discount > 0) {
|
if ($absolute_discount > 0) {
|
||||||
print '. ';
|
print '. ';
|
||||||
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
|
if ($object->statut > 0 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
|
||||||
@ -3246,7 +3280,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
} else {
|
} else {
|
||||||
if ($absolute_creditnote > 0) // If not, link will be added later
|
if ($absolute_creditnote > 0) // If not, link will be added later
|
||||||
{
|
{
|
||||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||||
print ' (' . $addabsolutediscount . ')<br>';
|
print ' (' . $addabsolutediscount . ')<br>';
|
||||||
else
|
else
|
||||||
print '. ';
|
print '. ';
|
||||||
@ -3257,7 +3291,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
if ($absolute_creditnote > 0)
|
if ($absolute_creditnote > 0)
|
||||||
{
|
{
|
||||||
// If validated, we show link "add credit note to payment"
|
// If validated, we show link "add credit note to payment"
|
||||||
if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE) {
|
if ($object->statut != Facture::STATUS_VALIDATED || $object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||||
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) {
|
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) {
|
||||||
$text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
|
$text = $langs->trans("CompanyHasCreditNote", price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency));
|
||||||
print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
|
print $form->textwithpicto($text, $langs->trans("CreditNoteDepositUse"));
|
||||||
@ -3268,13 +3302,13 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// There is credit notes discounts available
|
// There is credit notes discounts available
|
||||||
if (! $absolute_discount) print '<br>';
|
if (! $absolute_discount) print '<br>';
|
||||||
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
|
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer);
|
||||||
$more=' ('.$addcreditnote.')';
|
$more=' ('.$addcreditnote. (($addcreditnote && $viewabsolutediscount) ? ' - ' : '') . $viewabsolutediscount . ')';
|
||||||
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $absolute_discount && ! $absolute_creditnote) {
|
if (! $absolute_discount && ! $absolute_creditnote) {
|
||||||
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||||
if ($object->statut == 0 && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
if ($object->statut == Facture::STATUS_DRAFT && $object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT)
|
||||||
print ' (' . $addabsolutediscount . ')<br>';
|
print ' (' . $addabsolutediscount . ')<br>';
|
||||||
else
|
else
|
||||||
print '. ';
|
print '. ';
|
||||||
@ -4306,16 +4340,15 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice'));
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
// Link for paypal payment
|
|
||||||
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
|
|
||||||
print showPaypalPaymentUrl('invoice', $object->ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Link for stripe payment
|
// Show online payment link
|
||||||
if (! empty($conf->stripe->enabled) && $object->statut != 0) {
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
include_once DOL_DOCUMENT_ROOT . '/stripe/lib/stripe.lib.php';
|
|
||||||
print showStripePaymentUrl('invoice', $object->ref);
|
if ($object->statut != 0 && $useonlinepayment)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlinePaymentUrl('invoice', $object->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
@ -4323,147 +4356,19 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// List of actions on element
|
// List of actions on element
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||||
$formactions = new FormActions($db);
|
$formactions = new FormActions($db);
|
||||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid);
|
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Action presend (or prerelance)
|
|
||||||
*/
|
|
||||||
|
|
||||||
$object->fetch_projet();
|
|
||||||
|
|
||||||
// By default if $action=='presend'
|
// Presend form
|
||||||
$titreform = 'SendBillByMail';
|
|
||||||
$topicmail = 'SendBillRef';
|
|
||||||
$modelmail='facture_send';
|
$modelmail='facture_send';
|
||||||
|
$defaulttopic='SendBillRef';
|
||||||
|
$diroutput = $conf->facture->dir_output;
|
||||||
|
$trackid = 'inv'.$object->id;
|
||||||
|
|
||||||
if ($action == 'prerelance') // For backward compatibility
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
{
|
|
||||||
$titrefrom = 'SendReminderBillByMail';
|
|
||||||
$topicmail = 'SendReminderBillRef';
|
|
||||||
$modelmail = 'facture_relance';
|
|
||||||
$action = 'relance';
|
|
||||||
} else
|
|
||||||
$action = 'send';
|
|
||||||
|
|
||||||
$ref = dol_sanitizeFileName($object->ref);
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
|
||||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang = '';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
|
||||||
$newlang = $_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
|
|
||||||
if (!empty($newlang))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate('', $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
$outputlangs->load('bills');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file)) {
|
|
||||||
$result = $object->generateDocument(GETPOST('model','alpha') ? GETPOST('model','alpha') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
if ($result <= 0) {
|
|
||||||
dol_print_error($db, $object->error, $object->errors);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
|
|
||||||
$file = $fileparams['fullname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
|
|
||||||
print '<div class="clearboth"></div>';
|
|
||||||
print '<br>';
|
|
||||||
print load_fiche_titre($langs->trans($titreform));
|
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
|
||||||
dol_fiche_head();
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
|
||||||
$formmail->fromtype = (GETPOST('fromtype','alpha')?GETPOST('fromtype','alpha'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
|
||||||
|
|
||||||
if($formmail->fromtype === 'user'){
|
|
||||||
$formmail->fromid = $user->id;
|
|
||||||
|
|
||||||
}
|
|
||||||
$formmail->trackid='inv'.$object->id;
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
|
||||||
{
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
|
||||||
}
|
|
||||||
$formmail->withfrom = 1;
|
|
||||||
$liste = array();
|
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
|
||||||
$liste [$key] = $value;
|
|
||||||
}
|
|
||||||
$formmail->withto = GETPOST('sendto') ? GETPOST('sendto') : $liste; // List suggested for send to
|
|
||||||
$formmail->withtocc = $liste; // List suggested for CC
|
|
||||||
$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
|
|
||||||
if (empty($object->ref_client)) {
|
|
||||||
$formmail->withtopic = $outputlangs->transnoentities($topicmail, '__REF__');
|
|
||||||
} else if (! empty($object->ref_client)) {
|
|
||||||
$formmail->withtopic = $outputlangs->transnoentities($topicmail, '__REF__ (__REFCLIENT__)');
|
|
||||||
}
|
|
||||||
|
|
||||||
$formmail->withfile = 2;
|
|
||||||
$formmail->withbody = 1;
|
|
||||||
$formmail->withdeliveryreceipt = 1;
|
|
||||||
$formmail->withcancel = 1;
|
|
||||||
// Tableau des substitutions
|
|
||||||
$formmail->setSubstitFromObject($object, $outputlangs);
|
|
||||||
$formmail->substit['__INVREF__'] = $object->ref;
|
|
||||||
|
|
||||||
// Find the good contact adress
|
|
||||||
$custcontact = '';
|
|
||||||
$contactarr = array();
|
|
||||||
$contactarr = $object->liste_contact(- 1, 'external');
|
|
||||||
|
|
||||||
if (is_array($contactarr) && count($contactarr) > 0) {
|
|
||||||
foreach ($contactarr as $contact) {
|
|
||||||
if ($contact['libelle'] == $langs->trans('TypeContact_facture_external_BILLING')) { // TODO Use code and not label
|
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
|
||||||
|
|
||||||
$contactstatic = new Contact($db);
|
|
||||||
$contactstatic->fetch($contact ['id']);
|
|
||||||
$custcontact = $contactstatic->getFullName($langs, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($custcontact)) {
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires du post
|
|
||||||
$formmail->param['action'] = $action;
|
|
||||||
$formmail->param['models'] = $modelmail;
|
|
||||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
|
||||||
$formmail->param['facid'] = $object->id;
|
|
||||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
|
||||||
|
|
||||||
// Init list of files
|
|
||||||
if (GETPOST("mode") == 'init') {
|
|
||||||
$formmail->clear_attached_files();
|
|
||||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
|
||||||
}
|
|
||||||
|
|
||||||
print $formmail->get_form();
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe de gestion des factures recurrentes/Modeles
|
* Class to manage invoice templates
|
||||||
*/
|
*/
|
||||||
class FactureRec extends CommonInvoice
|
class FactureRec extends CommonInvoice
|
||||||
{
|
{
|
||||||
@ -59,6 +59,9 @@ class FactureRec extends CommonInvoice
|
|||||||
var $nb_gen_done;
|
var $nb_gen_done;
|
||||||
var $nb_gen_max;
|
var $nb_gen_max;
|
||||||
|
|
||||||
|
var $frequency;
|
||||||
|
var $unit_frequency;
|
||||||
|
|
||||||
var $rang;
|
var $rang;
|
||||||
var $special_code;
|
var $special_code;
|
||||||
|
|
||||||
@ -138,7 +141,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$sql.= ", nb_gen_max";
|
$sql.= ", nb_gen_max";
|
||||||
$sql.= ", auto_validate";
|
$sql.= ", auto_validate";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= "'".$this->titre."'";
|
$sql.= "'".$this->db->escape($this->titre)."'";
|
||||||
$sql.= ", ".$facsrc->socid;
|
$sql.= ", ".$facsrc->socid;
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", '".$this->db->idate($now)."'";
|
$sql.= ", '".$this->db->idate($now)."'";
|
||||||
@ -146,11 +149,11 @@ class FactureRec extends CommonInvoice
|
|||||||
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
|
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
|
||||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||||
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
|
||||||
$sql.= ", '".$user->id."'";
|
$sql.= ", '".$this->db->escape($user->id)."'";
|
||||||
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
|
||||||
$sql.= ", ".(! empty($facsrc->fk_account)?"'".$facsrc->fk_account."'":"null");
|
$sql.= ", ".(! empty($facsrc->fk_account)?"'".$facsrc->fk_account."'":"null");
|
||||||
$sql.= ", '".$facsrc->cond_reglement_id."'";
|
$sql.= ", '".$this->db->escape($facsrc->cond_reglement_id)."'";
|
||||||
$sql.= ", '".$facsrc->mode_reglement_id."'";
|
$sql.= ", '".$this->db->escape($facsrc->mode_reglement_id)."'";
|
||||||
$sql.= ", ".$this->usenewprice;
|
$sql.= ", ".$this->usenewprice;
|
||||||
$sql.= ", ".$this->frequency;
|
$sql.= ", ".$this->frequency;
|
||||||
$sql.= ", '".$this->db->escape($this->unit_frequency)."'";
|
$sql.= ", '".$this->db->escape($this->unit_frequency)."'";
|
||||||
@ -248,7 +251,7 @@ class FactureRec extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
|
function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT f.rowid, f.entity, f.titre, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
$sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
||||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||||
$sql.= ', f.date_lim_reglement as dlr';
|
$sql.= ', f.date_lim_reglement as dlr';
|
||||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||||
@ -281,6 +284,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$this->titre = $obj->titre;
|
$this->titre = $obj->titre;
|
||||||
$this->ref = $obj->titre;
|
$this->ref = $obj->titre;
|
||||||
$this->ref_client = $obj->ref_client;
|
$this->ref_client = $obj->ref_client;
|
||||||
|
$this->suspended = $obj->suspended;
|
||||||
$this->type = $obj->type;
|
$this->type = $obj->type;
|
||||||
$this->datep = $obj->dp;
|
$this->datep = $obj->dp;
|
||||||
$this->date = $obj->df;
|
$this->date = $obj->df;
|
||||||
@ -297,7 +301,6 @@ class FactureRec extends CommonInvoice
|
|||||||
$this->close_code = $obj->close_code;
|
$this->close_code = $obj->close_code;
|
||||||
$this->close_note = $obj->close_note;
|
$this->close_note = $obj->close_note;
|
||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->statut = $obj->fk_statut;
|
|
||||||
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
|
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
|
||||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||||
@ -477,7 +480,7 @@ class FactureRec extends CommonInvoice
|
|||||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger=0, $idwarehouse=-1)
|
function delete(User $user, $notrigger=0, $idwarehouse=-1)
|
||||||
{
|
{
|
||||||
$rowid=$this->id;
|
$rowid=$this->id;
|
||||||
|
|
||||||
@ -579,6 +582,9 @@ class FactureRec extends CommonInvoice
|
|||||||
$txtva = price2num($txtva);
|
$txtva = price2num($txtva);
|
||||||
$txlocaltax1 = price2num($txlocaltax1);
|
$txlocaltax1 = price2num($txlocaltax1);
|
||||||
$txlocaltax2 = price2num($txlocaltax2);
|
$txlocaltax2 = price2num($txlocaltax2);
|
||||||
|
if (empty($txtva)) $txtva=0;
|
||||||
|
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||||
|
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||||
|
|
||||||
if ($price_base_type=='HT')
|
if ($price_base_type=='HT')
|
||||||
{
|
{
|
||||||
@ -709,6 +715,9 @@ class FactureRec extends CommonInvoice
|
|||||||
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
dol_syslog(get_class($this)."::updateline facid=".$facid." rowid=$rowid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva,txlocaltax1=$txlocaltax1,txlocaltax2=$txlocaltax2,fk_product=$fk_product,remise_percent=$remise_percent,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type,fk_unit=$fk_unit", LOG_DEBUG);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (empty($remise_percent)) $remise_percent = 0;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
@ -879,6 +888,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$facture->brouillon = 1;
|
$facture->brouillon = 1;
|
||||||
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
$facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
|
||||||
$facture->socid = $facturerec->socid;
|
$facture->socid = $facturerec->socid;
|
||||||
|
$facture->suspended = 0;
|
||||||
|
|
||||||
$invoiceidgenerated = $facture->create($user);
|
$invoiceidgenerated = $facture->create($user);
|
||||||
if ($invoiceidgenerated <= 0)
|
if ($invoiceidgenerated <= 0)
|
||||||
@ -956,6 +966,95 @@ class FactureRec extends CommonInvoice
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return label of object status
|
||||||
|
*
|
||||||
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
|
||||||
|
* @param integer $alreadypaid Not used
|
||||||
|
* @return string Label
|
||||||
|
*/
|
||||||
|
function getLibStatut($mode=0,$alreadypaid=-1)
|
||||||
|
{
|
||||||
|
return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, $this->type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi le libelle d'un statut donne
|
||||||
|
*
|
||||||
|
* @param int $recur Is it a recurring invoice ?
|
||||||
|
* @param int $status Id status (suspended or not)
|
||||||
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
|
||||||
|
* @param int $alreadypaid Not used
|
||||||
|
* @param int $type Type invoice
|
||||||
|
* @return string Libelle du statut
|
||||||
|
*/
|
||||||
|
function LibStatut($recur,$status,$mode=0,$alreadypaid=-1,$type=0)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load('bills');
|
||||||
|
|
||||||
|
//print "$recur,$status,$mode,$alreadypaid,$type";
|
||||||
|
if ($mode == 0)
|
||||||
|
{
|
||||||
|
$prefix='';
|
||||||
|
if ($recur)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Suspended'); // credit note
|
||||||
|
else return $langs->trans('Active');
|
||||||
|
}
|
||||||
|
else return $langs->trans("Draft");
|
||||||
|
}
|
||||||
|
if ($mode == 1)
|
||||||
|
{
|
||||||
|
$prefix='Short';
|
||||||
|
if ($recur)
|
||||||
|
{
|
||||||
|
if ($status == 1) return $langs->trans('Suspended');
|
||||||
|
else return $langs->trans('Active');
|
||||||
|
}
|
||||||
|
else return $langs->trans("Draft");
|
||||||
|
}
|
||||||
|
if ($mode == 2)
|
||||||
|
{
|
||||||
|
if ($recur)
|
||||||
|
{
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Suspended'),'statut6').' '.$langs->trans('Suspended');
|
||||||
|
else return img_picto($langs->trans('Active'),'statut4').' '.$langs->trans('Active');
|
||||||
|
}
|
||||||
|
else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
|
||||||
|
}
|
||||||
|
if ($mode == 3)
|
||||||
|
{
|
||||||
|
if ($recur)
|
||||||
|
{
|
||||||
|
$prefix='Short';
|
||||||
|
if ($status == 1) return img_picto($langs->trans('Suspended'),'statut6');
|
||||||
|
else return img_picto($langs->trans('Active'),'statut4');
|
||||||
|
}
|
||||||
|
else return img_picto($langs->trans('Draft'),'statut0');
|
||||||
|
}
|
||||||
|
if ($mode == 4)
|
||||||
|
{
|
||||||
|
$prefix='';
|
||||||
|
if ($recur)
|
||||||
|
{
|
||||||
|
if ($type == 1) return img_picto($langs->trans('Suspended'),'statut6').' '.$langs->trans('Suspended');
|
||||||
|
else return img_picto($langs->trans('Active'),'statut4').' '.$langs->trans('Active');
|
||||||
|
}
|
||||||
|
else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft');
|
||||||
|
}
|
||||||
|
if ($mode == 5 || $mode == 6)
|
||||||
|
{
|
||||||
|
$prefix='';
|
||||||
|
if ($mode == 5) $prefix='Short';
|
||||||
|
if ($recur)
|
||||||
|
{
|
||||||
|
if ($status == 1) return '<span class="xhideonsmartphone">'.$langs->trans('Suspended').' </span>'.img_picto($langs->trans('Suspended'),'statut6');
|
||||||
|
else return '<span class="xhideonsmartphone">'.$langs->trans('Active').' </span>'.img_picto($langs->trans('Active'),'statut4');
|
||||||
|
}
|
||||||
|
else return $langs->trans('Draft').' '.img_picto($langs->trans('Active'),'statut0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise an instance with random values.
|
* Initialise an instance with random values.
|
||||||
@ -1259,45 +1358,50 @@ class FactureRec extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
class FactureLigneRec extends CommonInvoiceLine
|
class FactureLigneRec extends CommonInvoiceLine
|
||||||
{
|
{
|
||||||
|
|
||||||
public $element='facturedetrec';
|
public $element='facturedetrec';
|
||||||
public $table_element='facturedet_rec';
|
public $table_element='facturedet_rec';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete line in database
|
* Delete line in database
|
||||||
*
|
*
|
||||||
|
* @param User $user Object user
|
||||||
|
* @param int $notrigger Disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete()
|
function delete(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user;
|
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".($this->rowid > 0 ? $this->rowid : $this->id);
|
if (! $error) {
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
if (! $notrigger) {
|
||||||
if ($this->db->query($sql) )
|
// Call triggers
|
||||||
{
|
|
||||||
// Call trigger
|
|
||||||
$result=$this->call_trigger('LINEBILLREC_DELETE', $user);
|
$result=$this->call_trigger('LINEBILLREC_DELETE', $user);
|
||||||
if ($result < 0)
|
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
|
$res = $this->db->query($sql);
|
||||||
|
if($res===false) {
|
||||||
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
// End call triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error()." sql=".$sql;
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1403,7 +1507,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
$sql.= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
$sql.= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||||
$sql.= ", localtax2_tx=".price2num($this->localtax2_tx);
|
$sql.= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||||
$sql.= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
$sql.= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||||
$sql.= ", fk_product=".(! empty($this->fk_product)?"'".$this->fk_product."'":"null");
|
$sql.= ", fk_product=".($this->fk_product > 0 ? $this->fk_product :"null");
|
||||||
$sql.= ", product_type=".$this->product_type;
|
$sql.= ", product_type=".$this->product_type;
|
||||||
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
$sql.= ", remise_percent='".price2num($this->remise_percent)."'";
|
||||||
$sql.= ", subprice='".price2num($this->subprice)."'";
|
$sql.= ", subprice='".price2num($this->subprice)."'";
|
||||||
|
|||||||
@ -286,6 +286,8 @@ class Facture extends CommonInvoice
|
|||||||
$result=$_facrec->fetch($this->fac_rec);
|
$result=$_facrec->fetch($this->fac_rec);
|
||||||
$result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds
|
$result=$_facrec->fetchObjectLinked(); // This load $_facrec->linkedObjectsIds
|
||||||
|
|
||||||
|
$originaldatewhen = $_facrec->date_when;
|
||||||
|
|
||||||
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
$this->socid = $_facrec->socid; // Invoice created on same thirdparty than template
|
||||||
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
$this->entity = $_facrec->entity; // Invoice created in same entity than template
|
||||||
|
|
||||||
@ -361,8 +363,13 @@ class Facture extends CommonInvoice
|
|||||||
'__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'),
|
'__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'),
|
||||||
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
|
'__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'),
|
||||||
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
'__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'),
|
||||||
|
// Only for tempalte invoice
|
||||||
|
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => dol_print_date($originaldatewhen, 'dayhour'),
|
||||||
|
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => dol_print_date(dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency), 'dayhour')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//var_dump($substitutionarray);exit;
|
||||||
|
|
||||||
$substitutionisok=true;
|
$substitutionisok=true;
|
||||||
complete_substitutions_array($substitutionarray, $outputlangs);
|
complete_substitutions_array($substitutionarray, $outputlangs);
|
||||||
|
|
||||||
@ -432,7 +439,6 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ", ".(double) $this->multicurrency_tx;
|
$sql.= ", ".(double) $this->multicurrency_tx;
|
||||||
$sql.=")";
|
$sql.=")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -442,7 +448,6 @@ class Facture extends CommonInvoice
|
|||||||
$this->ref='(PROV'.$this->id.')';
|
$this->ref='(PROV'.$this->id.')';
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql) $error++;
|
if (! $resql) $error++;
|
||||||
|
|
||||||
@ -491,7 +496,8 @@ class Facture extends CommonInvoice
|
|||||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||||
{
|
{
|
||||||
$originforcontact = 'commande';
|
$originforcontact = 'commande';
|
||||||
$originidforcontact = $value->id;
|
if (is_object($value)) $originidforcontact = $value->id;
|
||||||
|
else $originidforcontact = $value;
|
||||||
break; // We take first one
|
break; // We take first one
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1045,6 +1051,23 @@ class Facture extends CommonInvoice
|
|||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return link to download file from a direct external access
|
||||||
|
*
|
||||||
|
* @param int $withpicto Add download picto into link
|
||||||
|
* @return string HTML link to file
|
||||||
|
*/
|
||||||
|
function getDirectExternalLink($withpicto=0)
|
||||||
|
{
|
||||||
|
// Define $urlwithroot
|
||||||
|
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||||
|
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||||
|
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||||
|
|
||||||
|
$url='eee';
|
||||||
|
return '<a href="'.$urlwithroot.'/document.php?modulepart=invoice&" target="_download" rel="noindex, nofollow">'.$this->ref.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return clicable link of object (with eventually picto)
|
* Return clicable link of object (with eventually picto)
|
||||||
*
|
*
|
||||||
@ -1594,6 +1617,11 @@ class Facture extends CommonInvoice
|
|||||||
$facligne->total_tva = -$remise->amount_tva;
|
$facligne->total_tva = -$remise->amount_tva;
|
||||||
$facligne->total_ttc = -$remise->amount_ttc;
|
$facligne->total_ttc = -$remise->amount_ttc;
|
||||||
|
|
||||||
|
$facligne->multicurrency_subprice = -$remise->multicurrency_subprice;
|
||||||
|
$facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht;
|
||||||
|
$facligne->multicurrency_total_tva = -$remise->multicurrency_total_tva;
|
||||||
|
$facligne->multicurrency_total_ttc = -$remise->multicurrency_total_ttc;
|
||||||
|
|
||||||
$lineid=$facligne->insert();
|
$lineid=$facligne->insert();
|
||||||
if ($lineid > 0)
|
if ($lineid > 0)
|
||||||
{
|
{
|
||||||
@ -3836,6 +3864,9 @@ class Facture extends CommonInvoice
|
|||||||
$line->total_ht=-100;
|
$line->total_ht=-100;
|
||||||
$line->total_ttc=-119.6;
|
$line->total_ttc=-119.6;
|
||||||
$line->total_tva=-19.6;
|
$line->total_tva=-19.6;
|
||||||
|
$line->multicurrency_total_ht=-200;
|
||||||
|
$line->multicurrency_total_ttc=-239.2;
|
||||||
|
$line->multicurrency_total_tva=-39.2;
|
||||||
}
|
}
|
||||||
else if ($xnbp == 2) // UP is negative (free line)
|
else if ($xnbp == 2) // UP is negative (free line)
|
||||||
{
|
{
|
||||||
@ -3844,6 +3875,9 @@ class Facture extends CommonInvoice
|
|||||||
$line->total_ttc=-119.6;
|
$line->total_ttc=-119.6;
|
||||||
$line->total_tva=-19.6;
|
$line->total_tva=-19.6;
|
||||||
$line->remise_percent=0;
|
$line->remise_percent=0;
|
||||||
|
$line->multicurrency_total_ht=-200;
|
||||||
|
$line->multicurrency_total_ttc=-239.2;
|
||||||
|
$line->multicurrency_total_tva=-39.2;
|
||||||
}
|
}
|
||||||
else if ($xnbp == 3) // Discount is 50% (product line)
|
else if ($xnbp == 3) // Discount is 50% (product line)
|
||||||
{
|
{
|
||||||
@ -3852,6 +3886,9 @@ class Facture extends CommonInvoice
|
|||||||
$line->total_ht=50;
|
$line->total_ht=50;
|
||||||
$line->total_ttc=59.8;
|
$line->total_ttc=59.8;
|
||||||
$line->total_tva=9.8;
|
$line->total_tva=9.8;
|
||||||
|
$line->multicurrency_total_ht=100;
|
||||||
|
$line->multicurrency_total_ttc=119.6;
|
||||||
|
$line->multicurrency_total_tva=19.6;
|
||||||
$line->remise_percent=50;
|
$line->remise_percent=50;
|
||||||
}
|
}
|
||||||
else // (product line)
|
else // (product line)
|
||||||
@ -3861,15 +3898,23 @@ class Facture extends CommonInvoice
|
|||||||
$line->total_ht=100;
|
$line->total_ht=100;
|
||||||
$line->total_ttc=119.6;
|
$line->total_ttc=119.6;
|
||||||
$line->total_tva=19.6;
|
$line->total_tva=19.6;
|
||||||
$line->remise_percent=00;
|
$line->multicurrency_total_ht=200;
|
||||||
|
$line->multicurrency_total_ttc=239.2;
|
||||||
|
$line->multicurrency_total_tva=39.2;
|
||||||
|
$line->remise_percent=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lines[$xnbp]=$line;
|
$this->lines[$xnbp]=$line;
|
||||||
|
|
||||||
|
|
||||||
$this->total_ht += $line->total_ht;
|
$this->total_ht += $line->total_ht;
|
||||||
$this->total_tva += $line->total_tva;
|
$this->total_tva += $line->total_tva;
|
||||||
$this->total_ttc += $line->total_ttc;
|
$this->total_ttc += $line->total_ttc;
|
||||||
|
|
||||||
|
$this->multicurrency_total_ht += $line->multicurrency_total_ht;
|
||||||
|
$this->multicurrency_total_tva += $line->multicurrency_total_tva;
|
||||||
|
$this->multicurrency_total_ttc += $line->multicurrency_total_ttc;
|
||||||
|
|
||||||
$xnbp++;
|
$xnbp++;
|
||||||
}
|
}
|
||||||
$this->revenuestamp = 0;
|
$this->revenuestamp = 0;
|
||||||
@ -3886,6 +3931,9 @@ class Facture extends CommonInvoice
|
|||||||
$line->total_ht=0;
|
$line->total_ht=0;
|
||||||
$line->total_ttc=0; // 90 * 1.196
|
$line->total_ttc=0; // 90 * 1.196
|
||||||
$line->total_tva=0;
|
$line->total_tva=0;
|
||||||
|
$line->multicurrency_total_ht=0;
|
||||||
|
$line->multicurrency_total_ttc=0;
|
||||||
|
$line->multicurrency_total_tva=0;
|
||||||
$prodid = mt_rand(1, $num_prods);
|
$prodid = mt_rand(1, $num_prods);
|
||||||
$line->fk_product=$prodids[$prodid];
|
$line->fk_product=$prodids[$prodid];
|
||||||
|
|
||||||
@ -4420,16 +4468,16 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
$sql.= ' fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
$sql.= " VALUES (".$this->fk_facture.",";
|
$sql.= " VALUES (".$this->fk_facture.",";
|
||||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
$sql.= " ".($this->fk_parent_line>0 ? $this->fk_parent_line:"null").",";
|
||||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||||
$sql.= " '".$this->db->escape($this->desc)."',";
|
$sql.= " '".$this->db->escape($this->desc)."',";
|
||||||
$sql.= " ".price2num($this->qty).",";
|
$sql.= " ".price2num($this->qty).",";
|
||||||
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
|
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->db->escape($this->vat_src_code)."'").",";
|
||||||
$sql.= " ".price2num($this->tva_tx).",";
|
$sql.= " ".price2num($this->tva_tx).",";
|
||||||
$sql.= " ".price2num($this->localtax1_tx).",";
|
$sql.= " ".price2num($this->localtax1_tx).",";
|
||||||
$sql.= " ".price2num($this->localtax2_tx).",";
|
$sql.= " ".price2num($this->localtax2_tx).",";
|
||||||
$sql.= " '".$this->localtax1_type."',";
|
$sql.= " '".$this->db->escape($this->localtax1_type)."',";
|
||||||
$sql.= " '".$this->localtax2_type."',";
|
$sql.= " '".$this->db->escape($this->localtax2_type)."',";
|
||||||
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
|
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
|
||||||
$sql.= " ".$this->product_type.",";
|
$sql.= " ".$this->product_type.",";
|
||||||
$sql.= " ".price2num($this->remise_percent).",";
|
$sql.= " ".price2num($this->remise_percent).",";
|
||||||
@ -4442,7 +4490,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
$sql.= ' '.$this->special_code.',';
|
$sql.= ' '.$this->special_code.',';
|
||||||
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
|
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';
|
||||||
$sql.= ' '.price2num($this->pa_ht).',';
|
$sql.= ' '.price2num($this->pa_ht).',';
|
||||||
$sql.= " '".$this->info_bits."',";
|
$sql.= " '".$this->db->escape($this->info_bits)."',";
|
||||||
$sql.= " ".price2num($this->total_ht).",";
|
$sql.= " ".price2num($this->total_ht).",";
|
||||||
$sql.= " ".price2num($this->total_tva).",";
|
$sql.= " ".price2num($this->total_tva).",";
|
||||||
$sql.= " ".price2num($this->total_ttc).",";
|
$sql.= " ".price2num($this->total_ttc).",";
|
||||||
|
|||||||
@ -85,13 +85,11 @@ class PaymentTerm // extends CommonObject
|
|||||||
if (isset($this->decalage)) $this->decalage=trim($this->decalage);
|
if (isset($this->decalage)) $this->decalage=trim($this->decalage);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term(";
|
||||||
|
|
||||||
$sql.= "rowid,";
|
$sql.= "rowid,";
|
||||||
$sql.= "code,";
|
$sql.= "code,";
|
||||||
$sql.= "sortorder,";
|
$sql.= "sortorder,";
|
||||||
@ -101,21 +99,16 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= "type_cdr,";
|
$sql.= "type_cdr,";
|
||||||
$sql.= "nbjour,";
|
$sql.= "nbjour,";
|
||||||
$sql.= "decalage";
|
$sql.= "decalage";
|
||||||
|
|
||||||
|
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
|
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").",";
|
||||||
$sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->rowid."'").",";
|
|
||||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||||
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->sortorder."'").",";
|
$sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").",";
|
||||||
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->active."'").",";
|
$sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").",";
|
||||||
$sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").",";
|
$sql.= " ".(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").",";
|
||||||
$sql.= " ".(! isset($this->libelle_facture)?'NULL':"'".$this->db->escape($this->libelle_facture)."'").",";
|
$sql.= " ".(! isset($this->libelle_facture)?'NULL':"'".$this->db->escape($this->libelle_facture)."'").",";
|
||||||
$sql.= " ".(! isset($this->type_cdr)?'NULL':"'".$this->type_cdr."'").",";
|
$sql.= " ".(! isset($this->type_cdr)?'NULL':"'".$this->db->escape($this->type_cdr)."'").",";
|
||||||
$sql.= " ".(! isset($this->nbjour)?'NULL':"'".$this->nbjour."'").",";
|
$sql.= " ".(! isset($this->nbjour)?'NULL':"'".$this->db->escape($this->nbjour)."'").",";
|
||||||
$sql.= " ".(! isset($this->decalage)?'NULL':"'".$this->decalage."'")."";
|
$sql.= " ".(! isset($this->decalage)?'NULL':"'".$this->db->escape($this->decalage)."'")."";
|
||||||
|
|
||||||
|
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -285,7 +278,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_payment_term SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."c_payment_term SET";
|
||||||
|
|
||||||
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
||||||
$sql.= " sortorder=".(isset($this->sortorder)?$this->sortorder:"null").",";
|
$sql.= " sortorder=".(isset($this->sortorder)?$this->sortorder:"null").",";
|
||||||
$sql.= " active=".(isset($this->active)?$this->active:"null").",";
|
$sql.= " active=".(isset($this->active)?$this->active:"null").",";
|
||||||
@ -294,8 +286,6 @@ class PaymentTerm // extends CommonObject
|
|||||||
$sql.= " type_cdr=".(isset($this->type_cdr)?$this->type_cdr:"null").",";
|
$sql.= " type_cdr=".(isset($this->type_cdr)?$this->type_cdr:"null").",";
|
||||||
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
|
$sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").",";
|
||||||
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
|
$sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null")."";
|
||||||
|
|
||||||
|
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -121,6 +121,7 @@ $arrayfields=array(
|
|||||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
||||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||||
|
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>100),
|
||||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||||
);
|
);
|
||||||
@ -138,8 +139,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters = array('socid' => $socid);
|
$parameters = array('socid' => $socid);
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -147,7 +148,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if (GETPOST('cancel')) $action='';
|
if (GETPOST('cancel','alpha')) $action='';
|
||||||
|
|
||||||
// Selection of new fields
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
@ -299,7 +300,7 @@ if (empty($reshook))
|
|||||||
// Delete
|
// Delete
|
||||||
if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $user->rights->facture->supprimer)
|
if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $user->rights->facture->supprimer)
|
||||||
{
|
{
|
||||||
$object->delete();
|
$object->delete($user);
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] );
|
header("Location: " . $_SERVER['PHP_SELF'] );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -727,7 +728,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel'))
|
elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
if (! $object->fetch($id) > 0) dol_print_error($db);
|
if (! $object->fetch($id) > 0) dol_print_error($db);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
@ -934,6 +935,7 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
|
$invoicerectmp = new FactureRec($db);
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
$tmparray=dol_getdate($now);
|
$tmparray=dol_getdate($now);
|
||||||
@ -993,7 +995,10 @@ if ($action == 'create')
|
|||||||
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')',
|
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')',
|
||||||
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')',
|
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')',
|
||||||
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')',
|
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')',
|
||||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')'
|
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')',
|
||||||
|
// Only on template invoices
|
||||||
|
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')',
|
||||||
|
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')',
|
||||||
);
|
);
|
||||||
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
||||||
|
|
||||||
@ -1117,7 +1122,7 @@ if ($action == 'create')
|
|||||||
$disableedit=1;
|
$disableedit=1;
|
||||||
$disablemove=1;
|
$disablemove=1;
|
||||||
$disableremove=1;
|
$disableremove=1;
|
||||||
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
$ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
@ -1312,7 +1317,10 @@ else
|
|||||||
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')',
|
'__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')',
|
||||||
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')',
|
'__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')',
|
||||||
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')',
|
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')',
|
||||||
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')'
|
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')',
|
||||||
|
// Only on template invoices
|
||||||
|
'__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__' => $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')',
|
||||||
|
'__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__' => $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency),'dayhour').')',
|
||||||
);
|
);
|
||||||
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
$substitutionarray['__(TransKey)__']=$langs->trans("TransKey");
|
||||||
|
|
||||||
@ -1533,7 +1541,7 @@ else
|
|||||||
{
|
{
|
||||||
//$disableedit=1;
|
//$disableedit=1;
|
||||||
//$disablemove=1;
|
//$disablemove=1;
|
||||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
|
$ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
|
||||||
}
|
}
|
||||||
|
|
||||||
// Form to add new line
|
// Form to add new line
|
||||||
@ -1544,7 +1552,7 @@ else
|
|||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
// Add free products/services
|
// Add free products/services
|
||||||
$object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice
|
$object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice
|
||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
@ -1617,7 +1625,7 @@ else
|
|||||||
/*
|
/*
|
||||||
* List mode
|
* List mode
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
|
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
|
||||||
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,";
|
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,";
|
||||||
$sql.= " f.datec, f.tms";
|
$sql.= " f.datec, f.tms";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||||
@ -1625,7 +1633,7 @@ else
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
}
|
}
|
||||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= ' AND f.entity IN ('.getEntity('facture').')';
|
||||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
}
|
}
|
||||||
@ -1837,6 +1845,12 @@ else
|
|||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Status
|
||||||
|
if (! empty($arrayfields['status']['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre" align="middle">';
|
print '<td class="liste_titre" align="middle">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1);
|
$searchpicto=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1);
|
||||||
@ -1855,8 +1869,9 @@ else
|
|||||||
if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'],$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'],$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER['PHP_SELF'],"f.datec","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER['PHP_SELF'],"f.tms","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'],$_SERVER['PHP_SELF'],"","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
@ -1871,6 +1886,11 @@ else
|
|||||||
$companystatic->id=$objp->socid;
|
$companystatic->id=$objp->socid;
|
||||||
$companystatic->name=$objp->name;
|
$companystatic->name=$objp->name;
|
||||||
|
|
||||||
|
$invoicerectmp->id=$objp->id;
|
||||||
|
$invoicerectmp->frequency=$objp->frequency;
|
||||||
|
$invoicerectmp->suspend=$objp->suspend;
|
||||||
|
$invoicerectmp->unit_frequency=$objp->unit_frequency;
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
if (! empty($arrayfields['f.titre']['checked']))
|
if (! empty($arrayfields['f.titre']['checked']))
|
||||||
@ -1928,6 +1948,12 @@ else
|
|||||||
print dol_print_date($db->jdate($objp->tms),'dayhour');
|
print dol_print_date($db->jdate($objp->tms),'dayhour');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['status']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print $invoicerectmp->getLibStatut(3,0);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Action column
|
// Action column
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($user->rights->facture->creer)
|
if ($user->rights->facture->creer)
|
||||||
|
|||||||
@ -110,8 +110,8 @@ if (! $sortfield) $sortfield='f.datef';
|
|||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage context to save list fields
|
||||||
$contextpage='invoicelist';
|
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicelist';
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||||
@ -181,8 +181,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
@ -345,6 +345,7 @@ $formfile = new FormFile($db);
|
|||||||
$bankaccountstatic=new Account($db);
|
$bankaccountstatic=new Account($db);
|
||||||
$facturestatic=new Facture($db);
|
$facturestatic=new Facture($db);
|
||||||
$formcompany=new FormCompany($db);
|
$formcompany=new FormCompany($db);
|
||||||
|
$thirdpartystatic=new Societe($db);
|
||||||
|
|
||||||
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
|
||||||
|
|
||||||
@ -355,7 +356,7 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
|||||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||||
$sql.= ' f.datec as date_creation, f.tms as date_update,';
|
$sql.= ' f.datec as date_creation, f.tms as date_update,';
|
||||||
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
|
||||||
$sql.= " typent.code as typent_code,";
|
$sql.= " typent.code as typent_code,";
|
||||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||||
@ -493,7 +494,7 @@ if (! $sall)
|
|||||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||||
$sql.= ' f.paye, f.fk_statut,';
|
$sql.= ' f.paye, f.fk_statut,';
|
||||||
$sql.= ' f.datec, f.tms,';
|
$sql.= ' f.datec, f.tms,';
|
||||||
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,';
|
$sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code,';
|
||||||
$sql.= ' state.code_departement, state.nom';
|
$sql.= ' state.code_departement, state.nom';
|
||||||
|
|
||||||
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
|
foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
|
||||||
@ -605,106 +606,18 @@ if ($resql)
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
|
||||||
|
|
||||||
if ($massaction == 'presend')
|
if ($massaction == 'presend')
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
|
||||||
|
|
||||||
if (! GETPOST('cancel'))
|
|
||||||
{
|
|
||||||
$objecttmp=new Facture($db);
|
|
||||||
$listofselectedid=array();
|
|
||||||
$listofselectedthirdparties=array();
|
|
||||||
$listofselectedref=array();
|
|
||||||
foreach($arrayofselected as $toselectid)
|
|
||||||
{
|
|
||||||
$result=$objecttmp->fetch($toselectid);
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
$listofselectedid[$toselectid]=$toselectid;
|
|
||||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
|
||||||
$listofselectedthirdparties[$thirdpartyid]=$thirdpartyid;
|
|
||||||
$listofselectedref[$thirdpartyid][$toselectid]=$objecttmp->ref;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
|
|
||||||
dol_fiche_head(null, '', '');
|
|
||||||
|
|
||||||
$topicmail="SendBillRef";
|
$topicmail="SendBillRef";
|
||||||
$modelmail="facture_send";
|
$modelmail="facture_send";
|
||||||
|
$objecttmp=new Facture($db);
|
||||||
|
$trackid='inv'.$object->id;
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
|
||||||
$formmail = new FormMail($db);
|
|
||||||
$formmail->withform=-1;
|
|
||||||
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
|
||||||
|
|
||||||
if($formmail->fromtype === 'user'){
|
|
||||||
$formmail->fromid = $user->id;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
|
||||||
{
|
|
||||||
$formmail->trackid='inv'.$object->id;
|
|
||||||
}
|
|
||||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
|
||||||
{
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
|
|
||||||
}
|
|
||||||
$formmail->withfrom=1;
|
|
||||||
$liste=$langs->trans("AllRecipientSelected");
|
|
||||||
if (count($listofselectedthirdparties) == 1)
|
|
||||||
{
|
|
||||||
$liste=array();
|
|
||||||
$thirdpartyid=array_shift($listofselectedthirdparties);
|
|
||||||
$soc=new Societe($db);
|
|
||||||
$soc->fetch($thirdpartyid);
|
|
||||||
foreach ($soc->thirdparty_and_contact_email_array(1) as $key=>$value)
|
|
||||||
{
|
|
||||||
$liste[$key]=$value;
|
|
||||||
}
|
|
||||||
$formmail->withtoreadonly=0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$formmail->withtoreadonly=1;
|
|
||||||
}
|
|
||||||
$formmail->withto=$liste;
|
|
||||||
$formmail->withtofree=0;
|
|
||||||
$formmail->withtocc=1;
|
|
||||||
$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
|
|
||||||
$formmail->withtopic=$langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__');
|
|
||||||
$formmail->withfile=$langs->trans("OnlyPDFattachmentSupported");
|
|
||||||
$formmail->withbody=1;
|
|
||||||
$formmail->withdeliveryreceipt=1;
|
|
||||||
$formmail->withcancel=1;
|
|
||||||
// Tableau des substitutions
|
|
||||||
$formmail->substit['__REF__']='__REF__'; // We want to keep the tag
|
|
||||||
$formmail->substit['__SIGNATURE__']=$user->signature;
|
|
||||||
$formmail->substit['__REFCLIENT__']='__REFCLIENT__'; // We want to keep the tag
|
|
||||||
$formmail->substit['__PERSONALIZED__']='';
|
|
||||||
$formmail->substit['__CONTACTCIVNAME__']='';
|
|
||||||
|
|
||||||
// Tableau des parametres complementaires du post
|
|
||||||
$formmail->param['action']=$action;
|
|
||||||
$formmail->param['models']=$modelmail;
|
|
||||||
$formmail->param['models_id']=GETPOST('modelmailselected','int');
|
|
||||||
$formmail->param['facid']=join(',',$arrayofselected);
|
|
||||||
// TODO We should use $formmail->param['id']=join(',',$arrayofselected);
|
|
||||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
|
||||||
|
|
||||||
print $formmail->get_form();
|
|
||||||
|
|
||||||
dol_fiche_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
@ -1099,12 +1012,12 @@ if ($resql)
|
|||||||
if (! empty($arrayfields['s.nom']['checked']))
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="tdoverflowmax200">';
|
print '<td class="tdoverflowmax200">';
|
||||||
$thirdparty=new Societe($db);
|
$thirdpartystatic->id=$obj->socid;
|
||||||
$thirdparty->id=$obj->socid;
|
$thirdpartystatic->name=$obj->name;
|
||||||
$thirdparty->name=$obj->name;
|
$thirdpartystatic->client=$obj->client;
|
||||||
$thirdparty->client=$obj->client;
|
$thirdpartystatic->code_client=$obj->code_client;
|
||||||
$thirdparty->code_client=$obj->code_client;
|
$thirdpartystatic->email=$obj->email;
|
||||||
print $thirdparty->getNomUrl(1,'customer');
|
print $thirdpartystatic->getNomUrl(1,'customer');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (! $i) $totalarray['nbfield']++;
|
if (! $i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user