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

This commit is contained in:
Frédéric FRANCE 2018-05-23 17:06:02 +02:00
commit 8547827575
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
230 changed files with 6271 additions and 2112 deletions

View File

@ -20,6 +20,12 @@ source_file = htdocs/langs/en_US/agenda.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.assets]
file_filter = htdocs/langs/<lang>/assets.lang
source_file = htdocs/langs/en_US/assets.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.banks]
file_filter = htdocs/langs/<lang>/banks.lang
source_file = htdocs/langs/en_US/banks.lang

109
ChangeLog
View File

@ -21,8 +21,100 @@ Following changes may create regressions for some external modules, but were nec
* Removed method fetch_prods() and get_each_prod() not used, keep only get_arbo_each_prod() that is better.
* The hook contaxt commcard has been renamed thirdpartycomm
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
* Remove method Categorie:get_nb_categories() that was not used.
***** ChangeLog for 7.0.2 compared to 7.0.1 *****
FIX: #8023
FIX: #8259 can't update contact birthday with REST API
FIX: #8359
FIX: #8389
FIX: #8478 !empty instead of count to avoid warning
FIX: #8488
FIX: #8559 Bug to generate cheque receipt
FIX: #8571
FIX: #8574
FIX: #8580
FIX: #8650
FIX: actioncomm export: type filtering not working
FIX: Add a test to avoid to reset binding by error.
FIX: addline on invoice supplier manage rank on its own if not provided
FIX: Add warning when expense report line not into range
FIX: avoid Error: Call to undefined method mysqli::get_charset()
FIX: avoid focus problem when select2 is in a modal dialog window
FIX: Binding pages must start on fiscal month not calendar month
FIX: button "Classify bill" on supplier order was not visible
FIX: Button receive products not visible
FIX: can bypass the CSRF protection with url with domain inside
FIX: Can't edit option PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY
FIX: commonobject: don't require notnull field if default set
FIX: CommonObject: don't require 'notnull' field if 'default' set
FIX: cron script disabled if module disabled
FIX: CVE-2018-10092
FIX: CVE-2018-10094
FIX: CVE-2018-10095
FIX: CVE-2018-9019
FIX: CWE-89
FIX: Data on income/expense report was always 0
FIX: default addupdatedelete actions: uniformize add/update value checks
FIX: default currency not set on supplier order creation from commercial menu #8459
FIX: delete all product variants of a parent product
FIX: Detail per account not visible when total < 0
FIX: DOL_AUTOSET_COOKIE was not correctly setting value of cookie
FIX: don't print empty date in CommonObject::showOutputField
FIX: dont print empty date in CommonObject::showOutputField
FIX: Draft invoice must be excluded from report
FIX: environment shown on cron card
FIX: Error in ContractLigne not return to Contract
FIX: extrafields price and double were lost during a failed post.
FIX: File name not visible in email preview
FIX: filter/sorting on extrafield on contact list from contact tab
FIX: Initial month on report income/expense per predefined group
FIX: issue #8037
FIX: Issue #8455
FIX: issue #8470
FIX: label in getnomurl projectlist
FIX: limit access of email template page to internal users
FIX: look and feel v7 "back to" for bookkeeping record
FIX: Max nb of generation of recurring invoice should not show warning
FIX: missing english name for object
FIX: Missing include
FIX: missing User object with API REST
FIX: modulebuilder: could not create html fields
FIX: modulebuilder: handle 'price' fieldtype
FIX: multiple creation of same event
FIX: Name of user not visible on journalizing expense report payments
FIX: Not approved holidays must not be visible into timesheet
FIX: Only approved expense report must be journalized
FIX: payment term doc-specific label was not used
FIX: payment term doc-specific label was not used (issue #8414)
FIX: project category is type 6 not 5
FIX: Projet is not prefilled when created from overwiew page
FIX: Related contact printed in societe agenda
FIX: Removed error when no error on accounting setup page
FIX: remove var_dump
FIX: sanitize setup params
FIX: selectForFormsList: entity checked even is object not multi-entity managed
FIX: service creation, right is tested regarding the product type
FIX: some localtaxes errors
FIX: Some report have data when several chart of accounts exists
FIX: sql error using no category
FIX: SQL Injection CWE-89
FIX: Support or multicompany for sheduled jobs
FIX: Test on mandatory status when closing proposal failed
FIX: to allow IRPF not null even if main VAT is null.
FIX: update wrong datetime extrafield
FIX: Use priority to define order of sheduled jobs
FIX: various modulebuilder-related issues
FIX: view of balance before field
FIX: weird password autocompletion in Goocle Chrome (issue #8479)
FIX: weird password autocompletion in Google Chrome (issue #8479)
FIX: When clearing filter, we must not save tmp criterias in session
FIX: With x extrafields, request for multicompany label was done x times
FIX: several XSS
FIX: zip not filtered
***** ChangeLog for 7.0.1 compared to 7.0.0 *****
FIX: #8139 User search does not work if MAIN_USE_OLD_SEARCH_FORM, missing list.php
FIX: #8200
@ -378,7 +470,22 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 6.0.6 compared to 6.0.6 *****
***** ChangeLog for 6.0.7 compared to 6.0.6 *****
FIX: #8023
FIX: #8259 can't update contact birthday with REST API
FIX: #8478 !empty instead of count to avoid warning
FIX: #8488
FIX: actioncomm export: type filtering not working
FIX: addline on invoice supplier manage rank on its own if not provided
FIX: issue #8037
FIX: label in getnomurl projectlist
FIX: payment term doc-specific label was not used
FIX: payment term doc-specific label was not used (issue #8414)
FIX: project category is type 6 not 5 !!
FIX: some localtaxes errors
FIX: weird password autocompletion in Google Chrome (issue #8479)
***** ChangeLog for 6.0.6 compared to 6.0.5 *****
FIX: #7974 Contract - Invalid reference on the document
FIX: #8139
FIX: #8139 User search does not work if MAIN_USE_OLD_SEARCH_FORM, missing list.php

View File

@ -45,7 +45,7 @@ $includeconstants=array();
if (empty($argv[1]))
{
print "Usage: ".$script_file." release=auto|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1;
}
@ -68,30 +68,52 @@ while ($i < $argc)
$i++;
}
if (empty($release))
{
print "Error: Missing release paramater\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
$savrelease = $release;
// If release is auto, we take current version
$tmpver=explode('-', $release, 2);
if ($tmpver[0] == 'auto')
if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable')
{
$release=DOL_VERSION;
if ($tmpver[1]) $release.='-'.$tmpver[1];
if ($tmpver[1] && $tmpver[0] == 'auto') $release.='-'.$tmpver[1];
}
if (empty($includecustom))
{
$tmpver=explode('-', $release, 2);
if (DOL_VERSION != $tmpver[0])
{
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpver[0].')'."\n";
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n";
exit -1;
}
$tmpverbis=explode('-', $release, 2);
if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable')
{
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto')
{
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
}
else
{
$tmpverter=explode('-', DOL_VERSION, 2);
if ($tmpverter[0] != $tmpverbis[0])
{
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
}
}
else
{
if (! preg_match('/'.preg_quote(DOL_VERSION,'/').'-/',$release))
{
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parmater (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n";
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1;
}
}

View File

@ -466,10 +466,12 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
@ -849,6 +851,8 @@ if ($nboftargetok) {
unlink("$NEWDESTI/${FILENAMEDEB}.changes");
print "Remove target ${FILENAMEDEB}.debian.tar.gz...\n";
unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.gz");
print "Remove target ${FILENAMEDEB}.debian.tar.xz...\n";
unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.xz");
print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n";
unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz");
@ -1024,7 +1028,7 @@ if ($nboftargetok) {
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
next;
}
@ -1168,7 +1172,7 @@ if ($nboftargetok) {
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
@ -1181,8 +1185,7 @@ if ($nboftargetok) {
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',

View File

@ -160,6 +160,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -240,6 +240,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -157,6 +157,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -168,6 +168,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asset
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog

View File

@ -90,6 +90,14 @@ var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
vTmpNode.setAttribute('href',vTaskList[i].getLink());
* Replace '% Comp.' to have a smaller text column header
'comp':'% Comp.'
with
'comp':'%'
JCROP:
------

View File

@ -170,9 +170,9 @@ $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent";
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = " . $conf->entity;
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = " . $conf->entity;
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = " . $conf->entity;
$sql .= " WHERE asy.rowid = " . $pcgver;
//print $sql;
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);

View File

@ -617,25 +617,13 @@ if ($id)
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if ($id == 3) unset($fieldlist[2]);
if (empty($reshook))
{
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldListAccountModel($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldListAccountModel($fieldlist,$obj,$tabname[$id],'add');
}
fieldListAccountModel($fieldlist,$obj,$tabname[$id],'add');
}
print '<td colspan="3" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $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").'">';
print '</td>';
print "</tr>";
@ -1134,16 +1122,11 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='')
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
print '<td>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
print $doleditor->Create(1);
}

View File

@ -600,6 +600,7 @@ if ($id)
if (empty($reshook))
{
$langs->load("accountancy");
foreach ($fieldlist as $field => $value)
{
@ -610,10 +611,12 @@ if ($id)
$valuetoshow=$langs->trans('All');
}
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
$langs->loadLangs(array("accountancy"));
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature))?$key:$obj->{$fieldlist[$field]});
}
else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
$valuetoshow=$langs->trans($obj->label);
}
$class='tddict';
// Show value for field

View File

@ -360,9 +360,11 @@ class AccountancyCategory // extends CommonObject
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function display($id) {
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id;
$sql .= " AND t.entity = " . $conf->entity;
$this->lines_display = array();
@ -400,13 +402,14 @@ class AccountancyCategory // extends CommonObject
$sql .= " WHERE t.numero_compte NOT IN (";
$sql .= " SELECT t.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = " . $id . ")";
$sql .= " WHERE t.fk_accounting_category = " . $id . " AND t.entity = " . $conf->entity.")";
$sql .= " AND t.numero_compte IN (";
$sql .= " SELECT DISTINCT aa.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1)";
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = = " . $conf->entity . ")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte";
@ -448,6 +451,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " WHERE (aa.fk_accounting_category != ".$id." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
$sql .= " ORDER BY aa.account_number, aa.label";
@ -492,6 +496,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity;
$this->db->begin();
@ -581,7 +586,7 @@ class AccountancyCategory // extends CommonObject
*/
public function getCatsCpts()
{
global $mysoc;
global $mysoc,$conf;
$sql = "";
@ -595,8 +600,10 @@ class AccountancyCategory // extends CommonObject
$sql .= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity;
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " AND cat.rowid = t.fk_accounting_category";
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY cat.position ASC";
$resql = $this->db->query($sql);
@ -685,7 +692,7 @@ class AccountancyCategory // extends CommonObject
*/
public function getCats($categorytype=-1)
{
global $db, $langs, $user, $mysoc;
global $db, $langs, $user, $mysoc, $conf;
if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
@ -695,6 +702,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 ";
$sql .= " AND c.entity = " . $conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
$sql .= " ORDER BY c.position ASC";

View File

@ -84,7 +84,8 @@ class AccountingAccount extends CommonObject
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, 0 if not found, Id of record if OK and found
*/
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
{
global $conf;
if ($rowid || $account_number) {
@ -96,10 +97,10 @@ class AccountingAccount extends CommonObject
if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'";
} elseif ($account_number) {
$sql .= " a.account_number = '" . $account_number . "'";
$sql .= " a.account_number = '" . $this->db->escape($account_number) . "'";
}
if (! empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
@ -203,7 +204,7 @@ class AccountingAccount extends CommonObject
$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->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
$sql .= ", " . (empty($this->account_category) ? '0' : $this->db->escape($this->account_category));
$sql .= ", " . $user->id;
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
$sql .= ")";
@ -274,7 +275,7 @@ class AccountingAccount extends CommonObject
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
$sql .= " , account_parent = '" . $this->db->escape($this->account_parent) . "'";
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
$sql .= " , fk_accounting_category = '" . $this->db->escape($this->account_category) . "'";
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : $this->db->escape($this->account_category));
$sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = " . $this->active;
$sql .= " WHERE rowid = " . $this->id;

View File

@ -241,7 +241,13 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
} else {
$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>';
// 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
print '<a target="_blank" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.$urlwithroot.'/public/members/new.php'.$entity_qr.'</a>';
}

View File

@ -29,9 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$langs->load("agenda");
$langs->loadLangs(array("admin","other","agenda"));
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
@ -173,8 +171,6 @@ llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";

View File

@ -32,9 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$langs->load("agenda");
$langs->loadLangs(array("admin","other","agenda"));
$def = array();
$actionsave=GETPOST('save','alpha');

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
@ -75,9 +75,9 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
}
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency",'aZ09'),'chaine',0,'',$conf->entity);
@ -157,6 +157,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
}
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE", GETPOST("forme_juridique_code",'nohtml'),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_INFO_SIREN", GETPOST("siren",'nohtml'),'chaine',0,'',$conf->entity);
@ -330,16 +331,16 @@ if ($action == 'edit' || $action == 'updateedit')
// Addresse
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("address",'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_SOCIETE_ADDRESS?$conf->global->MAIN_INFO_SOCIETE_ADDRESS: GETPOST("MAIN_INFO_SOCIETE_ADDRESS",'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("zipcode",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'. ($conf->global->MAIN_INFO_SOCIETE_ZIP?$conf->global->MAIN_INFO_SOCIETE_ZIP: GETPOST("MAIN_INFO_SOCIETE_ZIP",'alpha')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("town",'nohtml')) . '"></td></tr>'."\n";
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'. ($conf->global->MAIN_INFO_SOCIETE_TOWN?$conf->global->MAIN_INFO_SOCIETE_TOWN: GETPOST("MAIN_INFO_SOCIETE_TOWN",'nohtml')) . '"></td></tr>'."\n";
// Country
@ -424,6 +425,13 @@ if ($action == 'edit' || $action == 'updateedit')
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="' . $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '"></td></tr>';
// GDPR contact
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
print '</td><td>';
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="' . $conf->global->MAIN_INFO_GDPR . '"></td></tr>';
// Capital
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
@ -815,6 +823,11 @@ else
print '<tr class="oddeven"><td>'.$langs->trans("ManagingDirectors").'</td><td>';
print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '</td></tr>';
// GDPR Contact
print '<tr class="oddeven"><td>'.$langs->trans("GDPRContact").'</td><td>';
print $conf->global->MAIN_INFO_GDPR . '</td></tr>';
// Capital
print '<tr class="oddeven"><td>'.$langs->trans("Capital").'</td><td>';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,10 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
$langs->load("admin");
$langs->load("sendings");
$langs->load("deliveries");
$langs->load('other');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "sendings", "deliveries", "other"));
if (! $user->admin)
accessforbidden();

View File

@ -6,8 +6,8 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
*
* 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
@ -34,10 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php';
require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';
$langs->load("admin");
$langs->load("sendings");
$langs->load("deliveries");
$langs->load('other');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "sendings", "deliveries", "other"));
if (!$user->admin) accessforbidden();
@ -216,7 +214,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@ -337,7 +334,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/livraison/doc/");
@ -452,7 +448,6 @@ print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=true;
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
@ -460,7 +455,6 @@ $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';

View File

@ -27,8 +27,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$langs->load("admin");
$langs->load("mails");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "mails"));
if (!$user->admin) accessforbidden();
@ -105,29 +105,24 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("MailingEMailFrom").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
if (!empty($conf->global->MAILING_EMAIL_FROM) && ! isValidEmail($conf->global->MAILING_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail"));
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MailingEMailError").'</td><td>';
print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
print '</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("MailingDelay").'</td><td>';
print '<input size="32" type="text" name="MAILING_DELAY" value="'.$conf->global->MAILING_DELAY.'">';

View File

@ -32,9 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("admin");
$langs->load("members");
$langs->load("mailmanspip");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "members", "mailmanspip"));
if (! $user->admin) accessforbidden();
@ -49,7 +48,7 @@ $testunsubscribeemail = GETPOST("testunsubscribeemail");
* Actions
*/
// Action mise a jour ou ajout d'une constante
// Action updated or added a constant
if ($action == 'update' || $action == 'add')
{
foreach($_POST['constname'] as $key => $val)
@ -156,9 +155,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head();
$var=true;
if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

View File

@ -27,12 +27,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load("companies");
$langs->load("products");
$langs->load("admin");
$langs->load("mails");
$langs->load("other");
$langs->load("errors");
// Load traductions files requiredby by page
$langs->loadLangs(array("companies", "products", "admin", "mails", "other", "errors"));
$action=GETPOST('action','alpha');
@ -260,13 +256,11 @@ if ($action == 'edit')
clearstatcache();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1);
print '</td></tr>';
@ -283,11 +277,9 @@ if ($action == 'edit')
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
// SuperAdministrator access only
@ -338,7 +330,6 @@ if ($action == 'edit')
print '</td></tr>';
// Port
print '<tr class="oddeven"><td>';
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
@ -411,7 +402,6 @@ if ($action == 'edit')
}
// TLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
{
@ -469,7 +459,6 @@ if ($action == 'edit')
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_EMAIL_FROM" size="32" value="' . (! empty($conf->global->MAIN_MAIL_EMAIL_FROM)?$conf->global->MAIN_MAIL_EMAIL_FROM:'');
print '"></td></tr>';
@ -497,22 +486,19 @@ if ($action == 'edit')
}
else dol_print_error($db);*/
print '<tr '.$bc[$var?1:0].'><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td><td>';
print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE, 0);
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_ERRORS_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_ERRORS_TO)?$conf->global->MAIN_MAIL_ERRORS_TO:'');
print '"></td></tr>';
// Autocopy to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td><input class="flat" name="MAIN_MAIL_AUTOCOPY_TO" size="32" value="' . (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)?$conf->global->MAIN_MAIL_AUTOCOPY_TO:'');
print '"></td></tr>';
@ -535,15 +521,11 @@ else
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
// Force e-mail recipient
@ -555,11 +537,9 @@ else
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ENABLED_USER_DEST_SELECT").'</td><td>'.yn($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT).'</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
$text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
if (empty($text)) $text=$langs->trans("Undefined").img_warning();
@ -567,7 +547,6 @@ else
print '</td></tr>';
// Host server
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
{
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
@ -578,7 +557,6 @@ else
}
// Port
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
{
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
@ -589,21 +567,18 @@ else
}
// SMTPS ID
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
{
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
}
// SMTPS PW
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
{
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
}
// TLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
{
@ -617,7 +592,6 @@ else
print '</td></tr>';
// STARTTLS
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
{
@ -634,7 +608,6 @@ else
if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer')
{
// DKIM
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer')))
{
@ -664,11 +637,9 @@ else
}
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_EMAIL_FROM;
if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail"));
@ -723,18 +694,15 @@ else
print '</td></tr>';
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Errors To
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_ERRORS_TO").'</td>';
print '<td>'.$conf->global->MAIN_MAIL_ERRORS_TO;
if (! empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
// Autocopy to
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
print '<td>';
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO))

View File

@ -228,7 +228,6 @@ if ($action == 'edit')
clearstatcache();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -341,7 +340,6 @@ if ($action == 'edit')
// PW
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
{
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_PW_EMAILING:'');
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
// SuperAdministrator access only
@ -405,14 +403,10 @@ else
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
$text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
if (empty($text)) $text=$langs->trans("Undefined").img_warning();
@ -422,7 +416,6 @@ else
if (! empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
{
// Host server
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
@ -433,7 +426,6 @@ else
}
// Port
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
@ -444,21 +436,18 @@ else
}
// SMTPS ID
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING.'</td></tr>';
}
// SMTPS PW
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW_EMAILING).'</td></tr>';
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{
@ -472,7 +461,6 @@ else
print '</td></tr>';
// STARTTLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))
{

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
@ -169,10 +169,6 @@ if ($conf->adherent->enabled) $elementList['member']=$langs->trans('Mai
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject');
$elementList['user']=$langs->trans('MailToUser');
sort($elementList);
// Add all and none after the sort
$elementList['all'] ='-- '.$langs->trans("All").' -- ('.$langs->trans('VisibleEverywhere').')';
$elementList['none']='-- '.$langs->trans("None").' -- ('.$langs->trans('VisibleNowhere').')';
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
@ -182,6 +178,12 @@ if ($reshook == 0) {
}
}
// Add all and none after the sort
$elementList['all'] ='-- '.$langs->trans("All").' -- ('.$langs->trans('VisibleEverywhere').')';
$elementList['none']='-- '.$langs->trans("None").' -- ('.$langs->trans('VisibleNowhere').')';
asort($elementList);
$id = 25;
@ -211,7 +213,7 @@ if (empty($reshook))
}
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd') || GETPOST('actionmodify'))
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
{
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
@ -227,7 +229,7 @@ if (empty($reshook))
if ($value == 'content') continue;
if ($value == 'content_lines') continue;
if (GETPOST('actionmodify') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
if (GETPOST('actionmodify','alpha') && $value == 'topic') $_POST['topic']=$_POST['topic-'.$rowid];
if ((! isset($_POST[$value]) || $_POST[$value]=='' || $_POST[$value]=='-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
{
@ -269,8 +271,8 @@ if (empty($reshook))
if ($value == 'fk_user' && ! ($_POST[$keycode] > 0)) $_POST[$keycode]='';
if ($value == 'private' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='0';
if ($value == 'position' && ! is_numeric($_POST[$keycode])) $_POST[$keycode]='1';
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="null";
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
@ -316,12 +318,16 @@ if (empty($reshook))
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$keycode] == '' || ($keycode == 'langcode' && empty($_POST[$keycode]))) $sql.="null"; // For vat, we want/accept code = ''
// print $keycode.' - '.$_POST[$keycode].'<br>';
if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'private' && empty($_POST[$keycode]))) $sql.="null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql.="''"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'private') $sql.=((int) $_POST[$keycode]); // private must be 0 or 1
else $sql.="'".$db->escape($_POST[$keycode])."'";
$i++;
}
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
//print $sql;exit;
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
@ -441,7 +447,6 @@ $fieldlist=explode(',',$tabfield[$id]);
// Form to add a new line
$alabelisused=0;
$var=false;
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -585,9 +590,7 @@ $colspan=count($fieldlist)+1;
print '</table>';
print '</div>';
print '</form>';
print '<br>';
@ -605,7 +608,6 @@ if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;
$param = '&id='.$id;
$paramwithsearch = $param;

View File

@ -163,8 +163,6 @@ if ($action == 'edit')
clearstatcache();
// Gestionnaires de menu
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Menu").'</td>';
print '<td>';
@ -176,7 +174,6 @@ if ($action == 'edit')
print '</tr>';
// Menu top
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMenuManager").'</td>';
print '<td>';
$formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled');
@ -187,7 +184,6 @@ if ($action == 'edit')
print '</tr>';
// Menu smartphone
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMenuSmartphoneManager").'</td>';
print '<td>';
$formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled');
@ -202,8 +198,6 @@ if ($action == 'edit')
else
{
// Gestionnaires de menu
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("Menu").'</td>';
print '<td>';
@ -267,7 +261,6 @@ if ($action == 'edit')
print '</form>';
if ($action != 'edit')
{
print '<div class="tabsAction">';

View File

@ -17,7 +17,7 @@
*/
/**
* \file htdocs/admin/modules.php
* \file htdocs/admin/modulehelp.php
* \brief Page to activate/disable all modules
*/

View File

@ -128,8 +128,6 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -168,7 +166,6 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
print '<tr class="oddeven">';
print '<td>';
$var=true;
$i=0;
foreach($listofnotifiedevents as $notifiedevent)
{
@ -212,7 +209,6 @@ print "</tr>\n";
$notificationtrigger=new InterfaceNotification($db);
$listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
$var=true;
foreach($listofnotifiedevents as $notifiedevent)
{

View File

@ -26,10 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$langs->load("admin");
$langs->load("errors");
$langs->load('other');
$langs->load('bills');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other", "errors", "bills"));
if (! $user->admin) accessforbidden();
@ -131,8 +129,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
@ -249,7 +245,6 @@ print '<td width="80">&nbsp;</td>';
print "</tr>\n";
// Allow payments on different thirdparties bills but same parent company
$var=! $var;
print '<tr class="oddeven"><td>';
print $langs->trans("PaymentOnDifferentThirdBills");
print '</td><td width="60" align="center">';

View File

@ -274,7 +274,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)

View File

@ -33,10 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
$langs->load("admin");
$langs->load("errors");
$langs->load('other');
$langs->load('propal');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other", "errors", "propal"));
if (! $user->admin) accessforbidden();
@ -266,8 +265,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@ -386,7 +383,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
@ -531,7 +527,6 @@ print '</tr>';
print '</form>';
/*
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setusecustomercontactasrecipient">';
@ -631,7 +626,7 @@ print "<tr class=\"liste_titre\">\n";
print " <td>".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Value")."</td>\n";
print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->multidir_output[$conf->entity]."</td>\n</tr>\n";
print "<tr class=\"oddeven\">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->propal->multidir_output[$conf->entity]."</td>\n</tr>\n";
print "</table>\n<br>";

View File

@ -26,10 +26,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("users");
$langs->load("admin");
$langs->load("other");
// Load traductions files requiredby by page
$langs->loadLangs(array("other", "users", "admin"));
if (!$user->admin) accessforbidden();
@ -124,7 +122,6 @@ if ($conf->use_javascript_ajax)
// Timeout
$var=true;
print '<table width="100%" class="noborder">';
@ -163,7 +160,7 @@ print '</td>';
print '</tr>';
print '<tr '.$bcdd[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_HOST").'</td><td align="right">';
print '</td>';
print '<td class="nowrap">';
@ -172,7 +169,7 @@ print '</td>';
print '</tr>';
print '<tr '.$bcdd[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_PORT").'</td><td align="right">';
print '</td>';
print '<td class="nowrap">';
@ -181,7 +178,7 @@ print '</td>';
print '</tr>';
print '<tr '.$bcdd[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_USER").'</td><td align="right">';
print '</td>';
print '<td class="nowrap">';
@ -190,7 +187,7 @@ print '</td>';
print '</tr>';
print '<tr '.$bcdd[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_PROXY_PASS").'</td><td align="right">';
print '</td>';
print '<td class="nowrap">';

View File

@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/receiptprinter.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
$langs->load("admin");
$langs->load("receiptprinter");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin","receiptprinter"));
if (! $user->admin) accessforbidden();
@ -232,7 +232,6 @@ if ($mode == 'config' && $user->admin)
print $langs->trans("ReceiptPrinterDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Type").'</th>';
@ -248,10 +247,11 @@ if ($mode == 'config' && $user->admin)
if ($ret > 0) {
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
for ($line=0; $line < $nbofprinters; $line++) {
$var = !$var;
for ($line=0; $line < $nbofprinters; $line++)
{
print '<tr class="oddeven">';
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) {
if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid)
{
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
@ -329,11 +329,11 @@ if ($mode == 'config' && $user->admin)
print $langs->trans("ReceiptPrinterTypeDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
print '<tr '.$bc[1].'><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<tr '.$bc[1].'><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<tr '.$bc[1].'><td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
@ -342,11 +342,11 @@ if ($mode == 'config' && $user->admin)
dol_fiche_head();
print $langs->trans("ReceiptPrinterProfileDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
print '<tr '.$bc[1].'><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
print '<tr '.$bc[1].'><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
print '<tr '.$bc[0].'><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
print '<tr '.$bc[1].'><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();
}
@ -365,7 +365,6 @@ if ($mode == 'template' && $user->admin)
print $langs->trans("ReceiptPrinterTemplateDesc")."<br><br>\n";
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
print '<th>'.$langs->trans("Template").'</th>';
@ -379,8 +378,8 @@ if ($mode == 'template' && $user->admin)
setEventMessages($printer->error, $printer->errors, 'errors');
} else {
$max = count($printer->listprinterstemplates);
for ($line=0; $line < $max; $line++) {
$var = !$var;
for ($line=0; $line < $max; $line++)
{
print '<tr class="oddeven">';
if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) {
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
@ -419,14 +418,13 @@ if ($mode == 'template' && $user->admin)
print '</form>';
print '<div><p></div>';
print '<table class="noborder" width="100%">'."\n";
$var=true;
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Tag").'</th>';
print '<th>'.$langs->trans("Description").'</th>';
print "</tr>\n";
$max = count($printer->tags);
for ($tag=0; $tag < $max; $tag++) {
$var = !$var;
for ($tag=0; $tag < $max; $tag++)
{
print '<tr class="oddeven">';
print '<td>&lt;'.$printer->tags[$tag].'&gt;</td><td>'.$langs->trans(strtoupper($printer->tags[$tag])).'</td>';
print '</tr>';

View File

@ -30,8 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/resource.lib.php';
if (! empty($conf->resouce->enabled)) require_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php';
$langs->load("admin");
$langs->load("resource");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin","resource"));
// Security check
if (!$user->admin)
@ -76,7 +76,6 @@ print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateoptions">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
@ -85,7 +84,6 @@ print '<td></td>';
// Utilisation formulaire Ajax sur choix produit
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
if (empty($conf->use_javascript_ajax))

View File

@ -29,9 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$action=GETPOST('action','aZ09');
$langs->load("users");
$langs->load("admin");
$langs->load("other");
// Load traductions files requiredby by page
$langs->loadLangs(array("users","admin","other"));
if (!$user->admin) accessforbidden();
@ -127,7 +126,7 @@ if ($action == 'activate_encryptdbpassconf')
if ($result > 0)
{
sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.
// database value not required
//dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1");
header("Location: security.php");
@ -135,7 +134,7 @@ if ($action == 'activate_encryptdbpassconf')
}
else
{
setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings');
setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings');
}
}
else if ($action == 'disable_encryptdbpassconf')
@ -144,7 +143,7 @@ else if ($action == 'disable_encryptdbpassconf')
if ($result > 0)
{
sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.
// database value not required
//dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED",$conf->entity);
header("Location: security.php");
@ -178,10 +177,6 @@ if ($action == 'maj_pattern')
/*
* View
*/
@ -201,9 +196,6 @@ $head=security_prepare_head();
dol_fiche_head($head, 'passwords', $langs->trans("Security"), -1);
$var=false;
// Choix du gestionnaire du generateur de mot de passe
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -233,6 +225,7 @@ if (is_resource($handle))
}
closedir($handle);
}
asort($arrayhandler);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -249,7 +242,6 @@ foreach ($arrayhandler as $key => $module)
if ($module->isEnabled())
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print ucfirst($key);
print "</td><td>\n";
@ -299,42 +291,42 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
print '<td colspan="3"> '.$langs->trans("PasswordPatternDesc").'</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("MinLength")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[0].'" id="minlenght" min="1"></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbMajMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[1].'" id="NbMajMin" min="0"></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbNumMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[2].'" id="NbNumMin" min="0"></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbSpeMin")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[3].'" id="NbSpeMin" min="0"></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("NbIteConsecutive")."</td>";
print '<td colspan="2"><input type="number" value="'.$tabConf[4].'" id="NbIteConsecutive" min="0"></td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td>' . $langs->trans("NoAmbiCaracAutoGeneration")."</td>";
print '<td colspan="2"><input type="checkbox" id="NoAmbiCaracAutoGeneration" '.($tabConf[5] ? "checked" : "").' min="0"> <span id="textcheckbox">'.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'</span></td>';
print '</tr>';
print '</table>';
print '<br>';
@ -394,7 +386,6 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
// Cryptage mot de passe
print '<br>';
$var=true;
print "<form method=\"post\" action=\"" . $_SERVER["PHP_SELF"] . "\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"encrypt\">";

View File

@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("users");
$langs->load("admin");
$langs->load("other");
// Load traductions files requiredby by page
$langs->loadLangs(array("users","admin","other"));
if (! $user->admin)
accessforbidden();
@ -107,8 +106,6 @@ dol_fiche_head($head, 'misc', $langs->trans("Security"), -1);
// Other Options
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Parameters").'</td>';
@ -116,7 +113,6 @@ print '<td align="right" width="100">'.$langs->trans("Status").'</td>';
print '</tr>';
// Enable Captcha code
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
print '<td align="right">';
@ -146,7 +142,6 @@ else
print '</td></tr>';
// Enable advanced perms
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
print '<td align="right">';
@ -174,8 +169,6 @@ print '<br>';
// Timeout
$var=true;
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Parameters").'</td>';

View File

@ -25,12 +25,8 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("companies");
$langs->load("products");
$langs->load("admin");
$langs->load("sms");
$langs->load("other");
$langs->load("errors");
// Load traductions files requiredby by page
$langs->loadLangs(array("companies","admin","products","sms","other","errors"));
if (!$user->admin)
accessforbidden();
@ -169,30 +165,25 @@ if ($action == 'edit')
print '<input type="hidden" name="action" value="update">';
clearstatcache();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_ALL_SMS',$conf->global->MAIN_DISABLE_ALL_SMS,1);
print '</td></tr>';
// Separator
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
if (count($listofmethods)) print $form->selectarray('MAIN_SMS_SENDMODE',$listofmethods,$conf->global->MAIN_SMS_SENDMODE,1);
else print '<font class="error">'.$langs->trans("None").'</font>';
print '</td></tr>';
// From
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'</td>';
print '<td><input class="flat" name="MAIN_MAIL_SMS_FROM" size="32" value="' . $conf->global->MAIN_MAIL_SMS_FROM;
print '"></td></tr>';
@ -216,31 +207,26 @@ if ($action == 'edit')
}
else
{
$var=true;
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a target="_blank" href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
// Disable
// Disable
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_SMS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_SMS).'</td></tr>';
// Separator
// Separator
print '<tr class="oddeven"><td colspan="2">&nbsp;</td></tr>';
// Method
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
$text=$listofmethods[$conf->global->MAIN_SMS_SENDMODE];
if (empty($text)) $text=$langs->trans("Undefined").' '.img_warning();
print $text;
print '</td></tr>';
// From
// From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM;
if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && ! isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) print ' '.img_warning($langs->trans("ErrorBadPhone"));

View File

@ -32,9 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("admin");
$langs->load("members");
$langs->load("mailmanspip");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "members", "mailmanspip"));
if (! $user->admin) accessforbidden();
@ -118,8 +117,6 @@ print load_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'title_setup'
$head = mailmanspip_admin_prepare_head();
$var=true;
/*
* Spip
*/

View File

@ -3,7 +3,7 @@
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -28,8 +28,8 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load("stocks");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "stocks"));
// Securit check
if (!$user->admin) accessforbidden();
@ -162,11 +162,9 @@ print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementDecrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var=true;
$found=0;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DeStockOnBill").'</td>';
print '<td align="right">';
@ -266,11 +264,9 @@ print '<tr class="liste_titre">';
print " <td>".$langs->trans("RuleForStockManagementIncrease")."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var=true;
$found=0;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td align="right">';
@ -362,8 +358,8 @@ print "</td>\n";
print "</tr>\n";
// Option to force stock to be enough before adding a line into document
if($conf->invoice->enabled) {
$var = !$var;
if($conf->invoice->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
print '<td align="right">';
@ -377,8 +373,8 @@ if($conf->invoice->enabled) {
print "</tr>\n";
}
if($conf->order->enabled) {
$var = !$var;
if($conf->order->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td align="right">';
@ -392,8 +388,8 @@ if($conf->order->enabled) {
print "</tr>\n";
}
if($conf->expedition->enabled) {
$var = !$var;
if($conf->expedition->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td align="right">';
@ -408,7 +404,6 @@ if($conf->expedition->enabled) {
}
print '</table>';
print '<br>';
$virtualdiffersfromphysical=0;
@ -423,7 +418,7 @@ if ($virtualdiffersfromphysical)
print " <td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help',$langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
print " <td align=\"right\" width=\"160\">&nbsp;</td>\n";
print '</tr>'."\n";
$var = !$var;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
print '<td align="right">';

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,9 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$langs->load("admin");
$langs->load("other");
$langs->load("orders");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other", "orders"));
if (!$user->admin)
accessforbidden();
@ -233,7 +232,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,9 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$langs->load("admin");
$langs->load("other");
$langs->load("orders");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "other", "orders"));
if (!$user->admin)
accessforbidden();
@ -262,7 +261,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{

View File

@ -27,12 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
$langs->load("admin");
$langs->load("errors");
$langs->load('other');
$langs->load('bills');
$langs->load('orders');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "errors", "other", "bills", "orders"));
if (! $user->admin) accessforbidden();
@ -217,7 +213,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
@ -249,7 +244,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled())
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
echo preg_replace('/\-.*$/','',preg_replace('/mod_supplier_payment_/','',preg_replace('/\.php$/','',$file)));
print "</td><td>\n";
@ -360,7 +354,6 @@ foreach ($dirmodels as $reldir)
require_once $dir.'/'.$file;
$module = new $classname($db, new PaiementFourn($db));
print "<tr class=\"oddeven\">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);

View File

@ -28,10 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/supplier_proposal.lib.php';
$langs->load("admin");
$langs->load("errors");
$langs->load('other');
$langs->load('supplier_proposal');
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "errors", "other", "supplier_proposal"));
if (! $user->admin) accessforbidden();
@ -247,7 +246,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{
@ -366,7 +364,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
@ -403,7 +400,6 @@ foreach ($dirmodels as $reldir)
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
@ -492,7 +488,6 @@ print '<br>';
*/
print load_fiche_titre($langs->trans("OtherOptions"),'','');
$var=true;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n";
@ -506,7 +501,6 @@ $htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
@ -585,7 +579,7 @@ print "<tr class=\"liste_titre\">\n";
print " <td>".$langs->trans("Name")."</td>\n";
print " <td>".$langs->trans("Value")."</td>\n";
print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->supplier_proposal->dir_output."</td>\n</tr>\n";
print "<tr class=\"oddeven\">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->supplier_proposal->dir_output."</td>\n</tr>\n";
print "</table>\n<br>";
llxFooter();

View File

@ -279,7 +279,6 @@ print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
print '<td align="right"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=true;
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogLevel").'</td>';
print '<td colspan="2"><select class="flat" name="level" '.$option.'>';

View File

@ -75,7 +75,7 @@ print '<br>';
$file_list = array('missing' => array(), 'updated' => array());
// Local file to compare to
$xmlshortfile = GETPOST('xmlshortfile')?GETPOST('xmlshortfile'):'/install/filelist-'.DOL_VERSION.'.xml';
$xmlshortfile = GETPOST('xmlshortfile','alpha')?GETPOST('xmlshortfile','alpha'):'/install/filelist-'.DOL_VERSION.(empty($conf->global->MAIN_FILECHECK_LOCAL_SUFFIX)?'':$conf->global->MAIN_FILECHECK_LOCAL_SUFFIX).'.xml';
$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
// Remote file to compare to
$xmlremote = GETPOST('xmlremote');

View File

@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("admin");
$langs->load("members");
$langs->load("users");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "members", "users"));
if (! $user->admin) accessforbidden();
$extrafields = new ExtraFields($db);
@ -165,7 +165,6 @@ print "</tr>\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
@ -202,7 +201,6 @@ foreach ($dirmodels as $reldir)
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";

View File

@ -78,8 +78,9 @@ class Asset extends CommonObject
'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
'amount' => array('type'=>'double(24,8)', 'label'=>'Amount', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),
@ -214,7 +215,7 @@ class Asset extends CommonObject
public function fetch($id, $ref = null)
{
$result = $this->fetchCommon($id, $ref);
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
//if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
return $result;
}

View File

@ -73,14 +73,23 @@ class AssetType extends CommonObject
$error=0;
$this->label=trim($this->label);
$this->accountancy_code_asset = trim($this->accountancy_code_asset);
$this->accountancy_code_depreciation_asset = trim($this->accountancy_code_depreciation_asset);
$this->accountancy_code_depreciation_expense = trim($this->accountancy_code_depreciation_expense);
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_type (";
$sql.= "label";
$sql.= ", accountancy_code_asset";
$sql.= ", accountancy_code_depreciation_asset";
$sql.= ", accountancy_code_depreciation_expense";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= "'".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code_asset)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
$sql.= ", ".$conf->entity;
$sql.= ")";
@ -411,4 +420,14 @@ class AssetType extends CommonObject
);
}
/**
* getLibStatut
*
* @return string Return status of a type of asset
*/
function getLibStatut()
{
return '';
}
}

View File

@ -26,6 +26,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
require_once DOL_DOCUMENT_ROOT.'/asset/class/asset_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
$langs->load("assets");
@ -232,8 +235,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>';
print '<th align="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th align="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th align="center">'.$langs->trans("AccountancyCodeAsset").'</th>';
print '<th align="center">'.$langs->trans("AccountancyCodeDepreciationAsset").'</th>';
print '<th align="center">'.$langs->trans("AccountancyCodeDepreciationExpense").'</th>';
print '<th>&nbsp;</th>';
print "</tr>\n";
@ -253,9 +257,44 @@ if (! $rowid && $action != 'create' && $action != 'edit')
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td align="center">'.yn($objp->subscription).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
if ($user->rights->asset->configurer)
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->accountancy_code_asset,1);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount2 = new AccountingAccount($db);
$accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1);
print $accountingaccount2->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount3 = new AccountingAccount($db);
$accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1);
print $accountingaccount3->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_expense;
}
print '</td>';
if ($user->rights->asset->write)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
else
print '<td align="right">&nbsp;</td>';
@ -282,8 +321,9 @@ if (! $rowid && $action != 'create' && $action != 'edit')
if ($action == 'create')
{
$object = new AssetType($db);
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
print load_fiche_titre($langs->trans("NewMemberType"));
print load_fiche_titre($langs->trans("NewAssetType"));
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -296,23 +336,48 @@ if ($action == 'create')
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription",1,1);
print '</td></tr>';
if (! empty($conf->accounting->enabled))
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote",0,1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
print '</td></tr>';
}
else // For external software
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
print '</td></tr>';
}
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
$doleditor->Create();
print '</td></tr>';
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
@ -356,9 +421,9 @@ if ($rowid > 0)
print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$object->id,$langs->trans("DeleteAMemberType"),$langs->trans("ConfirmDeleteMemberType",$object->label),"confirm_delete", '',0,1);
}
$head = member_type_prepare_head($object);
$head = asset_type_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
dol_fiche_head($head, 'card', $langs->trans("AssetType"), -1, 'setup');
$linkback = '<a href="'.DOL_URL_ROOT.'/asset/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
@ -369,20 +434,45 @@ if ($rowid > 0)
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($object->subscription);
print '</tr>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->accountancy_code_asset,1);
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($object->vote);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount2 = new AccountingAccount($db);
$accountingaccount2->fetch('',$object->accountancy_code_depreciation_asset,1);
print $accountingaccount2->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_asset;
}
print '</td>';
print '<td>';
if (! empty($conf->accounting->enabled))
{
$accountingaccount3 = new AccountingAccount($db);
$accountingaccount3->fetch('',$object->accountancy_code_depreciation_expense,1);
print $accountingaccount3->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code_depreciation_expense;
}
print '</tr>';
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($object->note)."</td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
print nl2br($object->mail_valid)."</td></tr>";
// Other attributes
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@ -398,7 +488,7 @@ if ($rowid > 0)
print '<div class="tabsAction">';
// Edit
if ($user->rights->asset->configurer)
if ($user->rights->asset->write)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
}
@ -407,7 +497,7 @@ if ($rowid > 0)
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
// Delete
if ($user->rights->asset->configurer)
if ($user->rights->asset->write)
{
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
}
@ -415,8 +505,7 @@ if ($rowid > 0)
print "</div>";
// Show list of members (nearly same code than in page list.php)
// Show list of assets (nearly same code than in page list.php)
$assettypestatic=new AssetType($db);
$now=dol_now();
@ -426,7 +515,7 @@ if ($rowid > 0)
$sql.= " a.fk_asset_type as type_id,";
$sql.= " t.label as type";
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a, ".MAIN_DB_PREFIX."asset_type as t";
$sql.= " WHERE a.fk_asset_type = t.rowid ";
$sql.= " WHERE a.fk_asset_type = t.rowid";
$sql.= " AND a.entity IN (".getEntity('asset').")";
$sql.= " AND t.rowid = ".$object->id;
if ($sall)
@ -441,8 +530,8 @@ if ($rowid > 0)
{
if (GETPOST('search','alpha'))
{
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
}
$sql.= natural_search(array("d.firstname","d.lastname"), GETPOST('search','alpha'));
}
}
if (! empty($search_lastname))
{
@ -612,35 +701,6 @@ if ($rowid > 0)
print $adh->LibStatut($objp->statut,$objp->subscription,$datefin,2);
print "</td>";
// Date end subscription
if ($datefin)
{
print '<td align="center" class="nowrap">';
if ($datefin < dol_now() && $objp->statut > 0)
{
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
}
else
{
print dol_print_date($datefin,'day');
}
print '</td>';
}
else
{
print '<td align="left" class="nowrap">';
if ($objp->subscription == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
}
// Actions
print '<td align="center">';
if ($user->rights->asset->creer)
@ -685,15 +745,16 @@ if ($rowid > 0)
$object = new AssetType($db);
$object->fetch($rowid);
$object->fetch_optionals();
if (! empty($conf->accounting->enabled)) $formaccounting = new FormAccounting($db);
$head = member_type_prepare_head($object);
$head = asset_type_prepare_head($object);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
dol_fiche_head($head, 'card', $langs->trans("AssetsType"), -1, 'setup');
print '<table class="border" width="100%">';
@ -701,23 +762,48 @@ if ($rowid > 0)
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription",$object->subscription,1);
print '</td></tr>';
if (! empty($conf->accounting->enabled))
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_asset, 'accountancy_code_asset', 1, '', 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote",$object->vote,1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_asset, 'accountancy_code_depreciation_asset', 1, '', 1, 1);
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td>';
print $formaccounting->select_account($object->accountancy_code_depreciation_expense, 'accountancy_code_depreciation_expense', 1, '', 1, 1);
print '</td></tr>';
}
else // For external software
{
// Accountancy_code_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeAsset").'</td>';
print '<td><input name="accountancy_code_asset" class="maxwidth200" value="'.$object->accountancy_code_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_asset
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationAsset").'</td>';
print '<td><input name="accountancy_code_depreciation_asset" class="maxwidth200" value="'.$object->accountancy_code_depreciation_asset.'">';
print '</td></tr>';
// Accountancy_code_depreciation_expense
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCodeDepreciationExpense").'</td>';
print '<td><input name="accountancy_code_depreciation_expense" class="maxwidth200" value="'.$object->accountancy_code_depreciation_expense.'">';
print '</td></tr>';
}
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,'90%');
$doleditor->Create();
print "</td></tr>";
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook

View File

@ -68,8 +68,6 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setvalue">';
$var=true;
print '<table summary="bookmarklist" class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';

View File

@ -38,8 +38,8 @@ if (! empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id']))
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("cashdesk");
// Load traductions files requiredby by page
$langs->loadLangs(array("admin", "cashdesk"));
/*
@ -91,7 +91,6 @@ print '<br>';
// Mode
$var=true;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set">';
@ -162,7 +161,6 @@ if (! empty($conf->stock->enabled))
if (! empty($conf->service->enabled))
{
$var=! $var;
print '<tr class="oddeven"><td>';
print $langs->trans("CashdeskShowServices");
print '<td colspan="2">';
@ -173,7 +171,6 @@ if (! empty($conf->service->enabled))
// Use Dolibarr Receipt Printer
if (! empty($conf->receiptprinter->enabled))
{
$var=! $var;
print '<tr class="oddeven"><td>';
print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')';
print '<td colspan="2">';

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -150,7 +151,8 @@ switch($action)
$obj_facturation->id($ret['rowid']);
$obj_facturation->ref($ret['ref']);
$obj_facturation->stock($ret['reel']);
$obj_facturation->prix($ret['price']);
//$obj_facturation->prix($ret['price']);
$obj_facturation->prix($pu_ht);
$vatrate = $tva_tx;

View File

@ -93,7 +93,6 @@ print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';
$var=true;
$form = new Form($db);
// Mail required for members

View File

@ -761,11 +761,9 @@ class Categorie extends CommonObject
dol_syslog(get_class($this).'::del_type', LOG_DEBUG);
if ($this->db->query($sql))
{
// Save object we want to unlink category off into category instance to provide information to trigger
$this->unlinkoff=$obj;
// Call trigger
$result=$this->call_trigger('CATEGORY_UNLINK',$user);
$this->context=array('unlinkoff'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
$result=$this->call_trigger('CATEGORY_UNLINK',$user);
if ($result < 0) { $error++; }
// End call triggers
@ -897,6 +895,7 @@ class Categorie extends CommonObject
$sql.= $this->db->order($sortfield, $sortorder);
$offset = 0;
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
@ -1207,30 +1206,6 @@ class Categorie extends CommonObject
}
}
/**
* Returns total number of categories
*
* @return int Number of categories
* @deprecated function not used ?
*/
function get_nb_categories()
{
$sql = "SELECT count(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
$sql.= " WHERE entity IN (".getEntity('category').")";
$res = $this->db->query($sql);
if ($res)
{
$res = $this->db->fetch_array($res);
return $res[0];
}
else
{
dol_print_error($this->db);
return -1;
}
}
/**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type
*

View File

@ -82,7 +82,7 @@ print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>';
print '<tr '.$bc[0].'><td>';
print '<tr class="oddeven"><td>';
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
/*
// faire une rech dans une sous categorie uniquement
@ -111,7 +111,6 @@ if ($catname || $id > 0)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
$var=true;
foreach ($cats as $cat)
{
print "\t".'<tr class="oddeven">'."\n";

View File

@ -42,12 +42,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("commercial");
$langs->load("other");
$langs->load("bills");
$langs->load("orders");
$langs->load("agenda");
// Load traductions files requiredby by page
$langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda"));
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel','alpha');
@ -1291,7 +1287,7 @@ if ($id > 0)
}
$linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"');
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php">'.$langs->trans("BackToList").'</a>';
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
// Link to other agenda views
$out='';
@ -1603,7 +1599,6 @@ if ($id > 0)
$genallowed=$user->rights->agenda->myactions->read;
$delallowed=$user->rights->agenda->myactions->create;
$var=true;
print $formfile->showdocuments('agenda',$object->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,0,0,'','','',$object->default_lang);

View File

@ -281,6 +281,7 @@ class ActionComm extends CommonObject
return -1;
}
}
$code = empty($this->code)?$this->type_code:$this->code;
// Check parameters
if (! $this->type_id)
@ -316,7 +317,7 @@ class ActionComm extends CommonObject
$sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").", ";
$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_code)?" '".$this->db->escape($this->type_code)."'":"null").", ";
$sql.= ($code?("'".$code."'"):"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.= " '".$this->db->escape($this->note)."', ";
@ -1202,15 +1203,16 @@ class ActionComm extends CommonObject
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option ''=Link to action, 'birthday'=Link to contact
* @param int $overwritepicto 1=Overwrite picto
* @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0, $notooltip=0)
function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overwritepicto=0, $notooltip=0, $save_lastsearch_value=-1)
{
global $conf, $langs, $user, $hookmanager, $action;
@ -1274,6 +1276,13 @@ class ActionComm extends CommonObject
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
else
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';

View File

@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php';
$langs->load("agenda");
$langs->load("commercial");
// Load traductions files requiredby by page
$langs->loadLangs(array("agenda", "commercial"));
$action=GETPOST('action','alpha');
$month=GETPOST('month');
@ -138,7 +138,6 @@ if ($resql)
print '<td align="center">'.$langs->trans("Size").'</td>';
print "</tr>\n";
$var=true;
while ($i < min($num,$limit))
{
$obj=$db->fetch_object($resql);

View File

@ -349,7 +349,12 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
}
else {
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
}
$i++;
$total += $obj->total_ttc;
}
@ -432,7 +437,12 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'supplier',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
}
else {
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
}
$i++;
$total += $obj->total_ttc;
}
@ -744,7 +754,12 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right">'.price($obj->total_ht).'</td>';
}
else {
print '<td align="right">'.price($obj->total_ttc).'</td>';
}
print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
print '</tr>'."\n";
$i++;
@ -843,7 +858,12 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '</td>';
print '<td align="right">';
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
print '<td align="right">'.price($obj->total_ttc).'</td>';
if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
print '<td align="right">'.price($obj->total_ht).'</td>';
}
else {
print '<td align="right">'.price($obj->total_ttc).'</td>';
}
print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut,$obj->billed,3).'</td>'."\n";
print '</tr>'."\n";
$i++;

View File

@ -244,7 +244,7 @@ if (empty($reshook))
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__']=dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
}
}
/* For backward compatibility */
/* For backward compatibility, deprecated */
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);

View File

@ -2299,7 +2299,7 @@ if ($action == 'create')
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
// Form to add new line
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer)
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer && $action != 'selectlines')
{
if ($action != 'editline')
{

View File

@ -3081,21 +3081,23 @@ class Propal extends CommonObject
*/
function LibStatut($statut,$mode=1)
{
global $conf;
// Init/load array of translation of status
if (empty($this->labelstatut) || empty($this->labelstatut_short))
{
global $langs;
$langs->load("propal");
$this->labelstatut[0]=(! empty($conf->global->PROPAL_STATUS_DRAFT_LABEL) ? $conf->global->PROPAL_STATUS_DRAFT_LABEL : $langs->trans("PropalStatusDraft"));
$this->labelstatut[1]=(! empty($conf->global->PROPAL_STATUS_VALIDATED_LABEL) ? $conf->global->PROPAL_STATUS_VALIDATED_LABEL : $langs->trans("PropalStatusValidated"));
$this->labelstatut[2]=(! empty($conf->global->PROPAL_STATUS_SIGNED_LABEL) ? $conf->global->PROPAL_STATUS_SIGNED_LABEL : $langs->trans("PropalStatusSigned"));
$this->labelstatut[3]=(! empty($conf->global->PROPAL_STATUS_NOTSIGNED_LABEL) ? $conf->global->PROPAL_STATUS_NOTSIGNED_LABEL : $langs->trans("PropalStatusNotSigned"));
$this->labelstatut[4]=(! empty($conf->global->PROPAL_STATUS_BILLED_LABEL) ? $conf->global->PROPAL_STATUS_BILLED_LABEL : $langs->trans("PropalStatusBilled"));
$this->labelstatut_short[0]=(! empty($conf->global->PROPAL_STATUS_DRAFTSHORT_LABEL) ? $conf->global->PROPAL_STATUS_DRAFTSHORT_LABEL : $langs->trans("PropalStatusDraftShort"));
$this->labelstatut_short[1]=(! empty($conf->global->PROPAL_STATUS_VALIDATEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_VALIDATEDSHORT_LABEL : $langs->trans("Opened"));
$this->labelstatut_short[2]=(! empty($conf->global->PROPAL_STATUS_SIGNEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_SIGNEDSHORT_LABEL : $langs->trans("PropalStatusSignedShort"));
$this->labelstatut_short[3]=(! empty($conf->global->PROPAL_STATUS_NOTSIGNEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_NOTSIGNEDSHORT_LABEL : $langs->trans("PropalStatusNotSignedShort"));
$this->labelstatut_short[4]=(! empty($conf->global->PROPAL_STATUS_BILLEDSHORT_LABEL) ? $conf->global->PROPAL_STATUS_BILLEDSHORT_LABEL : $langs->trans("PropalStatusBilledShort"));
$this->labelstatut[0]=$langs->trans("PropalStatusDraft");
$this->labelstatut[1]=$langs->trans("PropalStatusValidated");
$this->labelstatut[2]=$langs->trans("PropalStatusSigned");
$this->labelstatut[3]=$langs->trans("PropalStatusNotSigned");
$this->labelstatut[4]=$langs->trans("PropalStatusBilled");
$this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort");
$this->labelstatut_short[1]=$langs->trans("Opened");
$this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort");
$this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort");
$this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort");
}
$statuttrans='';

View File

@ -10,7 +10,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->loadLangs(array('companies','propal','compta','bills','orders','products'));
$langs->loadLangs(array('companies','propal','compta','bills','orders','products','deliveries'));
$socid=GETPOST('socid','int');
@ -76,6 +76,14 @@ $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");
$search_dayfin=GETPOST("search_dayfin","int");
$search_monthfin=GETPOST("search_monthfin","int");
$search_yearfin=GETPOST("search_yearfin","int");
$search_daydelivery=GETPOST("search_daydelivery","int");
$search_monthdelivery=GETPOST("search_monthdelivery","int");
$search_yeardelivery=GETPOST("search_yeardelivery","int");
$search_availability=GETPOST('search_availability','int');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha');
@ -144,6 +152,8 @@ $arrayfields=array(
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'p.fin_validite'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1),
'p.date_livraison'=>array('label'=>$langs->trans("DeliveryDate"), 'checked'=>0),
'ava.rowid'=>array('label'=>$langs->trans("AvailabilityPeriod"), 'checked'=>0),
'p.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1),
'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
@ -201,10 +211,19 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_year='';
$search_month='';
$search_day='';
$search_yearfin='';
$search_monthfin='';
$search_dayfin='';
$search_yeardelivery='';
$search_monthdelivery='';
$search_daydelivery='';
$search_availability='';
$viewstatut='';
$object_statut='';
$toselect='';
$search_array_options=array();
$search_categ_cus=0;
}
if ($object_statut != '') $viewstatut=$object_statut;
@ -242,12 +261,15 @@ $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$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.= " ava.rowid as availability,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
$sql.= ' p.rowid, p.entity, 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.entity, 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,p.date_livraison as ddelivery,';
$sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref,";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= ' u.login';
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -258,12 +280,15 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
$sql.= ', '.MAIN_DB_PREFIX.'propal as p';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields as ef on (p.rowid = ef.fk_object)";
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
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.'user as u ON p.fk_user_author = u.rowid';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
// 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_user > 0)
@ -285,6 +310,7 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refprojet);
if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_login) $sql .= natural_search("u.login", $search_login);
@ -294,6 +320,9 @@ if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_
if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category);
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if ($viewstatut != '' && $viewstatut != '-1')
@ -313,6 +342,32 @@ else if ($search_year > 0)
{
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
}
if ($search_monthfin > 0)
{
if ($search_yearfin > 0 && empty($search_dayfin))
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_monthfin,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_monthfin,false))."'";
else if ($search_yearfin > 0 && ! empty($search_dayfin))
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_monthfin, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_monthfin, $search_dayfin, $search_yearfin))."'";
else
$sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_monthfin)."'";
}
else if ($search_yearfin > 0)
{
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,1,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,12,false))."'";
}
if ($search_monthdelivery > 0)
{
if ($search_yeardelivery > 0 && empty($search_daydelivery))
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_yeardelivery,$search_monthdelivery,false))."' AND '".$db->idate(dol_get_last_day($search_yeardelivery,$search_monthdelivery,false))."'";
else if ($search_yeardelivery > 0 && ! empty($search_daydelivery))
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_monthdelivery, $search_daydelivery, $search_yeardelivery))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_monthdelivery, $search_daydelivery, $search_yeardelivery))."'";
else
$sql.= " AND date_format(p.date_livraison, '%m') = '".$db->escape($search_monthdelivery)."'";
}
else if ($search_yeardelivery > 0)
{
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($search_yeardelivery,1,false))."' AND '".$db->idate(dol_get_last_day($search_yeardelivery,12,false))."'";
}
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale);
if ($search_user > 0)
{
@ -386,6 +441,8 @@ if ($resql)
if ($search_zip) $param.='&search_zip='.urlencode($search_zip);
if ($socid > 0) $param.='&socid='.urlencode($socid);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -464,6 +521,14 @@ if ($resql)
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>';
}
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
@ -546,7 +611,32 @@ if ($resql)
// Date end
if (! empty($arrayfields['p.fin_validite']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre nowraponall" align="center">';
//print $langs->trans('Month').': ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="'.dol_escape_htmltag($search_dayfin).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthfin" value="'.dol_escape_htmltag($search_monthfin).'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$formother->select_year($search_yearfin,'search_yearfin',1, 20, 5);
print '</td>';
}
// Date delivery
if (! empty($arrayfields['p.date_livraison']['checked']))
{
print '<td class="liste_titre nowraponall" align="center">';
//print $langs->trans('Month').': ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="'.dol_escape_htmltag($search_daydelivery).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="'.dol_escape_htmltag($search_monthdelivery).'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$formother->select_year($search_yeardelivery,'search_yeardelivery',1, 20, 5);
print '</td>';
}
// Availability
if (! empty($arrayfields['ava.rowid']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectAvailabilityDelay($search_availability, 'search_availability', '', 1);
print ajax_combobox('search_availability');
print '</td>';
}
if (! empty($arrayfields['p.total_ht']['checked']))
{
@ -624,6 +714,8 @@ if ($resql)
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'],$_SERVER["PHP_SELF"],'ddelivery','',$param, 'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'],$_SERVER["PHP_SELF"],'availability','',$param, '',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder);
@ -789,6 +881,28 @@ if ($resql)
}
if (! $i) $totalarray['nbfield']++;
}
// Date delivery
if (! empty($arrayfields['p.date_livraison']['checked']))
{
if ($obj->ddelivery)
{
print '<td align="center">'.dol_print_date($db->jdate($obj->ddelivery),'day');
print '</td>';
}
else
{
print '<td>&nbsp;</td>';
}
if (! $i) $totalarray['nbfield']++;
}
// Availability
if (! empty($arrayfields['ava.rowid']['checked']))
{
print '<td align="center">';
$form->form_availability('', $obj->availability, 'none', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount HT
if (! empty($arrayfields['p.total_ht']['checked']))

View File

@ -53,7 +53,14 @@ foreach($linkedObjectBlock as $key => $objectlink)
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?></td>
<td class="linkedcol-element" ><?php echo $langs->trans("Proposal"); ?>
<?php if(!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)
{
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
}
?>
</td>
<td class="linkedcol-name" ><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" ><?php echo $objectlink->ref_client; ?></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>

View File

@ -28,9 +28,9 @@
*/
/**
* \file htdocs/commande/card.php
* \file htdocs/commande/card.php
* \ingroup commande
* \brief Page to show customer order
* \brief Page to show customer order
*/
require '../main.inc.php';
@ -68,6 +68,7 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$projectid = GETPOST('projectid', 'int');
$origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
@ -220,7 +221,7 @@ if (empty($reshook))
// Link to a project
else if ($action == 'classin' && $user->rights->commande->creer)
{
$object->setProject(GETPOST('projectid'));
$object->setProject(GETPOST('projectid','int'));
}
// Add order
@ -251,8 +252,8 @@ if (empty($reshook))
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->source = GETPOST('source_id');
$object->fk_project = GETPOST('projectid');
$object->ref_client = GETPOST('ref_client');
$object->fk_project = GETPOST('projectid','int');
$object->ref_client = GETPOST('ref_client','alpha');
$object->modelpdf = GETPOST('model');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
@ -1395,7 +1396,6 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($socid > 0)
$res = $soc->fetch($socid);
$projectid = 0;
$remise_absolue = 0;
$currency_code = $conf->currency;
@ -1492,7 +1492,6 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
$projectid = 0;
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
@ -1500,7 +1499,6 @@ if ($action == 'create' && $user->rights->commande->creer)
$note_public = $object->getDefaultCreateValueFor('note_public');
}
print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
@ -2635,9 +2633,8 @@ if ($action == 'create' && $user->rights->commande->creer)
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show online payment link
//$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
$useonlinepayment = $conf->global->ORDER_SHOW_ONLINE_PAYMENT_ON_ORDER;
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
if (! empty($conf->global->ORDER_HIDE_ONLINE_PAYMENT_ON_ORDER)) $useonlinepayment = 0;
if ($object->statut != Commande::STATUS_DRAFT && $useonlinepayment)
{
print '<br><!-- Link to pay -->';

View File

@ -73,6 +73,7 @@ $socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int');
$search_total_ht=GETPOST('search_total_ht','alpha');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int');
$viewstatut=GETPOST('viewstatut');
@ -193,6 +194,7 @@ if (empty($reshook))
$billed='';
$toselect='';
$search_array_options=array();
$search_categ_cus=0;
}
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
@ -208,6 +210,7 @@ if (empty($reshook))
$uploaddir = $conf->commande->dir_output;
$trigger_name='ORDER_SENTBYMAIL';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@ -237,6 +240,8 @@ $sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_clie
$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.= " p.rowid as project_id, p.ref as project_ref";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -247,6 +252,7 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
$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 ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
@ -327,6 +333,8 @@ if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$sear
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_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -412,6 +420,8 @@ if ($resql)
if ($show_files) $param.='&show_files=' .urlencode($show_files);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($billed != '') $param.='&billed='.urlencode($billed);
if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -419,6 +429,8 @@ if ($resql)
$arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
'cancelorders'=>$langs->trans("Cancel"),
);
if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->commande->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
@ -538,6 +550,14 @@ if ($resql)
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>';
}
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
* Copyright (C) 2012 David Rodriguez Martinez <davidrm146@gmail.com>
* Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -285,6 +285,13 @@ if (($action == 'create' || $action == 'add') && !$error)
{
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
@ -309,7 +316,8 @@ if (($action == 'create' || $action == 'add') && !$error)
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
$lines[$i]->label,
$array_options
);
if ($result > 0)
{

View File

@ -61,7 +61,7 @@ foreach ($remains as $key => $value)
}
// Treatment
$result = $amountPayment != '' ? ($amountPayment - array_sum($amounts)) : ($amountPayment + array_sum($amounts)); // Remaining amountPayment
$result = ($amountPayment != '') ? ($amountPayment - array_sum($amounts)) : array_sum($amounts); // Remaining amountPayment
$toJsonArray = array();
$totalRemaining = price2num(array_sum($remains));
$toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment');

View File

@ -349,7 +349,7 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onclick="javascript:history.go(-1)">';
print '</div>';
print '</form>';

View File

@ -720,7 +720,6 @@ if (empty($reshook))
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$sql.= ' AND pf.fk_paiement = p.rowid';
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
$sql.= ' ORDER BY p.datep, p.tms';
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
@ -914,12 +913,21 @@ if (empty($reshook))
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
$object->type = Facture::TYPE_CREDIT_NOTE;
$facture_source = new Facture($db); // fetch origin object
if ($facture_source->fetch($object->fk_facture_source)>0)
{
if ($facture_source->type == Facture::TYPE_SITUATION)
{
$object->situation_counter = $facture_source->situation_counter;
$object->situation_cycle_ref = $facture_source->situation_cycle_ref;
$facture_source->fetchPreviousNextSituationInvoice();
}
}
$id = $object->create($user);
$facture_source = new Facture($db); // fetch origin object
if (GETPOST('invoiceAvoirWithLines', 'int')==1 && $id>0)
{
if ($facture_source->fetch($object->fk_facture_source)>0)
if (!empty($facture_source->lines))
{
$fk_parent_line = 0;
@ -936,6 +944,61 @@ if (empty($reshook))
$fk_parent_line = 0;
}
if($facture_source->type == Facture::TYPE_SITUATION)
{
if(!empty($facture_source->tab_previous_situation_invoice))
{
// search the last invoice in cycle
$lineIndex = count($facture_source->tab_previous_situation_invoice) - 1;
$searchPreviousInvoice = true;
while( $searchPreviousInvoice )
{
if($facture_source->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1)
{
$searchPreviousInvoice=false; // find, exit;
break;
}
else
{
$lineIndex--; // go to previous invoice in cycle
}
}
$maxPrevSituationPercent = 0;
foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $line->fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);
//$line->subprice = $line->subprice - $prevLine->subprice;
$line->total_ht = $line->total_ht - $prevLine->total_ht;
$line->total_tva = $line->total_tva - $prevLine->total_tva;
$line->total_ttc = $line->total_ttc - $prevLine->total_ttc;
$line->total_localtax1 = $line->total_localtax1 - $prevLine->total_localtax1;
$line->total_localtax2 = $line->total_localtax2 - $prevLine->total_localtax2;
$line->multicurrency_subprice = $line->multicurrency_subprice - $prevLine->multicurrency_subprice;
$line->multicurrency_total_ht = $line->multicurrency_total_ht - $prevLine->multicurrency_total_ht;
$line->multicurrency_total_tva = $line->multicurrency_total_tva - $prevLine->multicurrency_total_tva;
$line->multicurrency_total_ttc = $line->multicurrency_total_ttc - $prevLine->multicurrency_total_ttc;
}
}
// prorata
$line->situation_percent = $maxPrevSituationPercent - $line->situation_percent;
}
}
$line->fk_facture = $object->id;
$line->fk_parent_line = $fk_parent_line;
@ -1456,11 +1519,26 @@ if (empty($reshook))
$object->origin = $origin;
$object->origin_id = $originid;
foreach ($object->lines as &$line)
foreach ($object->lines as $i => &$line)
{
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fetch_optionals($line->id);
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
if ($line->fk_remise_except)
{
$discount=new DiscountAbsolute($line->db);
$result=$discount->fetch($line->fk_remise_except);
if ($result > 0)
{
// Check if discount not already affected to another invoice
if ($discount->fk_facture_line > 0)
{
$line->fk_remise_except = 0;
}
}
}
}
}
@ -1981,7 +2059,25 @@ if (empty($reshook))
$line->fetch(GETPOST('lineid'));
$percent = $line->get_prev_progress($object->id);
if (GETPOST('progress') < $percent)
if($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref>0)
{
// in case of situation credit note
if(GETPOST('progress') >= 0 )
{
$mesg = $langs->trans("CantBeNullOrPositive");
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
}
elseif (GETPOST('progress') < $line->situation_percent) // TODO : use a modified $line->get_prev_progress($object->id) result
{
$mesg = $langs->trans("CantBeLessThanMinPercent");
setEventMessages($mesg, null, 'warnings');
$error++;
$result = -1;
}
}
elseif (GETPOST('progress') < $percent)
{
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
setEventMessages($mesg, null, 'warnings');
@ -2127,6 +2223,126 @@ if (empty($reshook))
exit();
}
// Outing situation invoice from cycle
elseif ($action == 'confirm_situationout' && $confirm == 'yes' && $user->rights->facture->creer)
{
$object->fetch($id,'', '','', true);
if ($object->statut == Facture::STATUS_VALIDATED
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->is_last_in_cycle()
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
)
{
$outingError = 0;
$newCycle = $object->newCycle(); // we need to keep the "situation behavior" so we place it on a new situation cycle
if($newCycle > 1)
{
// Search credit notes
$lastCycle = $object->situation_cycle_ref;
$lastSituationCounter = $object->situation_counter;
$linkedCreditNotesList = array();
if (count($object->tab_next_situation_invoice) > 0) {
foreach ($object->tab_next_situation_invoice as $next_invoice) {
if($next_invoice->type == Facture::TYPE_CREDIT_NOTE
&& $next_invoice->situation_counter == $object->situation_counter
&& $next_invoice->fk_facture_source == $object->id
)
{
$linkedCreditNotesList[] = $next_invoice->id ;
}
}
}
$object->situation_cycle_ref = $newCycle;
$object->situation_counter = 1;
$object->situation_final = 0;
if($object->update($user) > 0)
{
$errors = 0;
if(count($linkedCreditNotesList) > 0)
{
// now, credit note must follow
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture ';
$sql.= ' SET situation_cycle_ref='.$newCycle;
$sql.= ' , situation_final=0';
$sql.= ' , situation_counter='.$object->situation_counter;
$sql.= ' WHERE rowid IN ('.implode(',',$linkedCreditNotesList).')';
$resql=$db->query($sql);
if (!$resql) $errors++;
// Change each progression persent on each lines
foreach($object->lines as $line)
{
// no traitement for special product
if ($line->product_type == 9 ) continue;
if(!empty($object->tab_previous_situation_invoice))
{
// search the last invoice in cycle
$lineIndex = count($object->tab_previous_situation_invoice) - 1;
$searchPreviousInvoice = true;
while( $searchPreviousInvoice )
{
if($object->tab_previous_situation_invoice[$lineIndex]->type == Facture::TYPE_SITUATION || $lineIndex < 1)
{
$searchPreviousInvoice=false; // find, exit;
break;
}
else
{
$lineIndex--; // go to previous invoice in cycle
}
}
$maxPrevSituationPercent = 0;
foreach($object->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine)
{
if($prevLine->id == $line->fk_prev_id)
{
$maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent);
}
}
$line->situation_percent = $line->situation_percent - $maxPrevSituationPercent;
if($line->update()<0) $errors++;
}
}
}
if (!$errors)
{
setEventMessages($langs->trans('Updated'), '', 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
}
else
{
setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors');
}
}
else
{
setEventMessages($langs->trans('ErrorOutingSituationInvoiceOnUpdate'), array(), 'errors');
}
}
else
{
setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors');
}
}
}
// add lines from objectlinked
elseif($action == 'import_lines_from_object'
&& $user->rights->facture->creer
@ -2141,9 +2357,14 @@ if (empty($reshook))
{
if($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class');
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'OrderLine';
}
elseif($fromElement == 'propal')
{
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'PropaleLigne';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
@ -2185,6 +2406,7 @@ if (empty($reshook))
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $ventil, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $type, $rang, $special_code, $origin, $origin_id, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $situation_percent, $fk_prev_id, $fk_unit,$pu_ht_devise);
if($res > 0){
$importCount++;
}else{
@ -3157,6 +3379,24 @@ else if ($id > 0 || ! empty($ref))
}
}
// Confirmation to remove invoice from cycle
if ($action == 'situationout') {
$text = $langs->trans('ConfirmRemoveSituationFromCycle', $object->ref);
$label = $langs->trans("ConfirmOuting");
$formquestion = array();
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->is_last_in_cycle()
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
)
{
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $label, $text, 'confirm_situationout', $formquestion, "yes", 1);
}
}
// Confirmation of validation
if ($action == 'valid')
{
@ -3638,54 +3878,10 @@ else if ($id > 0 || ! empty($ref))
print "</td>";
print '</tr>';
// Situations
if (! empty($conf->global->INVOICE_USE_SITUATION))
{
if ($object->type == 5 && ($object->situation_counter > 1))
{
$prevsits = $object->get_prev_sits();
print '<tr><td>';
print $langs->trans('SituationAmount');
print ' ';
print $prevsits[0]->situation_counter;
$cprevsits = count($prevsits);
for ($i = 1; $i < $cprevsits; $i++) {
print ' + ';
print $prevsits[$i]->situation_counter;
}
print ' + ';
print $object->situation_counter;
print '</td>';
print '<td class="nowrap">';
$prevsits_total_amount = 0;
foreach ($prevsits as $situation) {
$prevsits_total_amount += $situation->total_ht;
}
$prevsits_total_amount += $object->total_ht;
print price($prevsits_total_amount, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
print '</td></tr>';
// Previous situation(s) deduction(s)
for ($i = 0; $i < $cprevsits; $i++) {
print '<tr><td>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?facid=' . $prevsits[$i]->id . '">';
print $langs->trans('SituationDeduction');
print ' ';
print $prevsits[$i]->situation_counter;
print '</a></td>';
print '<td class="nowrap">';
print '- ' . price($prevsits[$i]->total_ht, 0, $langs, 1, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency) );
print '</td></tr>';
}
}
}
// Incoterms
if (!empty($conf->incoterm->enabled))
@ -3844,88 +4040,129 @@ else if ($id > 0 || ! empty($ref))
if (! empty($conf->incoterm->enabled))
$nbrows += 1;
if ($object->type == Facture::TYPE_SITUATION && ! empty($conf->global->INVOICE_USE_SITUATION))
// List of previous situation invoices
if (($object->situation_cycle_ref > 0) && ! empty($conf->global->INVOICE_USE_SITUATION))
{
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
print '<table class="noborder situationstable" width="100%">';
if (count($object->tab_previous_situation_invoice) > 0) {
// List of previous invoices
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfPreviousSituationInvoices') . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
print '<table class="noborder situationstable" width="100%">';
$total_prev_ht = $total_prev_ttc = 0;
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
$totalpaye = $prev_invoice->getSommePaiement();
$total_prev_ht += $prev_invoice->total_ht;
$total_prev_ttc += $prev_invoice->total_ttc;
print '<tr class="oddeven">';
print '<td>' . $prev_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($prev_invoice->total_ht) . '</td>';
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
print '<td align="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfSituationInvoices') . '</td>';
print '<td></td>';
print '<td align="center">' . $langs->trans('Situation') . '</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
print '<tr class="oddeven">';
print '<td></td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td></td>';
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_prev_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
}
if (count($object->tab_next_situation_invoice) > 0) {
// List of next invoices
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
$total_prev_ht = $total_prev_ttc = 0;
$total_global_ht = $total_global_ttc = 0;
$total_next_ht = $total_next_ttc = 0;
if (count($object->tab_previous_situation_invoice) > 0) {
// List of previous invoices
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
print '<tr class="oddeven">';
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
$current_situation_counter = array();
foreach ($object->tab_previous_situation_invoice as $prev_invoice) {
$totalpaye = $prev_invoice->getSommePaiement();
$total_prev_ht += $prev_invoice->total_ht;
$total_prev_ttc += $prev_invoice->total_ttc;
$current_situation_counter[] = (($prev_invoice->type == Facture::TYPE_CREDIT_NOTE)?-1:1) * $prev_invoice->situation_counter;
print '<tr class="oddeven">';
print '<td>' . $prev_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
print '<td align="center" >'.(($prev_invoice->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $prev_invoice->situation_counter.'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($prev_invoice->total_ht) . '</td>';
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
print '<td align="right">' . $prev_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
}
}
print '<tr class="oddeven">';
print '<td colspan="2" align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
$total_global_ht += $total_prev_ht ;
$total_global_ttc += $total_prev_ttc ;
$total_global_ht += $object->total_ht;
$total_global_ttc += $object->total_ttc;
$current_situation_counter[] = (($object->type == Facture::TYPE_CREDIT_NOTE)?-1:1) * $object->situation_counter;
print '<tr class="oddeven">';
print '<td>' . $object->getNomUrl(1) . '</td>';
print '<td></td>';
print '<td align="center">'.(($object->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $object->situation_counter.'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($object->total_ht) . '</td>';
print '<td align="right">' . price($object->total_ttc) . '</td>';
print '<td align="right">' . $object->getLibStatut(3, $object->getSommePaiement()) . '</td>';
print '</tr>';
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_next_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
}
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0)
print '</table>';
print '<tr class="oddeven">';
print '<td colspan="2" align="left"><b>' . $langs->trans('CurrentSituationTotal') . '</b></td>';
print '<td>';
$i =0;
foreach ($current_situation_counter as $sit)
{
$curSign = $sit>0?'+':'-';
$curType = $sit>0?$langs->trans('situationInvoiceShortcode_S'):$langs->trans('situationInvoiceShortcode_AS');
if($i>0) print ' '.$curSign.' ';
print $curType . abs($sit);
$i++;
}
print '</td>';
if (! empty($conf->banque->enabled)) print '<td></td>';
print '<td align="right"><b>' . price($total_global_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_global_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
if (count($object->tab_next_situation_invoice) > 0) {
// List of next invoices
/*print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>';
print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';*/
$total_next_ht = $total_next_ttc = 0;
foreach ($object->tab_next_situation_invoice as $next_invoice) {
$totalpaye = $next_invoice->getSommePaiement();
$total_next_ht += $next_invoice->total_ht;
$total_next_ttc += $next_invoice->total_ttc;
print '<tr class="oddeven">';
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
print '<td align="center">'.(($next_invoice->type == Facture::TYPE_CREDIT_NOTE)?$langs->trans('situationInvoiceShortcode_AS'):$langs->trans('situationInvoiceShortcode_S')) . $next_invoice->situation_counter.'</td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
print '</tr>';
}
$total_global_ht += $total_next_ht;
$total_global_ttc += $total_next_ttc;
print '<tr class="oddeven">';
print '<td colspan="3" align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right"><b>' . price($total_global_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_global_ttc) . '</b></td>';
print '<td width="18">&nbsp;</td>';
print '</tr>';
}
print '</table>';
}
@ -4481,6 +4718,45 @@ else if ($id > 0 || ! empty($ref))
}
}
// For situation invoice with excess received
if ($object->statut == Facture::STATUS_VALIDATED
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->is_last_in_cycle()
&& $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE
)
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?socid=' . $object->socid .'&amp;fac_avoir=' . $object->id . '&amp;invoiceAvoirWithLines=1&amp;action=create&amp;type=2'.($object->fk_project > 0 ? '&amp;projectid='.$object->fk_project : '').'">' . $langs->trans("CreateCreditNote") . '</a></div>';
} else {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans("CreateCreditNote") . '</span></div>';
}
}
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext
&& $object->situation_counter > 1
&& $object->is_last_in_cycle()
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
)
{
if(($object->total_ttc - $totalcreditnotes ) == 0 )
{
print '<div class="inline-block divButAction"><a id="butSituationOut" class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&amp;action=situationout">' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a id="butSituationOutRefused" class="butActionRefused" href="#" title="' . $langs->trans("DisabledBecauseNotEnouthCreditNote") . '" >' . $langs->trans("RemoveSituationFromCycle") . '</a></div>';
}
}
// Create next situation invoice
if ($user->rights->facture->creer && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) {
if ($object->is_last_in_cycle() && $object->situation_final != 1) {
@ -4555,7 +4831,7 @@ else if ($id > 0 || ! empty($ref))
&& $object->statut == Facture::STATUS_DRAFT
&& ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) )
{
$compatibleImportElementsList = array('commande'); // import from linked elements
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);

View File

@ -1074,7 +1074,7 @@ class Invoices extends DolibarrApi
* Warning: Take care that all invoices are owned by the same customer.
* Example of value for parameter arrayofamounts: {"1": "99.99", "2": "10"}
*
* @param string $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
* @param string $datepaye {@from body} Payment date {@type timestamp}
* @param int $paiementid {@from body} Payment mode Id {@min 1}
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}

View File

@ -973,12 +973,16 @@ class FactureRec extends CommonInvoice
*
* WARNING: This method change temporarly context $conf->entity to be in correct context for each recurring invoice found.
*
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
* @param int $restictoninvoiceid 0=All qualified template invoices found. > 0 = restrict action on invoice ID
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
function createRecurringInvoices()
function createRecurringInvoices($restictoninvoiceid=0, $forcevalidation=0)
{
global $conf, $langs, $db, $user;
$error=0;
$langs->load("bills");
$nb_create=0;
@ -987,13 +991,15 @@ class FactureRec extends CommonInvoice
$tmparray=dol_getdate($now);
$today = dol_mktime(23,59,59,$tmparray['mon'],$tmparray['mday'],$tmparray['year']); // Today is last second of current day
dol_syslog("createRecurringInvoices");
dol_syslog("createRecurringInvoices restictoninvoiceid=".$restictoninvoiceid." forcevalidation=".$forcevalidation);
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_rec';
$sql.= ' WHERE frequency > 0'; // A recurring invoice is an invoice with a frequency
$sql.= " AND (date_when IS NULL OR date_when <= '".$db->idate($today)."')";
$sql.= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
$sql.= ' AND suspended = 0';
$sql.= ' AND entity = '.$conf->entity; // MUST STAY = $conf->entity here
if ($restictoninvoiceid > 0) $sql.=' AND rowid = '.$restictoninvoiceid;
$sql.= $db->order('entity', 'ASC');
//print $sql;exit;
@ -1010,11 +1016,13 @@ class FactureRec extends CommonInvoice
while ($i < $num) // Loop on each template invoice. If $num = 0, test is false at first pass.
{
$line = $db->fetch_object($resql);
$line = $db->fetch_object($resql);
$db->begin();
$facturerec = new FactureRec($db);
$invoiceidgenerated = 0;
$facturerec = new FactureRec($db);
$facturerec->fetch($line->rowid);
if ($facturerec->id > 0)
@ -1024,8 +1032,6 @@ class FactureRec extends CommonInvoice
dol_syslog("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref.", entity=".$facturerec->entity);
$error=0;
$facture = new Facture($db);
$facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
$facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
@ -1042,7 +1048,7 @@ class FactureRec extends CommonInvoice
$this->error = $facture->error;
$error++;
}
if (! $error && $facturerec->auto_validate)
if (! $error && ($facturerec->auto_validate || $forcevalidation))
{
$result = $facture->validate($user);
if ($result <= 0)

View File

@ -16,6 +16,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1349,7 +1350,7 @@ class Facture extends CommonInvoice
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
if ($this->type == self::TYPE_SITUATION && $fetch_situation)
if (($this->type == self::TYPE_SITUATION || ($this->type == self::TYPE_CREDIT_NOTE && $this->situation_cycle_ref > 0)) && $fetch_situation)
{
$this->fetchPreviousNextSituationInvoice();
}
@ -1521,8 +1522,16 @@ class Facture extends CommonInvoice
$invoice = new Facture($this->db);
if ($invoice->fetch($objp->rowid) > 0)
{
if ($objp->situation_counter < $this->situation_counter) $this->tab_previous_situation_invoice[] = $invoice;
else $this->tab_next_situation_invoice[] = $invoice;
if ($objp->situation_counter < $this->situation_counter
|| ($objp->situation_counter == $this->situation_counter && $objp->rowid < $this->id) // This case appear when there are credit notes
)
{
$this->tab_previous_situation_invoice[] = $invoice;
}
else
{
$this->tab_next_situation_invoice[] = $invoice;
}
}
}
}
@ -3493,6 +3502,7 @@ class Facture extends CommonInvoice
$return = array();
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, f.type, f.paye, pf.fk_paiement";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
@ -3504,6 +3514,23 @@ class Facture extends CommonInvoice
// $sql.= " OR f.close_code IS NOT NULL)"; // Classee payee partiellement
$sql.= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement
$sql.= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir
if($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE){
// Select the last situation invoice
$sqlSit = 'SELECT MAX(fs.rowid)';
$sqlSit.= " FROM ".MAIN_DB_PREFIX."facture as fs";
$sqlSit.= " WHERE fs.entity = ".$conf->entity;
$sqlSit.= " AND fs.type = ".self::TYPE_SITUATION;
$sqlSit.= " AND fs.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
$sqlSit.= " GROUP BY fs.situation_cycle_ref";
$sqlSit.= " ORDER BY fs.situation_counter";
$sql.= " AND ( f.type != ".self::TYPE_SITUATION . " OR f.rowid IN (".$sqlSit.") )"; // Type non 5 si facture non avoir
}
else
{
$sql.= " AND f.type != ".self::TYPE_SITUATION ; // Type non 5 si facture non avoir
}
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber";
@ -3973,9 +4000,10 @@ class Facture extends CommonInvoice
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param null|array $moreparams Array to provide more information
* @return int <0 if KO, >0 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
{
global $conf,$langs;
@ -3994,7 +4022,7 @@ class Facture extends CommonInvoice
$modelpath = "core/modules/facture/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}
/**

View File

@ -96,6 +96,7 @@ $search_year = GETPOST('search_year','int');
$search_day_lim = GETPOST('search_day_lim','int');
$search_month_lim = GETPOST('search_month_lim','int');
$search_year_lim = GETPOST('search_year_lim','int');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$option = GETPOST('search_option');
if ($option == 'late') {
@ -228,6 +229,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter','a
$search_month_lim='';
$toselect='';
$search_array_options=array();
$search_categ_cus=0;
}
if (empty($reshook))
@ -369,6 +372,8 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
// 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)
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -379,6 +384,8 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields as ef on (f.rowid = ef.fk_object)";
if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
@ -435,6 +442,8 @@ if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_va
if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1);
if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
if ($search_status != '' && $search_status >= 0)
{
if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft
@ -566,6 +575,8 @@ if ($resql)
if ($show_files) $param.='&show_files='.urlencode($show_files);
if ($option) $param.="&search_option=".urlencode($option);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -574,24 +585,19 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
);
if ($conf->prelevement->enabled)
{
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest']=$langs->trans("MakeWithdrawRequest");
if ($conf->prelevement->enabled) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest");
}
if ($user->rights->facture->supprimer)
{
//if (! empty($conf->global->STOCK_CALCULATE_ON_BILL) || empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED))
{
// mass deletion never possible on invoices on such situation
if ($user->rights->facture->supprimer) {
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
$arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft");
}
else
{
$arrayofmassactions['predelete']=$langs->trans("Delete");
}
}
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
$arrayofmassactions['predelete'] = $langs->trans("Delete");
}
}
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton='';
@ -657,6 +663,14 @@ if ($resql)
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>';
}
if (! empty($conf->categorie->enabled))
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': ';
$moreforfilter.=$formother->select_categories('customer',$search_categ_cus,'search_categ_cus',1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;

View File

@ -164,7 +164,7 @@ if($calc ==0 || $calc == 2)
print "<td align=\"right\">".$vatcust."</td>";
print "</tr>\n";
$coll_list = tax_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell');
$coll_list = tax_by_thirdparty('localtax'.$local, $db, 0, $date_start, $date_end, $modetax, 'sell');
$action = "tvaclient";
$object = &$coll_list;
@ -248,7 +248,7 @@ if($calc ==0 || $calc == 1){
$company_static=new Societe($db);
$coll_list = tax_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
$coll_list = tax_by_thirdparty('localtax'.$local, $db, 0, $date_start, $date_end,$modetax, 'buy');
$parameters["direction"] = 'buy';
$parameters["type"] = 'localtax'.$local;

View File

@ -0,0 +1,404 @@
<?php
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/compta/stats/byratecountry.php
* \brief VAT by rate
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.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.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
$langs->loadLangs(array("other","compta","banks","bills","companies","product","trips","admin","accountancy"));
$modecompta = GETPOST('modecompta','alpha');
// Date range
$year=GETPOST("year",'int');
$month=GETPOST("month",'int');
if (empty($year))
{
$year_current = strftime("%Y",dol_now());
$month_current = strftime("%m",dol_now());
$year_start = $year_current;
} else {
$year_current = $year;
$month_current = strftime("%m",dol_now());
$year_start = $year;
}
$date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
$date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
// Quarter
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q","int");
if (empty($q))
{
// We define date_start and date_end
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
$year_end=$year_start;
$month_end=$month_start;
if (! GETPOST("month")) // If month not forced
{
if (! GETPOST('year') && $month_start > $month_current)
{
$year_start--;
$year_end--;
}
$month_end=$month_start-1;
if ($month_end < 1) $month_end=12;
else $year_end++;
}
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
}
else
{
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
}
}
// $date_start and $date_end are defined. We force $year_start and $nbofyear
$tmps=dol_getdate($date_start);
$year_start = $tmps['year'];
$tmpe=dol_getdate($date_end);
$year_end = $tmpe['year'];
$tmp_date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
if ($tmp_date_end < $date_end || $date_end < $date_start) $date_end = $tmp_date_end;
$min = price2num(GETPOST("min","alpha"));
if (empty($min)) $min = 0;
// Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
$modetax = $conf->global->TAX_MODE;
if (GETPOSTISSET("modetax")) $modetax=GETPOST("modetax",'int');
if (empty($modetax)) $modetax=0;
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
/*
* View
*/
$form=new Form($db);
$company_static=new Societe($db);
$invoice_customer=new Facture($db);
$invoice_supplier=new FactureFournisseur($db);
$expensereport=new ExpenseReport($db);
$product_static=new Product($db);
$payment_static=new Paiement($db);
$paymentfourn_static=new PaiementFourn($db);
$paymentexpensereport_static=new PaymentExpenseReport($db);
$morequerystring='';
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
foreach ($listofparams as $param)
{
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
}
llxHeader('',$langs->trans("TurnoverReport"),'','',0,0,'','',$morequerystring);
//print load_fiche_titre($langs->trans("VAT"),"");
//$fsearch.='<br>';
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
// Show report header
$name=$langs->trans("xxx");
$calcmode='';
if ($modetax == 0) $calcmode=$langs->trans('OptionVATDefault');
if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption');
if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices');
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
// Set period
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
$prevyear=$year_start; $prevquarter=$q;
if ($prevquarter > 1) {
$prevquarter--;
} else {
$prevquarter=4; $prevyear--;
}
$nextyear=$year_start; $nextquarter=$q;
if ($nextquarter < 4) {
$nextquarter++;
} else {
$nextquarter=1; $nextyear++;
}
$description.=$fsearch;
$builddate=dol_now();
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='<br>'.$langs->trans("RulesVATInServices");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
}
if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue");
// Customers invoices
$elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService");
$amountcust=$langs->trans("AmountHT");
// Suppliers invoices
$elementsup=$langs->trans("SuppliersInvoices");
$productsup=$productcust;
$amountsup=$amountcust;
$namesup=$namecust;
// Show report header
$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByVatRate");
if ($modecompta=="CREANCES-DETTES") {
$calcmode=$langs->trans("CalcModeDebt");
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$description=$langs->trans("RulesCADue");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description.= $langs->trans("DepositsAreNotIncluded");
} else {
$description.= $langs->trans("DepositsAreIncluded");
}
$builddate=dol_now();
} else {
$calcmode=$langs->trans("CalcModeEngagement");
$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description=$langs->trans("RulesCAIn");
$description.= $langs->trans("DepositsAreIncluded");
$builddate=dol_now();
}
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
else $periodlink = '';
$description.=' <input type="hidden" name="modecompta" value="'.$modecompta.'">';
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
if ($modecompta == 'CREANCES-DETTES')
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("TurnoverbyVatrate") . '</td>';
print '<td align="left">' . $langs->trans("ProductOrService") . '</td>';
print '<td align="left">' . $langs->trans("Country") . '</td>';
$i=0;
while($i < 12)
{
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
$i++;
}
print '<td width="60" align="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
$sql = "SELECT fd.tva_tx AS vatrate,";
$sql .= " fd.product_type AS product_type,";
$sql .= " cc.label AS country,";
for ($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
$sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
$sql .= " WHERE f.datef >= '" . $db->idate($date_start) . "'";
$sql .= " AND f.datef <= '" . $db->idate($date_end) . "'";
$sql.= " AND f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2,5)";
} else {
$sql.= " AND f.type IN (0,1,2,3,5)";
}
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")";
$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$totalpermonth = array();
while ( $obj = $db->fetch_object($resql)) {
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
if ($obj->product_type == 0) {
print '<td align="left">'. $langs->trans("Product") . '</td>';
} else {
print '<td align="left">'. $langs->trans("Service") . '</td>';
}
print '<td>' .$obj->country . '</td>';
for($i = 0; $i < 12; $i++) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
print '<td align="right" width="6%">' . price($obj->$monthj) . '</td>';
$totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
}
print '<td align="right" width="6%"><b>' . price($obj->total) . '</b></td>';
$totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
print '</tr>';
}
$db->free($resql);
// Total
print '<tr class="liste_total"><td class="right"></td>';
print '<td align="left"></td>';
print '<td></td>';
for($i = 0; $i < 12; $i++) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
print '<td align="right" width="6%">' . price($totalpermonth[$j]) . '</td>';
}
print '<td align="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
print '</tr>';
} else {
print $db->lasterror(); // Show last sql error
}
print '<tr class="liste_titre"><td width="6%" class="right">' . $langs->trans("PurchasebyVatrate") . '</td>';
print '<td align="left">' . $langs->trans("ProductOrService") . '</td>';
print '<td align="left">' . $langs->trans("Country") . '</td>';
$i=0;
while($i < 12)
{
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
$i++;
}
print '<td width="60" align="right"><b>' . $langs->trans("TotalHT") . '</b></td></tr>';
$sql2 = "SELECT ffd.tva_tx AS vatrate,";
$sql2 .= " ffd.product_type AS product_type,";
$sql2 .= " cc.label AS country,";
for($i = 1; $i <= 12; $i ++) {
$sql2 .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
}
$sql2 .= " SUM(ffd.total_ht) as total";
$sql2 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = ff.fk_soc";
$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
$sql2 .= " WHERE ff.datef >= '" . $db->idate($date_start) . "'";
$sql2 .= " AND ff.datef <= '" . $db->idate($date_end) . "'";
$sql.= " AND ff.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND ff.type IN (0,1,2,5)";
} else {
$sql.= " AND ff.type IN (0,1,2,3,5)";
}
$sql2 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")";
$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
//print $sql2;
dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
$resql2 = $db->query($sql2);
if ($resql2) {
$num = $db->num_rows($resql2);
$totalpermonth = array();
while ( $obj = $db->fetch_object($resql2)) {
print '<tr class="oddeven"><td class="right">' . vatrate($obj->vatrate) . '</td>';
if ($obj->product_type == 0) {
print '<td align="left">'. $langs->trans("Product") . '</td>';
} else {
print '<td align="left">'. $langs->trans("Service") . '</td>';
}
print '<td>' . $obj->country . '</td>';
for($i = 0; $i < 12; $i++) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
print '<td align="right" width="6%">' . price($obj->$monthj) . '</td>';
$totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
}
print '<td align="right" width="6%"><b>' . price($obj->total) . '</b></td>';
$totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
print '</tr>';
}
$db->free($resql2);
// Total
print '<tr class="liste_total"><td class="right"></td>';
print '<td align="left"></td>';
print '<td></td>';
for($i = 0; $i < 12; $i++) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
print '<td align="right" width="6%">' . price($totalpermonth[$j]) . '</td>';
}
print '<td align="right" width="6%"><b>' . price($totalpermonth['total']) . '</b></td>';
print '</tr>';
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
} else {
// $modecompta != 'CREANCES-DETTES'
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
// invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ?
// Because there is no way to know this, this report is not relevant.
print '<br>'.$langs->trans("TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant") . '<br>';
}
llxFooter();
$db->close();

View File

@ -29,9 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->load("products");
$langs->load("categories");
$langs->load("errors");
$langs->loadLangs(array("products","categories","errors",'accountancy'));
// Security pack (data & check)
$socid = GETPOST('socid','int');
@ -78,13 +76,13 @@ if (empty($year))
$month_current = strftime("%m",dol_now());
$year_start = $year;
}
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
$date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
$date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
// Quarter
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q")?GETPOST("q"):0;
if ($q==0)
$q=GETPOST("q","int");
if (empty($q))
{
// We define date_start and date_end
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
@ -103,10 +101,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
}
$date_start=dol_get_first_day($year_start,$month_start,false); $date_end=dol_get_last_day($year_end,$month_end,false);
}
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
else
{
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
}
} else {
// TODO We define q
}
@ -188,7 +189,7 @@ report_header($name,$namelink,$period,$periodlink,$description,$builddate,$expor
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
{
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
}
@ -205,17 +206,17 @@ if ($modecompta == 'CREANCES-DETTES')
$sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
$sql.= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
$sql.= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l, ".MAIN_DB_PREFIX."product as p";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as l";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
if ($selected_cat === -2) // Without any category
{
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
}
else if ($selected_cat) // Into a specific category
{
$sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
}
$sql.= " WHERE l.fk_product = p.rowid";
$sql.= " AND l.fk_facture = f.rowid";
$sql.= " WHERE l.fk_facture = f.rowid";
$sql.= " AND f.fk_statut in (1,2)";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2,5)";
@ -363,23 +364,21 @@ if ($modecompta == 'CREANCES-DETTES')
);
print "</tr>\n";
// Array Data
$var=true;
if (count($name)) {
foreach($name as $key=>$value) {
print '<tr class="oddeven">';
// Product
print "<td>";
$fullname=$name[$key];
if ($key >= 0) {
if ($key > 0) {
$linkname='<a href="'.DOL_URL_ROOT.'/product/card.php?id='.$key.'">'.img_object($langs->trans("ShowProduct"),$type[$key]==0?'product':'service').' '.$fullname.'</a>';
} else {
$linkname=$langs->trans("PaymentsNotLinkedToProduct");
}
print "<td>".$linkname."</td>\n";
print $linkname;
print "</td>\n";
// Quantity
print '<td align="right">';
@ -423,11 +422,11 @@ if ($modecompta == 'CREANCES-DETTES')
// Total
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($qtytotal).'</td>';
print '<td>&nbsp;</td>';
print '<td align="right">'.$qtytotal.'</td>';
print '<td align="right">100%</td>';
print '<td align="right">'.price($catotal_ht).'</td>';
print '<td align="right">'.price($catotal).'</td>';
print '<td>&nbsp;</td>';
print '<td align="right">100%</td>';
print '</tr>';
$db->free($result);

View File

@ -90,8 +90,8 @@ $date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GE
// Quarter
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{
$q=GETPOST("q")?GETPOST("q"):0;
if ($q==0)
$q=GETPOST("q","int")?GETPOST("q","int"):0;
if (empty($q))
{
// We define date_start and date_end
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);

View File

@ -565,7 +565,7 @@ print '</div>';
$i++;
}
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>";
print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Facture a encaisser : </i></td><td align=\"right\"><i>".price($total_ttc_Rac)."</i></td><td colspan=\"5\"><-- bug ici car n'exclut pas le deja r?gl? des factures partiellement r?gl?es</td></tr>";
}
$db->free($resql);
}
@ -614,7 +614,7 @@ print '</div>';
$i++;
}
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>";
print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Signe et non facture:</i></td><td align=\"right\"><i>".price($total_pr)."</i></td><td colspan=\"5\"><-- bug ici, ca devrait exclure le deja facture</td></tr>";
}
$db->free($resql);
}
@ -622,7 +622,7 @@ print '</div>';
{
dol_print_error($db);
}
print "<tr ".$bc[$var]."><td align=\"right\" colspan=\"5\"><i>Total CA previsionnel : </i></td><td align=\"right\"><i>".price($total_CA)."</i></td><td colspan=\"3\"><-- bug ici car bug sur les 2 precedents</td></tr>";
print "<tr class="oddeven"><td align=\"right\" colspan=\"5\"><i>Total CA previsionnel : </i></td><td align=\"right\"><i>".price($total_CA)."</i></td><td colspan=\"3\"><-- bug ici car bug sur les 2 precedents</td></tr>";
}
print "</table>";

View File

@ -105,14 +105,19 @@ function pt ($db, $sql, $date)
$amountclaimed = 0;
$amountpaid = 0;
$previousmonth = '';
$previousmode = '';
$mode = '';
while ($i < $num) {
$obj = $db->fetch_object($result);
$mode = $obj->mode;
//print $obj->dm.' '.$obj->mode.' '.$previousmonth.' '.$previousmode;
if ($obj->mode == 'claimed' && ! empty($previousmode))
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$obj->dm."</td>\n";
print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
@ -129,7 +134,7 @@ function pt ($db, $sql, $date)
if ($obj->mode == 'paid')
{
$amountpaid = $obj->mm;
$totalpaid = $totalpaid + $amountpaied;
$totalpaid = $totalpaid + $amountpaid;
}
if ($obj->mode == 'paid')
@ -142,19 +147,21 @@ function pt ($db, $sql, $date)
$amountclaimed = 0;
$amountpaid = 0;
$previousmode = '';
$previousmonth = '';
}
else
{
$previousmode = $obj->mode;
$previousmonth = $obj->dm;
}
$i++;
}
if ($obj->mode == 'claimed' && ! empty($previousmode))
if ($mode == 'claimed' && ! empty($previousmode))
{
print '<tr class="oddeven">';
print '<td class="nowrap">'.$obj->dm."</td>\n";
print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
print "</tr>\n";
@ -170,6 +177,7 @@ function pt ($db, $sql, $date)
print "</tr>";
print "</table>";
$db->free($result);
}
else {
@ -534,7 +542,7 @@ $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
$sql.= " GROUP BY dm";
$sql.= " ORDER BY dm ASC";
$sql.= " ORDER BY dm ASC, mode ASC";
//print $sql;
pt($db, $sql, $langs->trans("Month"));

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -610,6 +611,13 @@ if ($massaction == 'confirm_createbills')
{
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
}
$result = $objecttmp->addline(
$desc,
$lines[$i]->subprice,
@ -634,7 +642,8 @@ if ($massaction == 'confirm_createbills')
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
$lines[$i]->label,
$array_options
);
if ($result > 0)
{
@ -736,6 +745,56 @@ if ($massaction == 'confirm_createbills')
}
}
if (!$error && $massaction == 'cancelorders')
{
$db->begin();
$nbok = 0;
$orders = GETPOST('toselect', 'array');
foreach ($orders as $id_order)
{
$cmd = new Commande($db);
if ($cmd->fetch($id_order) <= 0)
continue;
if ($cmd->statut != Commande::STATUS_VALIDATED)
{
$langs->load('errors');
setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors');
$error++;
break;
}
else
$result = $cmd->cancel();
if ($result < 0)
{
setEventMessages($cmd->error, $cmd->errors, 'errors');
$error++;
break;
}
else
$nbok++;
}
if (!$error)
{
if ($nbok > 1)
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
else
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
}
else
{
$db->rollback();
}
}
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
{
if (empty($diroutputmassaction))
@ -1029,24 +1088,23 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
$result=$objecttmp->fetch($toselectid);
if ($result > 0)
{
// Refuse deletion for some status ?
/*
if ($objectclass == 'Facture' && $objecttmp->status == Facture::STATUS_DRAFT)
{
$langs->load("errors");
$nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'</div><br>';
continue;
}*/
// Refuse deletion for some objects/status
if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT)
{
$langs->load("errors");
$nbignored++;
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'</div><br>';
continue;
}
if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
else $result = $objecttmp->delete($user);
if ($result <= 0)
{
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
else $nbok++;
}

View File

@ -146,9 +146,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$sendtocc='';
$sendtobcc='';
$sendtoid = array();
if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
$sendtouserid=array();
}
$sendtouserid=array();
$sendtoccuserid=array();
// Define $sendto
$receiver=$_POST['receiver'];
@ -179,18 +178,20 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
}
}
if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
{
$receiveruser=$_POST['receiveruser'];
if (is_array($receiveruser) && count($receiveruser)>0)
{
$fuserdest = new User($db);
foreach($receiveruser as $key=>$val)
{
$tmparray[] = $fuserdest->user_get_property($key,'email');
$sendtouserid[] = $key;
$tmparray[] = $fuserdest->user_get_property($val,'email');
$sendtouserid[] = $val;
}
}
}
$sendto=implode(',',$tmparray);
// Define $sendtocc
@ -222,15 +223,15 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
}
if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
$receiveruser=$_POST['receiveccruser'];
$receiverccuser=$_POST['receiverccuser'];
if (is_array($receiveruser) && count($receiveruser)>0)
if (is_array($receiverccuser) && count($receiverccuser)>0)
{
$fuserdest = new User($db);
foreach($receiveruser as $key=>$val)
foreach($receiverccuser as $key=>$val)
{
$tmparray[] = $fuserdest->user_get_property($key,'email');
$sendtouserid[] = $key;
$tmparray[] = $fuserdest->user_get_property($val,'email');
$sendtoccuserid[] = $val;
}
}
}
@ -418,7 +419,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
}
}*/
// Initialisation of datas
// Initialisation of datas of object to call trigger
if (is_object($object))
{
if (empty($actiontypecode)) $actiontypecode='AC_OTH_AUTO'; // Event insert into agenda automatically

View File

@ -451,7 +451,7 @@ abstract class CommonObject
* @param int $withregion 1=Add region into address string
* @return string Full address string
*/
function getFullAddress($withcountry=0,$sep="\n",$withregion=0)
function getFullAddress($withcountry=0, $sep="\n", $withregion=0)
{
if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country)))
{
@ -2660,7 +2660,7 @@ abstract class CommonObject
$this->multicurrency_total_ttc += isset($this->revenuestamp)?($this->revenuestamp * $multicurrency_tx):0;
// Situations totals
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits'))
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits') && $this->type != $this::TYPE_CREDIT_NOTE )
{
$prev_sits = $this->get_prev_sits();
@ -2704,7 +2704,7 @@ abstract class CommonObject
$sql .= ", multicurrency_total_ttc='".price2num($this->multicurrency_total_ttc, 'MT', 1)."'";
$sql .= ' WHERE rowid = '.$this->id;
//print "xx".$sql;
dol_syslog(get_class($this)."::update_price", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
@ -3677,7 +3677,7 @@ abstract class CommonObject
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
@ -3716,7 +3716,7 @@ abstract class CommonObject
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if ($outputalsopricetotalwithtax) print '<td align="right" width="80">'.$langs->trans('TotalTTCShort').'</td>';

View File

@ -39,38 +39,50 @@ class ExtraFields
var $db;
// type of element (for what object is the extrafield)
// @deprecated
var $attribute_elementtype;
// Array with type of the extra field
// @deprecated
var $attribute_type;
// Array with label of extra field
// @deprecated
var $attribute_label;
// Array with size of extra field
// @deprecated
var $attribute_size;
// array with list of possible values for some types of extra fields
// @deprecated
var $attribute_choice;
// Array to store compute formula for computed fields
// @deprecated
var $attribute_computed;
// Array to store default value
// @deprecated
var $attribute_default;
// Array to store if attribute is unique or not
// @deprecated
var $attribute_unique;
// Array to store if attribute is required or not
// @deprecated
var $attribute_required;
// Array to store parameters of attribute (used in select type)
// @deprecated
var $attribute_param;
// Array to store position of attribute
// @deprecated
var $attribute_pos;
// Array to store if attribute is editable regardless of the document status
// @deprecated
var $attribute_alwayseditable;
// Array to store permission to check
// @deprecated
var $attribute_perms;
// Array to store language file to translate label of values
// @deprecated
var $attribute_langfile;
// Array to store if field is visible by default on list
// @deprecated
var $attribute_list;
// Array to store if extra field is hidden
var $attribute_hidden; // warning, do not rely on this. If your module need a hidden data, it must use its own table.
// New array to store extrafields definition
var $attributes;
@ -126,7 +138,6 @@ class ExtraFields
$this->attribute_perms = array();
$this->attribute_langfile = array();
$this->attribute_list = array();
$this->attribute_hidden = array();
}
/**
@ -758,7 +769,7 @@ class ExtraFields
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity";
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity,enabled";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element
@ -812,6 +823,7 @@ class ExtraFields
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
$this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]);
$this->attributes[$tab->elementtype]['enabled'][$tab->name]=$tab->enabled;
$this->attributes[$tab->elementtype]['loaded']=1;
}
@ -884,7 +896,7 @@ class ExtraFields
$param=$this->attribute_param[$key];
$langfile=$this->attribute_langfile[$key];
$list=$this->attribute_list[$key];
$hidden=$this->attribute_hidden[$key];
$hidden=(empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
if ($computed)

View File

@ -182,6 +182,7 @@ class HookManager
'printTabsHead',
'printObjectLine',
'printObjectSubLine',
'restrictedArea',
'sendMail',
'sendMailAfter',
'showLinkToObjectBlock',

View File

@ -16,6 +16,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -2904,7 +2905,7 @@ class Form
dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
print '<select class="flat" name="'.$htmlname.'">';
print '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
if ($addempty) print '<option value="0">&nbsp;</option>';
foreach($this->cache_availability as $id => $arrayavailability)
{
@ -4775,7 +4776,7 @@ class Form
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
*
* @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date (emptydate must be 0).
* @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
* @param string $prefix Prefix for fields name
* @param int $h 1 or 2=Show also hours (2=hours on a new line), -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show hour always empty
* @param int $m 1=Show also minutes, -1 has same effect but hour and minutes are prefilled with 23:59 if date is empty, 3 show minutes always empty
@ -4813,7 +4814,7 @@ class Form
}
// Analysis of the pre-selection date
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg))
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg)) // deprecated usage
{
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
$syear = (! empty($reg[1])?$reg[1]:'');
@ -5542,7 +5543,7 @@ class Form
/**
* Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL.
* Return a HTML select string, built from an array of key+value, but content returned into select come from an Ajax call of an URL.
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area
@ -5557,7 +5558,7 @@ class Form
* @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string
* @see ajax_combobox in ajax.lib.php
* @see selectArrayFilter, ajax_combobox in ajax.lib.php
*/
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{
@ -5618,7 +5619,7 @@ class Form
/* Code to execute a GET when we select a value */
$(".'.$htmlname.'").change(function() {
var selected = $(".'.$htmlname.'").val();
console.log("We select "+selected)
console.log("We select in selectArrayAjax the entry "+selected)
$(".'.$htmlname.'").val(""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) {
if (key == selected)
@ -5644,7 +5645,7 @@ class Form
}
/**
* Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL.
* Return a HTML select string, built from an array of key+value, but content returned into select is defined into $array parameter.
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area
@ -5659,7 +5660,7 @@ class Form
* @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string
* @see ajax_combobox in ajax.lib.php
* @see selectArrayAjax, ajax_combobox in ajax.lib.php
*/
static function selectArrayFilter($htmlname, $array, $id='', $moreparam='', $disableFiltering=0, $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{
@ -5708,8 +5709,9 @@ class Form
var urlBase = data.url;
var separ = urlBase.indexOf("?") >= 0 ? "&" : "?";
saveRemoteData[data.id].url = urlBase + separ + "sall=" + params.term;';
/* console.log("params.term="+params.term); */
/* console.log("params.term encoded="+encodeURIComponent(params.term)); */
saveRemoteData[data.id].url = urlBase + separ + "sall=" + encodeURIComponent(params.term);';
}
if(! $disableFiltering) {

View File

@ -64,7 +64,7 @@ class FormAccounting extends Form
*/
function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0)
{
global $conf;
global $conf,$langs;
$out = '';
@ -93,9 +93,10 @@ class FormAccounting extends Form
}
$selected = 0;
$langs->load('accountancy');
while ($obj = $this->db->fetch_object($resql))
{
$label = $obj->code . ' - ' . $obj->label;
$label = $obj->code . ' - ' . $langs->trans($obj->label);
$select_value_in = $obj->rowid;
$select_value_out = $obj->rowid;
@ -274,6 +275,7 @@ class FormAccounting extends Form
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity=".$conf->entity;
$sql .= " ORDER BY aa.account_number";
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);

View File

@ -609,7 +609,8 @@ class FormCompany
var method = obj.method;
var url = obj.url;
var htmlname = obj.htmlname;
console.log("Run runJsCodeForEvent-'.$htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
var showempty = obj.showempty;
console.log("Run runJsCodeForEvent-'.$htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
$.getJSON(url,
{
action: method,

View File

@ -541,7 +541,7 @@ class FormFile
$modellist=ModelePDFCards::liste_modeles($this->db);
}
}
elseif ($modulepart == 'agenda')
elseif ($modulepart == 'agenda' || $modulepart == 'actions')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
@ -581,7 +581,7 @@ class FormFile
$modellist=ModelePDFUserGroup::liste_modeles($this->db);
}
}
else //if ($modulepart != 'agenda')
else
{
// For normalized standard modules
$file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$modulepart.'.php',0);

View File

@ -632,7 +632,7 @@ class FormMail extends Form
if (! empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
{
$out.= '<tr><td>';
$out.= $langs->trans("MailToSalaries");
$out.= $langs->trans("MailToUsers");
$out.= '</td><td>';
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
@ -698,7 +698,7 @@ class FormMail extends Form
if (! empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
{
$out.= '<tr><td>';
$out.= $langs->trans("MailToCCSalaries");
$out.= $langs->trans("MailToCCUsers");
$out.= '</td><td>';
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
@ -1112,7 +1112,7 @@ class FormMail extends Form
elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); }
elseif ($type_template=='user') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); }
elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); }
$ret->label = 'default';
$ret->lang = $outputlangs->defaultlang;
$ret->topic = '';

View File

@ -213,7 +213,7 @@ function limitChars(textarea, limit, infodiv)
else
{
$sms = new stdClass();
$sms->error='The SMS manager '.$classfile.' defined into SMS setup MAIN_SMS_SENDMODE is not found';
$sms->error='The SMS manager "'.$classfile.'" defined into SMS setup MAIN_SMS_SENDMODE is not found';
}
}
catch(Exception $e)

View File

@ -124,6 +124,9 @@ class Menubase
else dol_print_error($this->db);
}
// TODO
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
$sql.= "menu_handler,";

View File

@ -542,7 +542,7 @@ class Translate
*/
private function getTradFromKey($key)
{
global $db;
global $conf, $db;
if (! is_string($key)) return 'ErrorBadValueForParamNotAString'; // Avoid multiple errors with code not using function correctly.
@ -576,6 +576,9 @@ class Translate
// TODO OrderSourceX must be replaced with content of table llx_c_input_reason or llx_c_input_method
//$newstr=$this->getLabelFromKey($db,$reg[1],'c_ordersource','code','label');
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) dol_syslog(__METHOD__." missing translation for key '".$newstr."' in ".$_SERVER["PHP_SELF"], LOG_DEBUG);
return $newstr;
}

View File

@ -118,3 +118,32 @@ function AssetsPrepareHead()
return $head;
}
/**
* Return array head with list of tabs to view object informations
*
* @param AssetType $object Asset
* @return array head
*/
function asset_type_prepare_head(AssetType $object)
{
global $langs, $conf, $user;
$h=0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/asset/type.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype');
complete_head_from_modules($conf,$langs,$object,$head,$h,'assettype','remove');
return $head;
}

View File

@ -1654,9 +1654,9 @@ function dol_format_address($object, $withcountry=0, $sep="\n", $outputlangs='',
}
else if (in_array($object->country_code,array('IT'))) // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
{
$ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
$ret .= ($object->departement_id?(' ('.($object->departement_id).')'):'');
$ret .= ($ret ? $sep : '' ).$object->zip;
$ret .= ($object->town?(($object->zip?' ':'').$object->town):'');
$ret .= ($object->departement_id?(' ('.($object->departement_id).')'):'');
}
else // Other: title firstname name \n address lines \n zip town \n country
{
@ -1668,7 +1668,11 @@ function dol_format_address($object, $withcountry=0, $sep="\n", $outputlangs='',
}
}
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country_code?($ret?$sep:'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
if ($withcountry)
{
$langs->load("dict");
$ret.=($object->country_code?($ret?$sep:'').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
}
return $ret;
}
@ -4672,7 +4676,8 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 2)
{
if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
//if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
if (! $mysoc->localtax2_assuj) return 0; // If main vat is 0, IRPF may be different than 0.
if ($thirdparty_seller->id == $mysoc->id)
{
if (! $thirdparty_buyer->localtax2_assuj) return 0;
@ -6181,7 +6186,7 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object
{
$module=$reg[1];
dol_syslog("Library functions_".$substitfile['name']." found into ".$dir);
dol_syslog("Library ".$substitfile['name']." found into ".$dir);
// Include the user's functions file
require_once $dir.$substitfile['name'];
// Call the user's function, and only if it is defined

View File

@ -169,6 +169,25 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
return $pdf;
}
/**
* Return if pdf file is protected/encrypted
*
* @param TCPDF $pdf PDF initialized object
* @param string $pathoffile Path of file
* @return boolean True or false
*/
function pdf_getEncryption(&$pdf, $pathoffile)
{
$isencrypted = false;
$pdfparser = $pdf->_getPdfParser($pathoffile);
$data = $pdfparser->getParsedData();
if (isset($data[0]['trailer'][1]['/Encrypt'])) {
$isencrypted = true;
}
return $isencrypted;
}
/**
* Return font name to use for PDF generation

View File

@ -104,10 +104,10 @@ function project_prepare_head($object)
$head[$h][2] = 'tasks';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id;
$head[$h][1] = $langs->trans("Gantt");
if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
$head[$h][2] = 'gantt';
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
$head[$h][1] = $langs->trans("TimeSpent");
//if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
$head[$h][2] = 'timespent';
$h++;
}

View File

@ -38,6 +38,7 @@ function dol_encode($chain, $key='1')
{
if (is_numeric($key) && $key == '1') // rule 1 is offset of 17 for char
{
$output_tab=array();
$strlength=dol_strlen($chain);
for ($i=0; $i < $strlength; $i++)
{
@ -75,6 +76,7 @@ function dol_decode($chain, $key='1')
if (is_numeric($key) && $key == '1') // rule 1 is offset of 17 for char
{
$output_tab=array();
$strlength=dol_strlen($chain);
for ($i=0; $i < $strlength;$i++)
{
@ -105,7 +107,7 @@ function dol_decode($chain, $key='1')
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorightm is something else than 'password_hash').
*
* @param string $chain String to hash
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO then md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @return string Hash of string
* @getRandomPassword
*/
@ -178,22 +180,23 @@ function dol_verifyHash($chain, $hash, $type='0')
*/
function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
{
global $db, $conf;
global $db, $conf;
global $hookmanager;
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>";
// If we use canvas, we try to use function that overlod restrictarea if provided with canvas
if (is_object($objcanvas))
{
if (method_exists($objcanvas->control,'restrictedArea')) return $objcanvas->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
}
// Get more permissions checks from hooks
$parameters=array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select);
$reshook=$hookmanager->executeHooks('restrictedArea',$parameters);
if (! empty($hookmanager->resArray['result'])) return true;
if ($reshook > 0) return false;
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
// Features/modules to check
// Features/modules to check
$featuresarray = array($features);
if (preg_match('/&/', $features)) $featuresarray = explode("&", $features);
else if (preg_match('/\|/', $features)) $featuresarray = explode("|", $features);
@ -331,7 +334,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
// Check create user permission
$createuserok=1;
if (GETPOST('action','aZ09') == 'confirm_create_user' && GETPOST("confirm") == 'yes')
if (GETPOST('action','aZ09') == 'confirm_create_user' && GETPOST("confirm",'aZ09') == 'yes')
{
if (! $user->rights->user->user->creer) $createuserok=0;
@ -341,7 +344,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
// Check delete permission from module
$deleteok=1; $nbko=0;
if ((GETPOST('action','aZ09') == 'confirm_delete' && GETPOST("confirm") == 'yes') || GETPOST('action','aZ09') == 'delete')
if ((GETPOST("action","aZ09") == 'confirm_delete' && GETPOST("confirm","aZ09") == 'yes') || GETPOST("action","aZ09") == 'delete')
{
foreach ($featuresarray as $feature)
{
@ -408,8 +411,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
// is linked to a company allowed to $user.
if (! empty($objectid) && $objectid > 0)
{
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
return $ok ? 1 : accessforbidden();
$ok = checkUserAccessToObject($user, $featuresarray, $objectid, $tableandshare, $feature2, $dbt_keyfield, $dbt_select);
return $ok ? 1 : accessforbidden();
}
return 1;
@ -447,7 +450,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
if ($feature == 'project') $feature='projet';
if ($feature == 'task') $feature='projet_task';
$check = array('adherent','banque','don','user','usergroup','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company)
$check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object

View File

@ -580,7 +580,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$paymentfacturetable='paiement_facture';
$invoicefieldref='facnumber';
}
if ($direction == 'buy')
else
{
$invoicetable='facture_fourn';
$invoicedettable='facture_fourn_det';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -699,7 +700,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
//if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
}
}
/*
@ -806,7 +806,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->facture->creer);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("List"),1,$user->rights->facture->lire, '', $mainmenu, 'customers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|draft|notpaid|paid|canceled)$/', $leftmenu))
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu))
{
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&amp;search_status=0",$langs->trans("BillShortStatusDraft"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&amp;search_status=1",$langs->trans("BillShortStatusNotPaid"),2,$user->rights->facture->lire);
@ -1069,7 +1069,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($nature)
{
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, dol_trunc($objp->label,25), 2, $user->rights->accounting->comptarapport->lire);
$langs->load('accountancy');
$newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $langs->trans($objp->label), 2, $user->rights->accounting->comptarapport->lire);
}
$i++;
}
@ -1102,6 +1103,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report", $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire);
}
// Accountancy (simple)
@ -1130,6 +1132,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=report",$langs->trans("ByCompanies"),2,$user->rights->compta->resultat->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"),2,$user->rights->compta->resultat->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report", $langs->trans("ByVatRate"),2,$user->rights->compta->resultat->lire);
// Journaux
//if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire);
@ -1142,11 +1145,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("assets");
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy",$langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset');
$newmenu->add("/asset/card.php?leftmenu=asset&amp;action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
$newmenu->add("/asset/type.php?leftmenu=asset",$langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
$newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create",$langs->trans("MenuNewTypeAssets"), 1, $user->rights->asset->write);
$newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuListTypeAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/list.php?leftmenu=asset",$langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/card.php?action=create",$langs->trans("MenuNewAsset"), 1, $user->rights->asset->write);
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy",$langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/',$leftmenu)) $newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create",$langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->write);
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/',$leftmenu)) $newmenu->add("/asset/type.php?leftmenu=asset_type",$langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read);
}
}
@ -1281,18 +1284,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->stock->enabled))
{
$langs->load("stocks");
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
}
else
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->advance_inventory->read, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->advance_inventory->write);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->advance_inventory->read);
}
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
}
else
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read);
}
}
}

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