Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into 7.0_new_shipment_update
This commit is contained in:
commit
7f7e621ea9
@ -313,13 +313,13 @@ script:
|
|||||||
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log
|
||||||
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
|
||||||
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
php upgrade.php 4.0.0 5.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade400500.log
|
||||||
php upgrade2.php 4.0.0 5.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
php upgrade2.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||||
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
php step5.php 4.0.0 5.0.0 > $TRAVIS_BUILD_DIR/upgrade400500-3.log
|
||||||
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
php upgrade.php 5.0.0 6.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||||
php upgrade2.php 5.0.0 6.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
php upgrade2.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||||
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
php step5.php 5.0.0 6.0.0 > $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||||
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
php upgrade.php 6.0.0 7.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade600700.log
|
||||||
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
php upgrade2.php 6.0.0 7.0.0 MAIN_MODULE_WEBSITE > $TRAVIS_BUILD_DIR/upgrade600700-2.log
|
||||||
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
php step5.php 6.0.0 7.0.0 > $TRAVIS_BUILD_DIR/upgrade600700-3.log
|
||||||
cd -
|
cd -
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
10
COPYRIGHT
10
COPYRIGHT
@ -34,12 +34,11 @@ Swift Mailer 5.4.2-DEV MIT license Yes
|
|||||||
Stripe 4.7.0 MIT licence Yes Library for Stripe module
|
Stripe 4.7.0 MIT licence Yes Library for Stripe module
|
||||||
|
|
||||||
JS libraries:
|
JS libraries:
|
||||||
jQuery 1.11.3 MIT License Yes JS library
|
jQuery 3.1.1 MIT License Yes JS library
|
||||||
jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||||
jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect
|
jQuery select2 4.0.4 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
|
||||||
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
||||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||||
@ -49,8 +48,7 @@ jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes
|
|||||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
||||||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||||
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
|
jsGanttImproved 1.7.5.4 BSD License Yes JS library (to build Gantt reports)
|
||||||
jsGanttImproved 1.7.5.2 BSD License Yes JS library (to build Gantt reports)
|
|
||||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||||
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
|
|||||||
@ -23,6 +23,9 @@ Following changes may create regressions for some external modules, but were nec
|
|||||||
follow page naming conventions (so default filter/sort order features can also work).
|
follow page naming conventions (so default filter/sort order features can also work).
|
||||||
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED
|
* The trigger ORDER_SUPPLIER_STATUS_ONPROCESS was renamed into ORDER_SUPPLIER_STATUS_ORDERED
|
||||||
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY
|
* The trigger ORDER_SUPPLIER_STATUS_RECEIVED_ALL was renamed into ORDER_SUPPLIER_STATUS_RECEIVED_COMPLETELY
|
||||||
|
* The parameter note into method cloture() is added at end of private note (previously in v6, it replaced)
|
||||||
|
* The parameter $user is now mandatory for method createFromOrder and createFromPropal.
|
||||||
|
* Remove js library fileupload that was not used by core code.
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
***** ChangeLog for 6.0.2 compared to 6.0.1 *****
|
||||||
|
|||||||
@ -82,7 +82,13 @@ with
|
|||||||
// LDR To open in same window
|
// LDR To open in same window
|
||||||
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
|
//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
|
||||||
window.location.href=pRef
|
window.location.href=pRef
|
||||||
* Replace hard coded string with i18n["String"];
|
|
||||||
|
* Replace
|
||||||
|
vTmpDiv=this.newNode(vTmpCell, 'div', null, null, vTaskList[i].getResource());
|
||||||
|
with
|
||||||
|
var vTmpNode=this.newNode(vTmpCell, 'div', null, '');
|
||||||
|
vTmpNode=this.newNode(vTmpNode, 'a', null, '', vLangs[vLang]['moreinfo']);
|
||||||
|
vTmpNode.setAttribute('href',vTaskList[i].getLink());
|
||||||
|
|
||||||
|
|
||||||
JCROP:
|
JCROP:
|
||||||
|
|||||||
133
dev/resources/sepa/test.xml
Normal file
133
dev/resources/sepa/test.xml
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<CstmrDrctDbtInitn>
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>PREL20171012/REF10</MsgId>
|
||||||
|
<CreDtTm>2017-10-12T00:08:30</CreDtTm>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>PREL20171012/ID00010-T171001</PmtInfId>
|
||||||
|
<PmtMtd>DD</PmtMtd>
|
||||||
|
<NbOfTxs>2</NbOfTxs>
|
||||||
|
<CtrlSum>734.4</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
<LclInstrm>
|
||||||
|
<Cd>CORE</Cd>
|
||||||
|
</LclInstrm>
|
||||||
|
<SeqTp>RCUR</SeqTp>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdColltnDt>2017-10-12</ReqdColltnDt>
|
||||||
|
<Cdtr>
|
||||||
|
<Nm>MyBigCompany</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Address1</AdrLine>
|
||||||
|
<AdrLine>Address2</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICABCDEF</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<ChrgBr>SLEV</ChrgBr>
|
||||||
|
<CdtrSchmeId>
|
||||||
|
<Id>
|
||||||
|
<PrvtId>
|
||||||
|
<Othr>
|
||||||
|
<Id>FR76AAAAA</Id>
|
||||||
|
<SchmeNm>
|
||||||
|
<Prtry>SEPA</Prtry>
|
||||||
|
</SchmeNm>
|
||||||
|
</Othr>
|
||||||
|
</PrvtId>
|
||||||
|
</Id>
|
||||||
|
</CdtrSchmeId>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0416-000679</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">540</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1610-0001-3-1476058417</MndtId>
|
||||||
|
<DtOfSgntr>2016-10-10</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICXYZ</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER A</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
<AdrLine>Mr abc</AdrLine>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0416</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
<DrctDbtTxInf>
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>AS-FA1710-0415-000683</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<InstdAmt Ccy="EUR">194.4</InstdAmt>
|
||||||
|
<DrctDbtTx>
|
||||||
|
<MndtRltdInf>
|
||||||
|
<MndtId>RUM-CU1709-0011-4-1506525346</MndtId>
|
||||||
|
<DtOfSgntr>2017-09-27</DtOfSgntr>
|
||||||
|
<AmdmntInd>false</AmdmntInd>
|
||||||
|
</MndtRltdInf>
|
||||||
|
</DrctDbtTx>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>BICJKL</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>CUSTOMER2</Nm>
|
||||||
|
<PstlAdr>
|
||||||
|
<Ctry>FR</Ctry>
|
||||||
|
</PstlAdr>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>FR76123456</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<Ustrd>FA1710-0415</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</DrctDbtTxInf>
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrDrctDbtInitn>
|
||||||
|
</Document>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -67,8 +67,8 @@ $arrayfields=array(
|
|||||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0),
|
||||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -105,11 +105,29 @@ if (empty($reshook))
|
|||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('change_chart'))
|
if (GETPOST('change_chart','alpha'))
|
||||||
{
|
{
|
||||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||||
|
|
||||||
if (! empty($chartofaccounts)) {
|
if ($chartofaccounts > 0)
|
||||||
|
{
|
||||||
|
// Get language code for this $chartofaccounts
|
||||||
|
$sql ='SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a';
|
||||||
|
$sql.=' WHERE c.rowid = a.fk_country AND a.rowid = '.(int) $chartofaccounts;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$country_code = $obj->code;
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
// Try to load sql file
|
||||||
|
if ($country_code)
|
||||||
|
{
|
||||||
|
$sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql';
|
||||||
|
$result = run_sql($sqlfile, 1, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||||
$error++;
|
$error++;
|
||||||
@ -216,25 +234,29 @@ if ($resql)
|
|||||||
// Box to select active chart of account
|
// Box to select active chart of account
|
||||||
print $langs->trans("Selectchartofaccounts") . " : ";
|
print $langs->trans("Selectchartofaccounts") . " : ";
|
||||||
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
print '<select class="flat" name="chartofaccounts" id="chartofaccounts">';
|
||||||
$sql = "SELECT rowid, pcg_version, label, active";
|
$sql = "SELECT a.rowid, a.pcg_version, a.label, a.active, c.code as country_code";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
|
||||||
$sql .= " WHERE active = 1";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON a.fk_country = c.rowid";
|
||||||
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
|
$sql .= " WHERE a.active = 1";
|
||||||
|
dol_syslog('accountancy/admin/account.php $sql='.$sql);
|
||||||
|
print $sql;
|
||||||
$resqlchart = $db->query($sql);
|
$resqlchart = $db->query($sql);
|
||||||
if ($resqlchart) {
|
if ($resqlchart) {
|
||||||
$numbis = $db->num_rows($resqlchart);
|
$numbis = $db->num_rows($resqlchart);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $numbis) {
|
while ($i < $numbis) {
|
||||||
$row = $db->fetch_row($resqlchart);
|
$obj = $db->fetch_object($resqlchart);
|
||||||
|
|
||||||
print '<option value="' . $row[0] . '"';
|
print '<option value="' . $obj->rowid . '"';
|
||||||
print $pcgver == $row[0] ? ' selected' : '';
|
print ($pcgver == $obj->rowid) ? ' selected' : '';
|
||||||
print '>' . $row[1] . ' - ' . $row[2] . '</option>';
|
print '>' . $obj->pcg_version . ' - ' . $obj->label . ' - (' . $obj->country_code . ')</option>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
print "</select>";
|
print "</select>";
|
||||||
|
print ajax_combobox("chartofaccounts");
|
||||||
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
print '<input type="submit" class="button" name="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -41,14 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
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 . '/core/class/html.formaccounting.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm"));
|
||||||
$langs->load("admin");
|
|
||||||
$langs->load("main");
|
|
||||||
$langs->load("companies");
|
|
||||||
$langs->load("resource");
|
|
||||||
$langs->load("holiday");
|
|
||||||
$langs->load("accountancy");
|
|
||||||
$langs->load("hrm");
|
|
||||||
|
|
||||||
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
|
||||||
$confirm=GETPOST('confirm','alpha');
|
$confirm=GETPOST('confirm','alpha');
|
||||||
@ -100,7 +93,7 @@ $tablib[32]= "DictionaryAccountancyCategory";
|
|||||||
|
|
||||||
// Requests to extract data
|
// Requests to extract data
|
||||||
$tabsql=array();
|
$tabsql=array();
|
||||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
|
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
|
||||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||||
|
|
||||||
// Criteria to sort dictionaries
|
// Criteria to sort dictionaries
|
||||||
@ -110,17 +103,17 @@ $tabsqlsort[32]="position ASC";
|
|||||||
|
|
||||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||||
$tabfield=array();
|
$tabfield=array();
|
||||||
$tabfield[31]= "pcg_version,label";
|
$tabfield[31]= "pcg_version,label,country_id,country";
|
||||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||||
|
|
||||||
// Nom des champs d'edition pour modification d'un enregistrement
|
// Nom des champs d'edition pour modification d'un enregistrement
|
||||||
$tabfieldvalue=array();
|
$tabfieldvalue=array();
|
||||||
$tabfieldvalue[31]= "pcg_version,label";
|
$tabfieldvalue[31]= "pcg_version,label,country";
|
||||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||||
|
|
||||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||||
$tabfieldinsert=array();
|
$tabfieldinsert=array();
|
||||||
$tabfieldinsert[31]= "pcg_version,label";
|
$tabfieldinsert[31]= "pcg_version,label,fk_country";
|
||||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||||
|
|
||||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||||
@ -173,7 +166,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=1;
|
$ok=1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancysystem','DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
if ($value == 'country_id' && in_array($tablib[$id],array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancyCategory','Pcg_version'))) continue; // For some pages, country is not mandatory
|
||||||
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
if ($value == 'country' && in_array($tablib[$id],array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||||
@ -188,6 +181,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok=0;
|
$ok=0;
|
||||||
$fieldnamekey=$listfield[$f];
|
$fieldnamekey=$listfield[$f];
|
||||||
// We take translate key of field
|
// We take translate key of field
|
||||||
|
|
||||||
|
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
|
||||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||||
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';
|
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';
|
||||||
|
|||||||
@ -569,6 +569,7 @@ if ($id)
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
$colspan=count($fieldlist)+3;
|
$colspan=count($fieldlist)+3;
|
||||||
|
if ($id == 32) $colspan++;
|
||||||
|
|
||||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ $list_account = array (
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
|
|
||||||
if (GETPOST('change_chart'))
|
if (GETPOST('change_chart'))
|
||||||
|
|||||||
@ -60,7 +60,7 @@ $list = array (
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|||||||
@ -25,7 +25,6 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief Onglet de gestion de parametrages des ventilations
|
* \brief Onglet de gestion de parametrages des ventilations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||||
@ -44,14 +43,34 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == - 1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "")
|
||||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
$sortorder = "DESC";
|
||||||
|
if ($sortfield == "")
|
||||||
|
$sortfield = "bk.doc_date";
|
||||||
|
|
||||||
$search_year = GETPOST ( "search_year" );
|
$search_year = GETPOST("search_year", 'int');
|
||||||
|
$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
||||||
|
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
||||||
|
|
||||||
|
$lettering = GETPOST('lettering');
|
||||||
|
if (! empty($lettering)) {
|
||||||
|
$action = $lettering;
|
||||||
|
}
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
// Did we click on purge search criteria ?
|
||||||
|
// All tests are required to be compatible with all browsers
|
||||||
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||||
|
$search_year = '';
|
||||||
|
$search_doc_type = '';
|
||||||
|
$search_doc_ref = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid", 'int');
|
$socid = GETPOST("socid", 'int');
|
||||||
@ -59,27 +78,26 @@ $socid = GETPOST("socid",'int');
|
|||||||
|
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessage($object->error, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$BookKeeping = new lettering($db);
|
$BookKeeping = new lettering($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
$result = $BookKeeping->updateLettrage($toselect);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors');
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,18 +105,14 @@ if ($action == 'autolettrage') {
|
|||||||
|
|
||||||
$result = $BookKeeping->lettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if( $result < 0 )
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors');
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxHeader('', 'Compta - Grand Livre');
|
llxHeader('', 'Compta - Grand Livre');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
*/
|
*/
|
||||||
@ -106,10 +120,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
||||||
|
|
||||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
dol_fiche_head($head, 'accounting', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
||||||
@ -122,11 +133,11 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="nowrap">' . $langs->trans("CustomerCode") . '</td><td colspan="3">';
|
print '<td class="nowrap">' . $langs->trans("CustomerCode") . '</td><td colspan="3">';
|
||||||
print $object->code_client;
|
print $object->code_client;
|
||||||
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
if ($object->check_codeclient() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -139,7 +150,6 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
||||||
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||||
@ -153,89 +163,97 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
||||||
// $img=picto_from_langcode($object->country_code);
|
// $img=picto_from_langcode($object->country_code);
|
||||||
$img = '';
|
$img = '';
|
||||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
if ($object->isInEEC())
|
||||||
else print ($img?$img.' ':'').$object->country;
|
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||||
|
else
|
||||||
|
print ($img ? $img . ' ' : '') . $object->country;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
|
$sql .= " bk.thirdparty_code, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER. "' )" ;
|
$sql .= " WHERE (bk.thirdparty_code = '" . $object->code_compta . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . "' )";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dol_strlen($search_year)) {
|
if (dol_strlen($search_year)) {
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||||
|
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||||
|
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($date_start) . "' AND '" . $db->idate($date_end) . "' )";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
$sql .= " ORDER BY bk.lettering_code ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
|
||||||
|
|
||||||
// echo $sql;
|
|
||||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
|
||||||
$resql = $db->query ( $sql );
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
|
|
||||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="action" value="lettering">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<td></td>';
|
|
||||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
|
||||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
|
||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
|
||||||
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
|
||||||
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
|
||||||
// print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
|
||||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print '<form action="" method="GET">';
|
|
||||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
|
||||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
|
||||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
// print '<td> </td>';
|
|
||||||
// print '<td> </td>';
|
|
||||||
print '<td align="right">';
|
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</form>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
$var = false;
|
|
||||||
|
|
||||||
$debit = 0;
|
$debit = 0;
|
||||||
$credit = 0;
|
$credit = 0;
|
||||||
$solde = 0;
|
$solde = 0;
|
||||||
|
// Count total nb of records and calc total sum
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
|
||||||
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
|
$debit += $obj->debit;
|
||||||
|
$credit += $obj->credit;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
|
||||||
|
if ($resql) {
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print '<td></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||||
|
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||||
|
print '<td colspan="7"> </td>';
|
||||||
|
print '<td align="right">';
|
||||||
|
$searchpicto = $form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
$var = false;
|
||||||
|
$solde = 0;
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
while ( $i < $num ) {
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp))
|
if ($tmp != $obj->lettering_code || empty($tmp))
|
||||||
$tmp = $obj->lettering_code;
|
$tmp = $obj->lettering_code;
|
||||||
@ -243,88 +261,59 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
|
|
||||||
$debit+= $obj->debit;
|
|
||||||
$credit+= $obj->credit;
|
|
||||||
|
|
||||||
$solde += ($obj->credit - $obj->debit);
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
print '<td>' . $obj->rowid . '</td>';
|
|
||||||
if (empty($obj->lettering_code)) {
|
if (empty($obj->lettering_code)) {
|
||||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
// print '<td>' . $obj->numero_compte . '</td>';
|
|
||||||
// print '<td>' . $obj->code_tiers . '</td>';
|
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
print '<td>' . $obj->debit . '</td>';
|
print '<td>' . price($obj->debit) . '</td>';
|
||||||
print '<td>' . $obj->credit . '</td>';
|
print '<td>' . price($obj->credit) . '</td>';
|
||||||
// print '<td>' . $obj->montant . '</td>';
|
print '<td>' . price($obj->montant) . '</td>';
|
||||||
// print '<td>' . $obj->sens . '</td>';
|
print '<td>' . $obj->sens . '</td>';
|
||||||
print '<td>' . $obj->code_journal . '</td>';
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
print '<td>' . round($solde, 2) . '</td>';
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
if (empty($obj->lettering_code)) {
|
if (empty($obj->lettering_code)) {
|
||||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
print '<td>' . $obj->lettering_code . '</td>';
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i ++;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
print '<td></td>';
|
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||||
// print '<td></td>';
|
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||||
// print '<td></td>';
|
print '<td colspan="5"></td>';
|
||||||
print '<td><strong>' . $debit . '</strong></td>';
|
|
||||||
print '<td><strong>' . $credit . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||||
// print '<td></td>';
|
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
// print '<td></td>';
|
print '<td colspan="5"></td>';
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '<input class="butAction" type="submit" value="lettering">';
|
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=autolettrage">' . $langs->trans('AccountancyAutoLettering') . '</a>';
|
||||||
print "</form>";
|
print "</form>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -35,7 +35,6 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||||
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$massaction = GETPOST('massaction', 'alpha');
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
$show_files = GETPOST('show_files', 'int');
|
$show_files = GETPOST('show_files', 'int');
|
||||||
@ -46,14 +45,35 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
|||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
$page = GETPOST("page", 'int');
|
$page = GETPOST("page", 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == - 1) {
|
||||||
|
$page = 0;
|
||||||
|
} // If $page is not defined, or '' or -1
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
if ($sortorder == "") $sortorder = "ASC";
|
if ($sortorder == "")
|
||||||
if ($sortfield == "") $sortfield = "bk.rowid";
|
$sortorder = "DESC";
|
||||||
|
if ($sortfield == "")
|
||||||
|
$sortfield = "bk.doc_date";
|
||||||
|
|
||||||
$search_year = GETPOST ( "search_year" );
|
$search_year = GETPOST("search_year",'int');
|
||||||
|
$search_doc_type = GETPOST("search_doc_type",'alpha');
|
||||||
|
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
||||||
|
|
||||||
|
$lettering = GETPOST('lettering');
|
||||||
|
if (!empty($lettering)) {
|
||||||
|
$action=$lettering;
|
||||||
|
}
|
||||||
|
$toselect = GETPOST('toselect','array');
|
||||||
|
|
||||||
|
// Did we click on purge search criteria ?
|
||||||
|
// All tests are required to be compatible with all browsers
|
||||||
|
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha'))
|
||||||
|
{
|
||||||
|
$search_year='';
|
||||||
|
$search_doc_type='';
|
||||||
|
$search_doc_ref='';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -62,25 +82,26 @@ $socid = GETPOST("socid",'int');
|
|||||||
|
|
||||||
$object = new Societe($db);
|
$object = new Societe($db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$result = $object->fetch($socid);
|
||||||
|
if ($result<0) {
|
||||||
|
setEventMessage($object->error,'errors');
|
||||||
|
}
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$BookKeeping = new lettering($db);
|
$BookKeeping = new lettering($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
$formaccounting = new FormAccounting($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action
|
* Action
|
||||||
*/
|
*/
|
||||||
if ($action == 'lettering') {
|
if ($action == 'lettering') {
|
||||||
|
|
||||||
$result = $BookKeeping->updatelettrage($_POST['ids']);
|
$result = $BookKeeping->updateLettrage($toselect);
|
||||||
|
|
||||||
// var_dump($result);
|
// var_dump($result);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors');
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,16 +109,24 @@ if ($action == 'autolettrage') {
|
|||||||
|
|
||||||
$result = $BookKeeping->lettrageTiers($socid);
|
$result = $BookKeeping->lettrageTiers($socid);
|
||||||
|
|
||||||
if ( $result < 0 )
|
if ($result < 0) {
|
||||||
{
|
|
||||||
setEventMessages('', $BookKeeping->errors, 'errors');
|
setEventMessages('', $BookKeeping->errors, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title = 'AccountancyLettrage';
|
||||||
|
|
||||||
llxHeader ( '', 'Compta - Grand Livre' );
|
llxHeader('', $title);
|
||||||
|
|
||||||
|
|
||||||
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if (!empty($search_year)) $param.='&search_year='.$search_year;
|
||||||
|
if (!empty($socid)) $param.='&socid='.$socid;
|
||||||
|
if (!empty($search_doc_type)) $param.='&search_doc_type='.$search_doc_type;
|
||||||
|
if (!empty($search_doc_ref)) $param.='&search_doc_ref='.$search_doc_ref;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -107,10 +136,7 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
||||||
|
|
||||||
dol_fiche_head($head, 'TabAccounting', $langs->trans("ThirdParty"),0,'company');
|
dol_fiche_head($head, 'accounting_supplier', $langs->trans("ThirdParty"), 0, 'company');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<table width="100%" class="border">';
|
print '<table width="100%" class="border">';
|
||||||
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
|
||||||
@ -123,11 +149,11 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="nowrap">' . $langs->trans("SupplierCode") . '</td><td colspan="3">';
|
print '<td class="nowrap">' . $langs->trans("SupplierCode") . '</td><td colspan="3">';
|
||||||
print $object->code_fournisseur;
|
print $object->code_fournisseur;
|
||||||
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
if ($object->check_codefournisseur() != 0)
|
||||||
|
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -140,7 +166,6 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
// Address
|
// Address
|
||||||
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
|
||||||
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
|
||||||
@ -154,182 +179,161 @@ llxHeader ( '', 'Compta - Grand Livre' );
|
|||||||
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
|
||||||
// $img=picto_from_langcode($object->country_code);
|
// $img=picto_from_langcode($object->country_code);
|
||||||
$img = '';
|
$img = '';
|
||||||
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
|
if ($object->isInEEC())
|
||||||
else print ($img?$img.' ':'').$object->country;
|
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
|
||||||
|
else
|
||||||
|
print ($img ? $img . ' ' : '') . $object->country;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
// print_r($soc);
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
// exit;
|
$sql .= " bk.thirdparty_code, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
// [code_compta] => 411DOUA
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
||||||
// [code_compta_fournisseur] => 401SUPPCODE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Mode Liste
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
$sql .= " WHERE (bk.code_tiers = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" .$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER. "' )" ;
|
$sql .= " WHERE (bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (dol_strlen($search_year)) {
|
if (dol_strlen($search_year)) {
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $search_year . "-0-0' AND '" . ($search_year+1). "-0-0' )";
|
$date_start = dol_mktime(0, 0, 0, 1, 1, $search_year);
|
||||||
|
$date_end = dol_mktime(23, 59, 59, 12, 31, $search_year);
|
||||||
|
$sql .= " AND ( bk.doc_date BETWEEN '".$db->idate($date_start)."' AND '".$db->idate($date_end)."' )";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
$sql .= " ORDER BY bk.lettering ASC, bk.doc_date ASC" ;//. $db->plimit ( $conf->liste_limit + 1, $offset );
|
$debit = 0;
|
||||||
|
$credit = 0;
|
||||||
|
$solde = 0;
|
||||||
|
// Count total nb of records and calc total sum
|
||||||
|
$nbtotalofrecords = '';
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
|
|
||||||
// echo $sql;
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
// dol_syslog ( "bookkeping:liste:create sql=" . $sql, LOG_DEBUG );
|
$debit += $obj->debit;
|
||||||
|
$credit += $obj->credit;
|
||||||
|
|
||||||
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql)
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
dol_syslog ( "/accountancy/bookkeeping/thirdparty_lettrage_supplier.php", LOG_DEBUG );
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '" method="POST">';
|
||||||
print '<form name="add" action="?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="action" value="lettering">';
|
|
||||||
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
print '<input type="hidden" name="socid" value="' . $object->id . '">';
|
||||||
|
|
||||||
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||||
|
|
||||||
print "<table class=\"noborder\" width=\"100%\">";
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td></td>';
|
print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
|
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
|
print_liste_field_titre("Docref", $_SERVER["PHP_SELF"], "bk.doc_ref","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
|
print_liste_field_titre("Labelcompte", $_SERVER["PHP_SELF"], "bk.label_compte","",$param,"",$sortfield,$sortorder);
|
||||||
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit","",$param,"",$sortfield,$sortorder);
|
||||||
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("LabelAccount", "liste.php", "bk_label_compte" );
|
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "bk.montant","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
|
print_liste_field_titre("Sens", $_SERVER["PHP_SELF"], "bk.sens","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
|
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
|
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre("Sens", "liste.php", "bk.sens" );
|
|
||||||
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<form action="" method="GET">';
|
print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
||||||
print '<input type="hidden" name="socid" value="' . $_GET ["socid"] . '">';
|
print '<td><input type="text" name="search_year" value="' . $search_year . '"></td>';
|
||||||
print '<td><input type="text" name="search_doc_type" value="' . $_GET ["search_doc_type"] . '"></td>';
|
print '<td><input type="text" name="search_doc_refe" value="' . $search_doc_ref . '"></td>';
|
||||||
print '<td><input type="text" name="search_year" value="' . $_GET ["search_year"] . '"></td>';
|
print '<td colspan="7"> </td>';
|
||||||
print '<td><input type="text" name="search_doc_refe" value="' . $_GET ["search_doc_ref"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_compte" value="' . $_GET ["search_compte"] . '"></td>';
|
|
||||||
// print '<td><input type="text" name="search_tiers" value="' . $_GET ["search_tiers"] . '"></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" value="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '" title="' . dol_escape_htmltag ( $langs->trans ( "Search" ) ) . '">';
|
$searchpicto=$form->showFilterButtons();
|
||||||
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print '</form>';
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = false;
|
$var = false;
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
$solde = 0;
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
while ( $i < $num ) {
|
while ($obj = $db->fetch_object($resql)) {
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
|
|
||||||
if($tmp !=$obj->lettering || empty($tmp) )
|
if ($tmp != $obj->lettering_code || empty($tmp))
|
||||||
$tmp =$obj->lettering;
|
$tmp = $obj->lettering_code;
|
||||||
|
|
||||||
if($tmp !=$obj->lettering || empty($obj->lettering))
|
if ($tmp != $obj->lettering_code || empty($obj->lettering_code))
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
|
|
||||||
$debit+= $obj->debit;
|
|
||||||
$credit+= $obj->credit;
|
|
||||||
|
|
||||||
$solde += ($obj->credit - $obj->debit);
|
$solde += ($obj->credit - $obj->debit);
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
print '<td>' . $obj->rowid . '</td>';
|
if (empty($obj->lettering_code)) {
|
||||||
if(empty($obj->lettering)){
|
|
||||||
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
print '<td><a href="' . dol_buildpath('/accountancy/bookkeeping/card.php', 1) . '?piece_num=' . $obj->piece_num . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
print '</a> ' . $obj->doc_type . '</td>' . "\n";
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
print '<td>' . $obj->doc_type . '</td>' . "\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
// print '<td>' . $obj->numero_compte . '</td>';
|
|
||||||
// print '<td>' . $obj->code_tiers . '</td>';
|
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
print '<td>' . $obj->debit . '</td>';
|
print '<td>' . price($obj->debit) . '</td>';
|
||||||
print '<td>' . $obj->credit . '</td>';
|
print '<td>' . price($obj->credit) . '</td>';
|
||||||
print '<td>' . $obj->montant . '</td>';
|
print '<td>' . price($obj->montant) . '</td>';
|
||||||
print '<td>' . $obj->sens . '</td>';
|
print '<td>' . $obj->sens . '</td>';
|
||||||
print '<td>' . $obj->code_journal . '</td>';
|
print '<td>' . $obj->code_journal . '</td>';
|
||||||
print '<td>' . round($solde, 2) . '</td>';
|
print '<td>' . round($solde, 2) . '</td>';
|
||||||
|
|
||||||
if(empty($obj->lettering)){
|
if (empty($obj->lettering_code)) {
|
||||||
print '<td><input type="checkbox" name="ids[]" value="' . $obj->rowid . '" /></td>';
|
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
}
|
} else
|
||||||
else
|
print '<td>' . $obj->lettering_code . '</td>';
|
||||||
print '<td>' . $obj->lettering . '</td>';
|
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$i ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
print '<td colspan="4">Mouvement totaux</td>' . "\n";
|
||||||
print '<td></td>';
|
print '<td><strong>' . price($debit) . '</strong></td>';
|
||||||
print '<td></td>';
|
print '<td><strong>' . price($credit) . '</strong></td>';
|
||||||
print '<td></td>';
|
print '<td colspan="5"></td>';
|
||||||
print '<td><strong>' . $debit . '</strong></td>';
|
|
||||||
print '<td><strong>' . $credit . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="5">Solde Comptable</td>' . "\n";
|
print '<td colspan="9">Solde Comptable</td>' . "\n";
|
||||||
print '<td></td>';
|
print '<td><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
print '<td></td>';
|
print '<td colspan="5"></td>';
|
||||||
print '<td></td>';
|
|
||||||
print '<td><strong>' . ($credit-$debit) . '</strong></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td></td>';
|
|
||||||
print '<td> </td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '<input class="butAction" type="submit" value="lettering">';
|
print '<input class="butAction" type="submit" value="lettering" name="lettering" id="lettering">';
|
||||||
print '<a class="butAction" href="?socid='.$object->id.'&action=autolettrage">auto lettering</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid=' . $object->id . '&action=autolettrage">'.$langs->trans('AccountancyAutoLettering').'</a>';
|
||||||
print "</form>";
|
print "</form>";
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -279,7 +279,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ', entity';
|
$sql .= ', entity';
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||||
$sql .= ",'" . $this->db->idate($this->date_lim_reglement) . "'";
|
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'");
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||||
$sql .= "," . $this->fk_doc;
|
$sql .= "," . $this->fk_doc;
|
||||||
@ -1079,8 +1079,12 @@ class BookKeeping extends CommonObject
|
|||||||
* @param string $mode Mode
|
* @param string $mode Mode
|
||||||
* @return number <0 if KO, >0 if OK
|
* @return number <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function updateByMvt($piece_num='', $field='', $value='', $mode='') {
|
public function updateByMvt($piece_num='', $field='', $value='', $mode='')
|
||||||
|
{
|
||||||
|
$error=0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . $mode . " as ab";
|
||||||
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'");
|
$sql .= ' SET ab.' . $field . '=' . (is_numeric($value)?$value:"'".$value."'");
|
||||||
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
$sql .= ' WHERE ab.piece_num=' . $piece_num ;
|
||||||
@ -1521,11 +1525,16 @@ class BookKeeping extends CommonObject
|
|||||||
* @param string $piece_num Piece num
|
* @param string $piece_num Piece num
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function transformTransaction($direction=0,$piece_num='') {
|
public function transformTransaction($direction=0,$piece_num='')
|
||||||
|
{
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
if ($direction==0) {
|
|
||||||
|
if ($direction==0)
|
||||||
|
{
|
||||||
$next_piecenum=$this->getNextNumMvt();
|
$next_piecenum=$this->getNextNumMvt();
|
||||||
if ($result < 0) {
|
if ($next_piecenum < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
||||||
|
|||||||
@ -22,12 +22,10 @@
|
|||||||
* \ingroup Advanced accountancy
|
* \ingroup Advanced accountancy
|
||||||
* \brief File of class for lettering
|
* \brief File of class for lettering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
|
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
|
||||||
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
|
include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class lettering
|
* Class lettering
|
||||||
*/
|
*/
|
||||||
@ -37,268 +35,247 @@ class lettering extends BookKeeping
|
|||||||
* lettrageTiers
|
* lettrageTiers
|
||||||
*
|
*
|
||||||
* @param int $socid Thirdparty id
|
* @param int $socid Thirdparty id
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function lettrageTiers($socid) {
|
public function lettrageTiers($socid) {
|
||||||
|
|
||||||
$db = $this->db;
|
$db = $this->db;
|
||||||
|
|
||||||
$object = new Societe($this->db);
|
$object = new Societe($this->db);
|
||||||
$object->id = $socid;
|
$object->id = $socid;
|
||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
|
if ($object->code_compta == '411CUSTCODE') {
|
||||||
if( $object->code_compta == '411CUSTCODE')
|
|
||||||
$object->code_compta = '';
|
$object->code_compta = '';
|
||||||
|
}
|
||||||
|
|
||||||
if( $object->code_compta_fournisseur == '401SUPPCODE')
|
if ($object->code_compta_fournisseur == '401SUPPCODE') {
|
||||||
$object->code_compta_fournisseur = '';
|
$object->code_compta_fournisseur = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.lettering_code, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
|
|
||||||
$sql .= " ) AND ( bk.date_lettering ='' OR bk.date_lettering IS NULL ) AND bk.lettering_code !='' ";
|
|
||||||
|
|
||||||
$sql .= " GROUP BY bk.lettering_code ";
|
|
||||||
|
|
||||||
|
|
||||||
$resql = $db->query ( $sql );
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows ( $resql );
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ( $i < $num ) {
|
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
$i++;
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid ";
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE bk.lettering_code = '".$obj->lettering_code."' ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
// echo $sql;
|
|
||||||
$resql2 = $db->query ( $sql );
|
|
||||||
if ($resql2) {
|
|
||||||
$num2 = $db->num_rows ( $resql2 );
|
|
||||||
$i2 = 0;
|
|
||||||
$ids = array();
|
|
||||||
while ( $i2 < $num2 ) {
|
|
||||||
$obj2 = $db->fetch_object ( $resql2 );
|
|
||||||
$i2++;
|
|
||||||
$ids[] = $obj2->rowid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(count($ids) > 1 ){
|
|
||||||
$result = $this->updatelettrage($ids);
|
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
// if( $result < 0 ){
|
|
||||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
// $error++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prise en charge des lettering complexe avec prelevment , virement
|
* Prise en charge des lettering complexe avec prelevment , virement
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.code_tiers, bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
$sql = "SELECT DISTINCT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, bk.thirdparty_code, ";
|
||||||
|
$sql .= " bk.numero_compte , bk.label_compte, bk.debit , bk.credit, bk.montant ";
|
||||||
|
$sql .= " , bk.sens , bk.code_journal , bk.piece_num, bk.date_lettering, bu.url_id , bu.type ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu ON(bk.fk_doc = bu.fk_bank AND bu.type IN ('payment', 'payment_supplier') ) ";
|
||||||
$sql .= " WHERE code_journal = 'BQ' AND ( ";
|
$sql .= " WHERE ( ";
|
||||||
if (! empty($object->code_compta))
|
if (! empty($object->code_compta))
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
|
||||||
$sql .= " OR ";
|
$sql .= " OR ";
|
||||||
if (! empty($object->code_compta_fournisseur))
|
if (! empty($object->code_compta_fournisseur))
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
|
||||||
$sql .= " ) AND date_lettering ='' ";
|
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||||
$sql .= " GROUP BY bk.lettering_code ";
|
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||||
|
$sql .= $db->order('bk.doc_date', 'DESC');
|
||||||
|
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
//
|
//
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ( $i < $num ) {
|
while ( $obj = $db->fetch_object($resql) ) {
|
||||||
$obj = $db->fetch_object ( $resql );
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
$i++;
|
$ids_fact = array();
|
||||||
|
|
||||||
// print_r($obj);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($obj->type == 'payment_supplier') {
|
if ($obj->type == 'payment_supplier') {
|
||||||
$ids[] = $obj->rowid;
|
|
||||||
|
|
||||||
$sql= 'SELECT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank ';
|
$sql = 'SELECT DISTINCT bk.rowid, facf.ref, facf.ref_supplier, payf.fk_bank, facf.rowid as fact_id';
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
|
||||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
|
||||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.ref) ";
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='" . $obj->code_journal . "')";
|
||||||
// $sqlmid.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid=facf.fk_soc";
|
$sql .= " WHERE payfacf.fk_paiementfourn = '" . $obj->url_id . "' ";
|
||||||
// $sqlmid.= " INNER JOIN " . MAIN_DB_PREFIX . "c_paiement as payc ON payc.id=payf.fk_paiement";
|
$sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) ";
|
||||||
$sql .= " WHERE 1 ";
|
|
||||||
$sql .= " AND fk_paiementfourn = '".$obj->url_id."' ";
|
|
||||||
// $sql .= " AND (bk.numero_compte = '" . $object->code_compta . "' OR bk.numero_compte = '" . $object->code_compta_fournisseur . "') ";
|
|
||||||
$sql .= " AND ( ";
|
$sql .= " AND ( ";
|
||||||
if(!empty($object->code_compta) )
|
if (! empty($object->code_compta)) {
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
// echo $sql;
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
elseif($obj->type =='payment' ){
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
$ids[] = $obj->rowid;
|
|
||||||
|
|
||||||
$sql= 'SELECT bk.rowid,fac.facnumber , pay.fk_bank ';
|
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
|
||||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
|
||||||
$sql.= " INNER JOIN " .MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid) ";
|
|
||||||
$sql .= " WHERE 1 ";
|
|
||||||
$sql .= " AND payfac.fk_paiement = '".$obj->url_id."' ";
|
|
||||||
$sql .= " AND ( ";
|
|
||||||
if(!empty($object->code_compta) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta . "' ";
|
|
||||||
if(!empty($object->code_compta) && !empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " OR ";
|
$sql .= " OR ";
|
||||||
if(!empty($object->code_compta_fournisseur) )
|
|
||||||
$sql .= " bk.code_tiers = '" . $object->code_compta_fournisseur . "' ";
|
|
||||||
$sql .= " ) ";
|
|
||||||
|
|
||||||
// echo $sql;
|
|
||||||
}
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
$resql2 = $db->query($sql);
|
$resql2 = $db->query($sql);
|
||||||
if ($resql2) {
|
if ($resql2) {
|
||||||
$num2 = $db->num_rows ( $resql2 );
|
while ( $obj2 = $db->fetch_object($resql2) ) {
|
||||||
$i2 = 0;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
$ids_fact[] = $obj2->fact_id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
if (count($ids_fact)) {
|
||||||
|
$sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier ';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (" . implode(',', $ids_fact) . "))";
|
||||||
|
$sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3) ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
while ( $i2 < $num2 ) {
|
$resql2 = $db->query($sql);
|
||||||
$obj2 = $db->fetch_object ( $resql2 );
|
if ($resql2) {
|
||||||
$i2++;
|
while ( $obj2 = $db->fetch_object($resql2) ) {
|
||||||
$ids[] = $obj2->rowid;
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($obj->type == 'payment') {
|
||||||
|
|
||||||
|
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='" . $obj->code_journal . "')";
|
||||||
|
$sql .= " WHERE payfac.fk_paiement = '" . $obj->url_id . "' ";
|
||||||
|
$sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $db->query($sql);
|
||||||
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
$ids_fact[] = $obj2->fact_id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
if (count($ids_fact)) {
|
||||||
|
$sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier ';
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||||
|
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (" . implode(',', $ids_fact) . "))";
|
||||||
|
$sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2) ";
|
||||||
|
$sql .= " AND ( ";
|
||||||
|
if (! empty($object->code_compta)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " OR ";
|
||||||
|
}
|
||||||
|
if (! empty($object->code_compta_fournisseur)) {
|
||||||
|
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
|
||||||
|
}
|
||||||
|
$sql .= " ) ";
|
||||||
|
|
||||||
|
$resql2 = $db->query($sql);
|
||||||
|
if ($resql2) {
|
||||||
|
while ( $obj2 = $db->fetch_object($resql2) ) {
|
||||||
|
$ids[$obj2->rowid] = $obj2->rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->errors[] = $this->db->lasterror;
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_r($ids);
|
|
||||||
// exit;
|
|
||||||
if (count($ids) > 1) {
|
if (count($ids) > 1) {
|
||||||
$result = $this->updatelettrage($ids);
|
$result = $this->updatelettrage($ids);
|
||||||
|
|
||||||
// var_dump($result);
|
|
||||||
// if( $result < 0 ){
|
|
||||||
// setEventMessages('', $BookKeeping->errors, 'errors' );
|
|
||||||
// $error++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($error) {
|
||||||
|
foreach ( $this->errors as $errmsg ) {
|
||||||
|
dol_syslog(get_class($this) . "::" . __METHOD__ . $errmsg, LOG_ERR);
|
||||||
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
public function updatelettrage($ids, $notrigger=false){
|
*
|
||||||
|
* @param array $ids ids array
|
||||||
|
* @param boolean $notrigger no trigger
|
||||||
|
* @return number
|
||||||
|
*/
|
||||||
|
public function updateLettrage($ids = array(), $notrigger = false) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$lettre='';
|
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
|
$sql = "SELECT DISTINCT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
|
$sql .= " lettering_code != '' ORDER BY lettering_code DESC limit 1; ";
|
||||||
|
|
||||||
$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
|
||||||
$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1; ";
|
|
||||||
// echo $sql;
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
|
||||||
if (! empty($obj->lettering_code))
|
if (! empty($obj->lettering_code))
|
||||||
$lettre ++;
|
$lettre ++;
|
||||||
}
|
} else {
|
||||||
else{
|
$this->errors[] = 'Error' . $this->db->lasterror();
|
||||||
$this->errors[] = 'Error'.$this->db->lasterror();;
|
;
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
// var_dump(__line__, $error);
|
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
// print_r($obj);
|
|
||||||
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
|
||||||
// echo $sql;
|
|
||||||
// print_r($obj);
|
|
||||||
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
|
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
|
||||||
$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
|
;
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Update request
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Update request
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||||
$sql .= " lettering_code='" . $lettre . "'";
|
$sql .= " lettering_code='" . $lettre . "'";
|
||||||
$sql.= " , date_lettering = " .$now ; // todo correct date it's false
|
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
||||||
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
||||||
// echo $sql ;
|
|
||||||
//
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
// print_r($this->errors);
|
|
||||||
// exit;
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
if (! $resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error) {
|
||||||
{
|
if (! $notrigger) {
|
||||||
if (! $notrigger)
|
|
||||||
{
|
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
// want this action calls a trigger.
|
// want this action calls a trigger.
|
||||||
|
|
||||||
@ -310,29 +287,18 @@ class lettering extends BookKeeping
|
|||||||
// // End call triggers
|
// // End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// var_dump(__line__, $error);
|
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error) {
|
||||||
{
|
foreach ( $this->errors as $errmsg ) {
|
||||||
// foreach($this->errors as $errmsg)
|
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
|
||||||
// {
|
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
// dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
|
||||||
// $this->error.=($this->error?', '.$errmsg:$errmsg);
|
|
||||||
// }
|
|
||||||
$this->db->rollback();
|
|
||||||
// echo $this->error;
|
|
||||||
// var_dump(__line__, $error);
|
|
||||||
return -1*$error;
|
|
||||||
}
|
}
|
||||||
else
|
$this->db->rollback();
|
||||||
{
|
return - 1 * $error;
|
||||||
|
} else {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
@ -51,6 +53,9 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
$search_country = GETPOST('search_country', 'alpha');
|
$search_country = GETPOST('search_country', 'alpha');
|
||||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||||
|
|
||||||
@ -95,6 +100,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_tvaintra = '';
|
$search_tvaintra = '';
|
||||||
}
|
}
|
||||||
@ -131,6 +139,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
@ -197,6 +206,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("fd.tva_tx", $search_vat);
|
$sql .= natural_search("fd.tva_tx", $search_vat);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
if (strlen(trim($search_country))) {
|
if (strlen(trim($search_country))) {
|
||||||
$sql .= natural_search("co.label", $search_country);
|
$sql .= natural_search("co.label", $search_country);
|
||||||
}
|
}
|
||||||
@ -237,6 +259,9 @@ if ($result) {
|
|||||||
$param .= "&search_account=" . $search_account;
|
$param .= "&search_account=" . $search_account;
|
||||||
if ($search_vat)
|
if ($search_vat)
|
||||||
$param .= "&search_vat=" . $search_vat;
|
$param .= "&search_vat=" . $search_vat;
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
if ($search_country)
|
if ($search_country)
|
||||||
$param .= "&search_country=" . $search_country;
|
$param .= "&search_country=" . $search_country;
|
||||||
if ($search_tvaintra)
|
if ($search_tvaintra)
|
||||||
@ -267,7 +292,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
|
|||||||
@ -115,6 +115,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
$search_month = '';
|
$search_month = '';
|
||||||
$search_year = '';
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -50,6 +52,9 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
@ -90,6 +95,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||||
@ -123,6 +131,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("ExpenseReportsVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
@ -173,6 +184,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= " AND (erd.tva_tx like '" . $search_vat . "%')";
|
$sql .= " AND (erd.tva_tx like '" . $search_vat . "%')";
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -207,6 +231,9 @@ if ($result) {
|
|||||||
$param .= "&search_account=" . $search_account;
|
$param .= "&search_account=" . $search_account;
|
||||||
if ($search_vat)
|
if ($search_vat)
|
||||||
$param .= "&search_vat=" . $search_vat;
|
$param .= "&search_vat=" . $search_vat;
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
if ($search_country)
|
if ($search_country)
|
||||||
$param .= "&search_country=" . $search_country;
|
$param .= "&search_country=" . $search_country;
|
||||||
if ($search_tvaintra)
|
if ($search_tvaintra)
|
||||||
@ -237,7 +264,11 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="' . dol_escape_htmltag($search_expensereport) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
print '<td class="liste_titre" align="right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
|
||||||
|
|||||||
@ -109,6 +109,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
$search_month = '';
|
$search_month = '';
|
||||||
$search_year = '';
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||||
|
|
||||||
// Langs
|
// Langs
|
||||||
$langs->load("compta");
|
$langs->load("compta");
|
||||||
@ -52,6 +54,9 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
|||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_vat = GETPOST('search_vat', 'alpha');
|
$search_vat = GETPOST('search_vat', 'alpha');
|
||||||
|
$search_day=GETPOST("search_day","int");
|
||||||
|
$search_month=GETPOST("search_month","int");
|
||||||
|
$search_year=GETPOST("search_year","int");
|
||||||
$search_country = GETPOST('search_country', 'alpha');
|
$search_country = GETPOST('search_country', 'alpha');
|
||||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||||
|
|
||||||
@ -96,6 +101,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
|
$search_month = '';
|
||||||
|
$search_year = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_tvaintra = '';
|
$search_tvaintra = '';
|
||||||
}
|
}
|
||||||
@ -131,6 +139,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
|||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
@ -189,6 +200,19 @@ if (strlen(trim($search_account))) {
|
|||||||
if (strlen(trim($search_vat))) {
|
if (strlen(trim($search_vat))) {
|
||||||
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
$sql .= natural_search("l.tva_tx", $search_vat, 1);
|
||||||
}
|
}
|
||||||
|
if ($search_month > 0)
|
||||||
|
{
|
||||||
|
if ($search_year > 0 && empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'";
|
||||||
|
else if ($search_year > 0 && ! empty($search_day))
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'";
|
||||||
|
}
|
||||||
|
else if ($search_year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
|
||||||
|
}
|
||||||
if (strlen(trim($search_country))) {
|
if (strlen(trim($search_country))) {
|
||||||
$sql .= " AND (co.label like'" . $search_country . "%')";
|
$sql .= " AND (co.label like'" . $search_country . "%')";
|
||||||
}
|
}
|
||||||
@ -231,6 +255,9 @@ if ($result) {
|
|||||||
$param .= "&search_account=" . $search_account;
|
$param .= "&search_account=" . $search_account;
|
||||||
if ($search_vat)
|
if ($search_vat)
|
||||||
$param .= "&search_vat=" . $search_vat;
|
$param .= "&search_vat=" . $search_vat;
|
||||||
|
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||||
|
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||||
|
if ($search_year) $param.='&search_year='.urlencode($search_year);
|
||||||
if ($search_country)
|
if ($search_country)
|
||||||
$param .= "&search_country=" . $search_country;
|
$param .= "&search_country=" . $search_country;
|
||||||
if ($search_tvaintra)
|
if ($search_tvaintra)
|
||||||
@ -262,7 +289,11 @@ if ($result) {
|
|||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre"></td>';
|
||||||
print '<td class="liste_titre"></td>';
|
print '<td class="liste_titre center">';
|
||||||
|
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||||
|
$formother->select_year($search_year,'search_year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||||
|
|||||||
@ -116,6 +116,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
|||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
$search_vat = '';
|
$search_vat = '';
|
||||||
|
$search_day = '';
|
||||||
$search_month = '';
|
$search_month = '';
|
||||||
$search_year = '';
|
$search_year = '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1778,8 +1778,8 @@ else
|
|||||||
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
|
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
|
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
|
||||||
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
|
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
|
||||||
$genallowed = $user->rights->adherent->creer;
|
$genallowed = $user->rights->adherent->lire;
|
||||||
$delallowed = $user->rights->adherent->supprimer;
|
$delallowed = $user->rights->adherent->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
|
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
|
||||||
$somethingshown = $formfile->numoffiles;
|
$somethingshown = $formfile->numoffiles;
|
||||||
|
|||||||
@ -1563,7 +1563,7 @@ class Adherent extends CommonObject
|
|||||||
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
|
||||||
* @param int $maxlen length max label
|
* @param int $maxlen length max label
|
||||||
* @param string $option Page for link ('card', 'category', 'subscription', ...)
|
* @param string $option Page for link ('card', 'category', 'subscription', ...)
|
||||||
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
* @param string $mode ''=Show firstname+lastname as label (using default order), 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
|
||||||
* @param string $morecss Add more css on link
|
* @param string $morecss Add more css on link
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @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
|
* @return string Chaine avec URL
|
||||||
@ -1574,6 +1574,8 @@ class Adherent extends CommonObject
|
|||||||
|
|
||||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
|
||||||
|
|
||||||
|
$notooltip=0;
|
||||||
|
|
||||||
$result=''; $label='';
|
$result=''; $label='';
|
||||||
$link=''; $linkstart=''; $linkend='';
|
$link=''; $linkstart=''; $linkend='';
|
||||||
|
|
||||||
|
|||||||
@ -167,7 +167,7 @@ class AdherentType extends CommonObject
|
|||||||
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
$sql.= "libelle = '".$this->db->escape($this->label) ."',";
|
||||||
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
$sql.= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||||
$sql.= "vote = '".$this->db->escape($this->vote)."',";
|
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||||
$sql.= " WHERE rowid =".$this->id;
|
$sql.= " WHERE rowid =".$this->id;
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ class Members extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $typeid = '', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|||||||
@ -86,7 +86,7 @@ class MembersTypes extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|||||||
@ -85,7 +85,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '') {
|
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|||||||
@ -216,7 +216,7 @@ class Subscription extends CommonObject
|
|||||||
$result=$member->fetch($this->fk_adherent);
|
$result=$member->fetch($this->fk_adherent);
|
||||||
$result=$member->update_end_date($user);
|
$result=$member->update_end_date($user);
|
||||||
|
|
||||||
if (is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
|
||||||
{
|
{
|
||||||
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
$result=$accountline->delete($user); // Return false if refused because line is conciliated
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
|
|||||||
@ -162,6 +162,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
|
|||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder nohover" width="100%">';
|
print '<table class="noborder nohover" width="100%">';
|
||||||
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
|
||||||
print '<tr '.$bc[0].'><td align="center" colspan="2">';
|
print '<tr '.$bc[0].'><td align="center" colspan="2">';
|
||||||
@ -199,6 +200,7 @@ if ($conf->use_javascript_ajax)
|
|||||||
print $SommeA+$SommeB+$SommeC+$SommeD;
|
print $SommeA+$SommeB+$SommeC+$SommeD;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -234,6 +236,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Subscriptions").'</th>';
|
print '<th>'.$langs->trans("Subscriptions").'</th>';
|
||||||
@ -261,7 +264,8 @@ print "<td align=\"right\">".$numb."</td>";
|
|||||||
print '<td align="right">'.price($tot)."</td>";
|
print '<td align="right">'.price($tot)."</td>";
|
||||||
print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td>";
|
print "<td align=\"right\">".price(price2num($numb>0?($tot/$numb):0,'MT'))."</td>";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "</table><br>\n";
|
print "</table></div>";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
@ -283,6 +287,7 @@ $sql.= $db->plimit($max, 0);
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
|
print '<th colspan="4">'.$langs->trans("LastMembersModified",$max).'</th></tr>';
|
||||||
@ -319,7 +324,8 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table></div>";
|
||||||
|
print "<br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -344,6 +350,7 @@ $sql.= $db->plimit($max, 0);
|
|||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
|
print '<th colspan="5">'.$langs->trans("LastSubscriptionsModified",$max).'</th></tr>';
|
||||||
@ -379,7 +386,8 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</table><br>";
|
print "</table></div>";
|
||||||
|
print "<br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -388,6 +396,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
// Summary of members by type
|
// Summary of members by type
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
print '<th>'.$langs->trans("MembersTypes").'</th>';
|
||||||
@ -416,7 +425,7 @@ print '<td class="liste_total" align="right">'.$SommeD.' '.$staticmember->LibSta
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
|
|
||||||
|
|||||||
@ -100,6 +100,7 @@ $fieldstosearchall = array(
|
|||||||
'd.note_public'=>'NotePublic',
|
'd.note_public'=>'NotePublic',
|
||||||
'd.note_private'=>'NotePrivate',
|
'd.note_private'=>'NotePrivate',
|
||||||
);
|
);
|
||||||
|
if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']);
|
||||||
$arrayfields=array(
|
$arrayfields=array(
|
||||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||||
|
|||||||
@ -390,8 +390,8 @@ if ($rowid && $action != 'edit')
|
|||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||||
$genallowed = $user->rights->facture->creer;
|
$genallowed = $user->rights->facture->lire;
|
||||||
$delallowed = $user->rights->facture->supprimer;
|
$delallowed = $user->rights->facture->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||||
$somethingshown = $formfile->numoffiles;
|
$somethingshown = $formfile->numoffiles;
|
||||||
|
|||||||
@ -107,7 +107,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
|
|||||||
$object->subscription = (int) trim($subscription);
|
$object->subscription = (int) trim($subscription);
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = trim($vote);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
@ -160,7 +160,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
|||||||
$object->subscription = (int) trim($subscription);
|
$object->subscription = (int) trim($subscription);
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = trim($vote);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
|||||||
@ -54,7 +54,7 @@ $list = array(
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$accounting_mode = defined('ACCOUNTING_MODE')?ACCOUNTING_MODE:'RECETTES-DEPENSES';
|
$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE;
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -193,14 +193,20 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
|||||||
{
|
{
|
||||||
// Button off, click to enable
|
// Button off, click to enable
|
||||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
|
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
|
||||||
$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
//$enabledisablehtml.= img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.$langs->trans("Disabled").'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableDefaultValues");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
$enabledisablehtml.= '</a>';
|
$enabledisablehtml.= '</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Button on, click to disable
|
// Button on, click to disable
|
||||||
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
|
$enabledisablehtml.= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
|
||||||
$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
//$enabledisablehtml.= img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.$langs->trans("Activated").'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableDefaultValues");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
$enabledisablehtml.= '</a>';
|
$enabledisablehtml.= '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1019,9 +1019,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
elseif ($context == 'add' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
elseif ($context == 'edit' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
elseif ($context == 'hide' & in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$size=''; $class=''; $classtd='';
|
$size=''; $class=''; $classtd='';
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2017 Frédéric France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -208,7 +209,8 @@ llxHeader('',$langs->trans("Setup"),$wikihelp);
|
|||||||
|
|
||||||
$param='&mode='.$mode;
|
$param='&mode='.$mode;
|
||||||
|
|
||||||
$enabledisablehtml = $langs->trans("EnableOverwriteTranslation").' ';
|
$enabledisablehtml='';
|
||||||
|
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.= $langs->trans("EnableOverwriteTranslation").' ';
|
||||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||||
{
|
{
|
||||||
// Button off, click to enable
|
// Button off, click to enable
|
||||||
@ -226,7 +228,9 @@ else
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
|
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
|
||||||
|
|
||||||
|
//print '<span class="opacitymedium">';
|
||||||
print $langs->trans("TranslationDesc")."<br>\n";
|
print $langs->trans("TranslationDesc")."<br>\n";
|
||||||
|
//print '</span>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
$current_language_code=$langs->defaultlang;
|
$current_language_code=$langs->defaultlang;
|
||||||
@ -259,11 +263,14 @@ if ($mode == 'overwrite')
|
|||||||
{
|
{
|
||||||
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
//print load_fiche_titre($langs->trans("TranslationOverwriteKey"), '', '')."\n";
|
||||||
|
|
||||||
|
print '<div class="justify"><span class="opacitymedium">';
|
||||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||||
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
$urlwikitranslatordoc='https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||||
print ' ('.$langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$urlwikitranslatordoc.'</a>)<br>';
|
print ' ('.$langs->trans("SeeAlso").': <a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>)<br>';
|
||||||
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
print $langs->trans("TranslationOverwriteDesc",$langs->transnoentitiesnoconv("Language"),$langs->transnoentitiesnoconv("Key"),$langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||||
|
print '</span></div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
@ -291,9 +298,9 @@ if ($mode == 'overwrite')
|
|||||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit?1:0, 'maxwidthonsmartphone', 1);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="">';
|
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" value="'.(!empty($transkey)?$transkey:"").'">';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="">';
|
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" value="'.(!empty($transvalue)?$transvalue:"").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Limit to superadmin
|
// Limit to superadmin
|
||||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||||
@ -319,7 +326,7 @@ if ($mode == 'overwrite')
|
|||||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";
|
||||||
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
$sql.= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||||
$sql.= $db->order($sortfield, $sortorder);
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
|
||||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||||
@ -483,7 +490,7 @@ if ($mode == 'searchkey')
|
|||||||
//}
|
//}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="liste_titre nowrap" align="right">';
|
print '<td class="nowrap" align="right">';
|
||||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -508,9 +515,36 @@ if ($mode == 'searchkey')
|
|||||||
{
|
{
|
||||||
if ($val != $newlangfileonly->tab_translate[$key])
|
if ($val != $newlangfileonly->tab_translate[$key])
|
||||||
{
|
{
|
||||||
|
// retrieve rowid
|
||||||
|
$sql = "SELECT rowid";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "overwrite_trans";
|
||||||
|
$sql.= " WHERE transkey = '".$key."'";
|
||||||
|
$sql.= " AND entity IN (" . getEntity('overwrite_trans') . ")";
|
||||||
|
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
}
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?rowid=' . $obj->rowid . '&entity=' . $conf->entity . '&action=edit">' . img_edit() . '</a>';
|
||||||
|
print ' ';
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?rowid=' . $obj->rowid . '&entity=' . $conf->entity . '&action=delete">' . img_delete() . '</a>';
|
||||||
|
print ' ';
|
||||||
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
$htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]);
|
||||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||||
}
|
}
|
||||||
|
else if (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||||
|
{
|
||||||
|
//print $key.'-'.$val;
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?mode=overwrite&langcode=' . $langcode . '&transkey=' . $key . '">' . img_edit_add($langs->trans("Overwrite")) . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||||
|
{
|
||||||
|
$transifexlangfile='$'; // $ means 'All'
|
||||||
|
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||||
|
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto('FixOnTransifex', 'object_globe').'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/admin/websites.php
|
* \file htdocs/admin/website.php
|
||||||
* \ingroup setup
|
* \ingroup setup
|
||||||
* \brief Page to administer web sites
|
* \brief Page to administer web sites
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ 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/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/websites/class/website.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
@ -99,11 +99,11 @@ $tabrowid[1] = "";
|
|||||||
|
|
||||||
// Condition to show dictionary in setup page
|
// Condition to show dictionary in setup page
|
||||||
$tabcond=array();
|
$tabcond=array();
|
||||||
$tabcond[1] = (! empty($conf->websites->enabled));
|
$tabcond[1] = (! empty($conf->website->enabled));
|
||||||
|
|
||||||
// List of help for fields
|
// List of help for fields
|
||||||
$tabhelp=array();
|
$tabhelp=array();
|
||||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
|
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>'));
|
||||||
|
|
||||||
// List of check for fields (NOT USED YET)
|
// List of check for fields (NOT USED YET)
|
||||||
$tabfieldcheck=array();
|
$tabfieldcheck=array();
|
||||||
@ -205,7 +205,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
|||||||
if ($result) // Add is ok
|
if ($result) // Add is ok
|
||||||
{
|
{
|
||||||
global $dolibarr_main_data_root;
|
global $dolibarr_main_data_root;
|
||||||
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
|
$pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey;
|
||||||
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
|
||||||
$filecss=$pathofwebsite.'/styles.css.php';
|
$filecss=$pathofwebsite.'/styles.css.php';
|
||||||
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
|
||||||
@ -283,8 +283,8 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
|
|||||||
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
$newname = dol_sanitizeFileName(GETPOST('ref','aZ09'));
|
||||||
if ($newname != $website->ref)
|
if ($newname != $website->ref)
|
||||||
{
|
{
|
||||||
$srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref;
|
$srcfile=DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||||
$destfile=DOL_DATA_ROOT.'/websites/'.$newname;
|
$destfile=DOL_DATA_ROOT.'/website/'.$newname;
|
||||||
|
|
||||||
if (dol_is_dir($destfile))
|
if (dol_is_dir($destfile))
|
||||||
{
|
{
|
||||||
@ -134,8 +134,11 @@ class DolibarrApi
|
|||||||
unset($object->fk_element);
|
unset($object->fk_element);
|
||||||
unset($object->table_element);
|
unset($object->table_element);
|
||||||
unset($object->table_element_line);
|
unset($object->table_element_line);
|
||||||
|
unset($object->class_element_line);
|
||||||
unset($object->picto);
|
unset($object->picto);
|
||||||
|
|
||||||
|
unset($object->facturee); // Replace with billed
|
||||||
|
|
||||||
unset($object->skip_update_total);
|
unset($object->skip_update_total);
|
||||||
unset($object->context);
|
unset($object->context);
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
*/
|
*/
|
||||||
public function __isAllowed()
|
public function __isAllowed()
|
||||||
{
|
{
|
||||||
global $db;
|
global $conf, $db;
|
||||||
|
|
||||||
$login = '';
|
$login = '';
|
||||||
$stored_key = '';
|
$stored_key = '';
|
||||||
@ -83,10 +83,10 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
|
|
||||||
// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
|
// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
|
||||||
$api_key = '';
|
$api_key = '';
|
||||||
if (isset($_GET['api_key']))
|
if (isset($_GET['api_key'])) // For backward compatibility
|
||||||
{
|
{
|
||||||
// TODO Add option to disable use of api key on url. Return errors if used.
|
// TODO Add option to disable use of api key on url. Return errors if used.
|
||||||
$api_key = $_GET['api_key']; // For backward compatibility
|
$api_key = $_GET['api_key'];
|
||||||
}
|
}
|
||||||
if (isset($_GET['DOLAPIKEY']))
|
if (isset($_GET['DOLAPIKEY']))
|
||||||
{
|
{
|
||||||
@ -100,10 +100,13 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
|
|
||||||
if ($api_key)
|
if ($api_key)
|
||||||
{
|
{
|
||||||
|
$userentity = 0;
|
||||||
|
|
||||||
$sql = "SELECT u.login, u.datec, u.api_key, ";
|
$sql = "SELECT u.login, u.datec, u.api_key, ";
|
||||||
$sql.= " u.tms as date_modification, u.entity";
|
$sql.= " u.tms as date_modification, u.entity";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.api_key = '".$db->escape($api_key)."'";
|
$sql.= " WHERE u.api_key = '".$db->escape($api_key)."'";
|
||||||
|
// TODO Check if 2 users has same API key.
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
@ -113,24 +116,34 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$login = $obj->login;
|
$login = $obj->login;
|
||||||
$stored_key = $obj->api_key;
|
$stored_key = $obj->api_key;
|
||||||
|
$userentity = $obj->entity;
|
||||||
|
|
||||||
|
if (! defined("DOLENTITY") && $conf->entity != ($obj->entity?$obj->entity:1)) // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user
|
||||||
|
{
|
||||||
|
$conf->entity = ($obj->entity?$obj->entity:1);
|
||||||
|
// We must also reload global conf to get params from the entity
|
||||||
|
dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity .") and we have to reload configuration.", LOG_WARNING);
|
||||||
|
$conf->setValues($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stored_key != $api_key) {
|
if ($stored_key != $api_key) { // This should not happen since we did a search on api_key
|
||||||
$userClass::setCacheIdentifier($api_key);
|
$userClass::setCacheIdentifier($api_key);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $login)
|
if (! $login)
|
||||||
{
|
{
|
||||||
throw new RestException(503, 'Error when searching logn user fro mapi key');
|
throw new RestException(503, 'Error when searching login user from api key');
|
||||||
}
|
}
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
if(! $fuser->fetch('',$login)) {
|
$result = $fuser->fetch('', $login, '', 0, (empty($userentity) ? -1 : $conf->entity)); // If user is not entity 0, we search in working entity $conf->entity (that may have been forced to a different value than user entity)
|
||||||
throw new RestException(503, 'Error when fetching user :'.$fuser->error);
|
if ($result <= 0) {
|
||||||
|
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
|
||||||
}
|
}
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
static::$user = $fuser;
|
static::$user = $fuser;
|
||||||
@ -143,7 +156,7 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new RestException(401, "Failed to login to API. No parameter 'DOLAPIKEY' on HTTP header (neither in URL).");
|
throw new RestException(401, "Failed to login to API. No parameter 'HTTP_DOLAPIKEY' on HTTP header (and no parameter DOLAPIKEY in URL).");
|
||||||
}
|
}
|
||||||
|
|
||||||
$userClass::setCacheIdentifier(static::$role);
|
$userClass::setCacheIdentifier(static::$role);
|
||||||
|
|||||||
@ -130,18 +130,20 @@ class Documents extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of documents of an element
|
* Return the list of documents of a dedicated element (from its ID or Ref)
|
||||||
*
|
*
|
||||||
* @param string $modulepart Name of module or area concerned ('facture', 'project', 'member', ...)
|
* @param string $modulepart Name of module or area concerned ('facture', 'project', 'member', ...)
|
||||||
* @param int $id ID of element
|
* @param int $id ID of element
|
||||||
* @param string $ref Ref of element
|
* @param string $ref Ref of element
|
||||||
|
* @param string $sortfield Sort criteria ('','fullname','relativename','name','date','size')
|
||||||
|
* @param string $sortorder Sort order ('asc' or 'desc')
|
||||||
* @return array Array of documents with path
|
* @return array Array of documents with path
|
||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*
|
*
|
||||||
* @url GET list
|
* @url GET list
|
||||||
*/
|
*/
|
||||||
function getDocumentsListByElement($modulepart, $id=0, $ref='')
|
function getDocumentsListByElement($modulepart, $id=0, $ref='', $sortfield='', $sortorder='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -254,9 +256,11 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
// Define $uploadir
|
// Define $uploadir
|
||||||
$object = null;
|
$object = null;
|
||||||
$entity = $user->entity;
|
$entity = DolibarrApiAccess::$user->entity;
|
||||||
if ($ref)
|
if ($ref)
|
||||||
{
|
{
|
||||||
|
$tmpreldir='';
|
||||||
|
|
||||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||||
{
|
{
|
||||||
$modulepart='facture';
|
$modulepart='facture';
|
||||||
|
|||||||
@ -37,7 +37,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not lo
|
|||||||
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
|
||||||
|
|
||||||
|
|
||||||
// Force entity if a value provided int HTTP header. Otherwise, will use the entity of user of token used.
|
// Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used.
|
||||||
if (! empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
if (! empty($_SERVER['HTTP_DOLAPIENTITY'])) define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||||
|
|
||||||
|
|
||||||
@ -241,6 +241,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$classfile = str_replace('_', '', $module);
|
$classfile = str_replace('_', '', $module);
|
||||||
|
if ($module == 'contracts') $moduledirforclass = 'contrat';
|
||||||
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
|
||||||
if ($module == 'supplierorders') $classfile = 'supplier_orders';
|
if ($module == 'supplierorders') $classfile = 'supplier_orders';
|
||||||
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
|
||||||
|
|||||||
@ -21,13 +21,15 @@
|
|||||||
|
|
||||||
class BlockedLog
|
class BlockedLog
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id of the log
|
* Id of the log
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
|
public $error = '';
|
||||||
|
public $errors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique fingerprint of the log
|
* Unique fingerprint of the log
|
||||||
* @var string
|
* @var string
|
||||||
@ -78,7 +80,7 @@ class BlockedLog
|
|||||||
|
|
||||||
public $object_data = null;
|
public $object_data = null;
|
||||||
|
|
||||||
public $error = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -188,8 +190,6 @@ class BlockedLog
|
|||||||
$this->object_data->amounts = $object->amounts;
|
$this->object_data->amounts = $object->amounts;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,7 +231,7 @@ class BlockedLog
|
|||||||
$this->action = $obj->action;
|
$this->action = $obj->action;
|
||||||
$this->element = $obj->element;
|
$this->element = $obj->element;
|
||||||
|
|
||||||
$this->fk_object = trim($obj->fk_object);
|
$this->fk_object = $obj->fk_object;
|
||||||
$this->date_object = $this->db->jdate($obj->date_object);
|
$this->date_object = $this->db->jdate($obj->date_object);
|
||||||
$this->ref_object = $obj->ref_object;
|
$this->ref_object = $obj->ref_object;
|
||||||
|
|
||||||
|
|||||||
@ -115,6 +115,7 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
$(document).ready(function () {';
|
$(document).ready(function () {';
|
||||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
$ret.=' jQuery("#boxbookmark").change(function() {
|
||||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
||||||
|
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
||||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
||||||
if (! urltarget) { urltarget=""; }
|
if (! urltarget) { urltarget=""; }
|
||||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
jQuery("form#actionbookmark").attr("target",urltarget);
|
||||||
@ -128,9 +129,14 @@ function printBookmarksList($aDb, $aLangs)
|
|||||||
var newmethod=\'GET\';
|
var newmethod=\'GET\';
|
||||||
jQuery("form#actionbookmark").attr("method", newmethod);
|
jQuery("form#actionbookmark").attr("method", newmethod);
|
||||||
console.log("We change method to newmethod="+newmethod);
|
console.log("We change method to newmethod="+newmethod);
|
||||||
}
|
|
||||||
|
|
||||||
jQuery("#actionbookmark").submit();
|
jQuery("#actionbookmark").submit();
|
||||||
|
console.log("We restore method to POST");
|
||||||
|
jQuery("form#actionbookmark").attr("method", \'POST\');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jQuery("#actionbookmark").submit();
|
||||||
|
}
|
||||||
});';
|
});';
|
||||||
$ret.='})</script>';
|
$ret.='})</script>';
|
||||||
$ret .= '<div class="menu_end"></div>';
|
$ret .= '<div class="menu_end"></div>';
|
||||||
|
|||||||
@ -29,10 +29,17 @@
|
|||||||
// Wrapper to show tooltips
|
// Wrapper to show tooltips
|
||||||
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover))
|
if (! empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover))
|
||||||
{
|
{
|
||||||
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
|
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
|
||||||
print '<script type="text/javascript">
|
print '<script type="text/javascript">
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(($conf->browser->layout == 'phone' ? 400 : 700),'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
|
jQuery(".classfortooltip").tooltip({
|
||||||
|
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
|
||||||
|
hide: { effect:\'toggle\', delay: 50 },
|
||||||
|
tooltipClass: "mytooltip",
|
||||||
|
content: function () {
|
||||||
|
return $(this).prop(\'title\'); /* To force to get title as is */
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>' . "\n";
|
</script>' . "\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ class Facturation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Define part of HT, VAT, TTC
|
// Define part of HT, VAT, TTC
|
||||||
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
|
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $vat_npr, $product->type, $mysoc, $localtaxarray);
|
||||||
|
|
||||||
// Calcul du total ht sans remise
|
// Calcul du total ht sans remise
|
||||||
$total_ht = $resultarray[0];
|
$total_ht = $resultarray[0];
|
||||||
@ -207,6 +207,9 @@ class Facturation
|
|||||||
|
|
||||||
$total_ht=0;
|
$total_ht=0;
|
||||||
$total_ttc=0;
|
$total_ttc=0;
|
||||||
|
$total_vat = 0;
|
||||||
|
$total_localtax1 = 0;
|
||||||
|
$total_localtax2 = 0;
|
||||||
|
|
||||||
$tab=array();
|
$tab=array();
|
||||||
$tab = $_SESSION['poscart'];
|
$tab = $_SESSION['poscart'];
|
||||||
@ -309,7 +312,7 @@ class Facturation
|
|||||||
public function ref($aRef=null)
|
public function ref($aRef=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aRef )
|
if (is_null($aRef))
|
||||||
{
|
{
|
||||||
return $this->ref;
|
return $this->ref;
|
||||||
}
|
}
|
||||||
@ -332,7 +335,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function qte($aQte=null)
|
public function qte($aQte=null)
|
||||||
{
|
{
|
||||||
if ( !$aQte )
|
if (is_null($aQte))
|
||||||
{
|
{
|
||||||
return $this->qte;
|
return $this->qte;
|
||||||
}
|
}
|
||||||
@ -357,7 +360,7 @@ class Facturation
|
|||||||
public function stock($aStock=null)
|
public function stock($aStock=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aStock )
|
if (is_null($aStock))
|
||||||
{
|
{
|
||||||
return $this->stock;
|
return $this->stock;
|
||||||
}
|
}
|
||||||
@ -381,7 +384,7 @@ class Facturation
|
|||||||
public function remisePercent($aRemisePercent=null)
|
public function remisePercent($aRemisePercent=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aRemisePercent )
|
if (is_null($aRemisePercent))
|
||||||
{
|
{
|
||||||
return $this->remise_percent;
|
return $this->remise_percent;
|
||||||
}
|
}
|
||||||
@ -405,7 +408,7 @@ class Facturation
|
|||||||
public function montantRemise($aMontantRemise=null)
|
public function montantRemise($aMontantRemise=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aMontantRemise ) {
|
if (is_null($aMontantRemise)) {
|
||||||
|
|
||||||
return $this->montant_remise;
|
return $this->montant_remise;
|
||||||
|
|
||||||
@ -430,7 +433,7 @@ class Facturation
|
|||||||
public function prix($aPrix=null)
|
public function prix($aPrix=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aPrix ) {
|
if (is_null($aPrix)) {
|
||||||
|
|
||||||
return $this->prix;
|
return $this->prix;
|
||||||
|
|
||||||
@ -454,7 +457,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function tva($aTva=null)
|
public function tva($aTva=null)
|
||||||
{
|
{
|
||||||
if ( !$aTva ) {
|
if (is_null($aTva)) {
|
||||||
|
|
||||||
return $this->tva;
|
return $this->tva;
|
||||||
|
|
||||||
@ -478,7 +481,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function numInvoice($aNumFacture=null)
|
public function numInvoice($aNumFacture=null)
|
||||||
{
|
{
|
||||||
if ( !$aNumFacture ) {
|
if (is_null($aNumFacture)) {
|
||||||
|
|
||||||
return $this->num_facture;
|
return $this->num_facture;
|
||||||
|
|
||||||
@ -502,7 +505,7 @@ class Facturation
|
|||||||
public function getSetPaymentMode($aModeReglement=null)
|
public function getSetPaymentMode($aModeReglement=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aModeReglement ) {
|
if (is_null($aModeReglement)) {
|
||||||
|
|
||||||
return $this->mode_reglement;
|
return $this->mode_reglement;
|
||||||
|
|
||||||
@ -527,7 +530,7 @@ class Facturation
|
|||||||
public function montantEncaisse($aMontantEncaisse=null)
|
public function montantEncaisse($aMontantEncaisse=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aMontantEncaisse ) {
|
if (is_null($aMontantEncaisse)) {
|
||||||
|
|
||||||
return $this->montant_encaisse;
|
return $this->montant_encaisse;
|
||||||
|
|
||||||
@ -552,7 +555,7 @@ class Facturation
|
|||||||
public function montantRendu($aMontantRendu=null)
|
public function montantRendu($aMontantRendu=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( !$aMontantRendu ) {
|
if (is_null($aMontantRendu)) {
|
||||||
|
|
||||||
return $this->montant_rendu;
|
return $this->montant_rendu;
|
||||||
} else if ( $aMontantRendu == 'RESET' ) {
|
} else if ( $aMontantRendu == 'RESET' ) {
|
||||||
@ -575,7 +578,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function paiementLe($aPaiementLe=null)
|
public function paiementLe($aPaiementLe=null)
|
||||||
{
|
{
|
||||||
if ( !$aPaiementLe ) {
|
if (is_null($aPaiementLe)) {
|
||||||
|
|
||||||
return $this->paiement_le;
|
return $this->paiement_le;
|
||||||
|
|
||||||
@ -598,7 +601,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function prixTotalHt($aTotalHt=null)
|
public function prixTotalHt($aTotalHt=null)
|
||||||
{
|
{
|
||||||
if ( !$aTotalHt ) {
|
if (is_null($aTotalHt)) {
|
||||||
|
|
||||||
return $this->prix_total_ht;
|
return $this->prix_total_ht;
|
||||||
|
|
||||||
@ -621,7 +624,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function montantTva($aMontantTva=null)
|
public function montantTva($aMontantTva=null)
|
||||||
{
|
{
|
||||||
if ( !$aMontantTva ) {
|
if (is_null($aMontantTva)) {
|
||||||
|
|
||||||
return $this->montant_tva;
|
return $this->montant_tva;
|
||||||
|
|
||||||
@ -645,7 +648,7 @@ class Facturation
|
|||||||
*/
|
*/
|
||||||
public function prixTotalTtc($aTotalTtc=null)
|
public function prixTotalTtc($aTotalTtc=null)
|
||||||
{
|
{
|
||||||
if ( !$aTotalTtc )
|
if (is_null($aTotalTtc))
|
||||||
{
|
{
|
||||||
return $this->prix_total_ttc;
|
return $this->prix_total_ttc;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class Categories extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $type = '', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|||||||
@ -163,7 +163,7 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $socid;
|
public $socid;
|
||||||
/**
|
/**
|
||||||
* @var int Category type
|
* @var string Category type
|
||||||
*
|
*
|
||||||
* @see Categorie::TYPE_PRODUCT
|
* @see Categorie::TYPE_PRODUCT
|
||||||
* @see Categorie::TYPE_SUPPLIER
|
* @see Categorie::TYPE_SUPPLIER
|
||||||
@ -1327,6 +1327,7 @@ class Categorie extends CommonObject
|
|||||||
{
|
{
|
||||||
$w = array();
|
$w = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
$forced_color='';
|
||||||
foreach ($way as $cat)
|
foreach ($way as $cat)
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
@ -1340,12 +1341,7 @@ class Categorie extends CommonObject
|
|||||||
$forced_color='categtextwhite';
|
$forced_color='categtextwhite';
|
||||||
if ($cat->color)
|
if ($cat->color)
|
||||||
{
|
{
|
||||||
$hex=$cat->color;
|
if (colorIsLight($cat->color)) $forced_color='categtextblack';
|
||||||
$r = hexdec($hex[0].$hex[1]);
|
|
||||||
$g = hexdec($hex[2].$hex[3]);
|
|
||||||
$b = hexdec($hex[4].$hex[5]);
|
|
||||||
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
|
|
||||||
if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60%
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1602,12 +1598,7 @@ class Categorie extends CommonObject
|
|||||||
$forced_color='categtextwhite';
|
$forced_color='categtextwhite';
|
||||||
if ($this->color)
|
if ($this->color)
|
||||||
{
|
{
|
||||||
$hex=$this->color;
|
if (colorIsLight($this->color)) $forced_color='categtextblack';
|
||||||
$r = hexdec($hex[0].$hex[1]);
|
|
||||||
$g = hexdec($hex[2].$hex[3]);
|
|
||||||
$b = hexdec($hex[4].$hex[5]);
|
|
||||||
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
|
|
||||||
if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60%
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
|
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
|
||||||
|
|||||||
@ -206,7 +206,7 @@ if (count($object->records) > 0)
|
|||||||
if ($website)
|
if ($website)
|
||||||
{
|
{
|
||||||
$virtualurl='';
|
$virtualurl='';
|
||||||
$dataroot=DOL_DATA_ROOT.'/websites/'.$website;
|
$dataroot=DOL_DATA_ROOT.'/collab/'.$website;
|
||||||
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ if (count($object->records) > 0)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$urlext=$virtualurl;
|
$urlext=$virtualurl;
|
||||||
$urlint=$urlwithroot.'/public/websites/index.php?website='.$website;
|
$urlint=$urlwithroot.'/public/collab/index.php?website='.$website;
|
||||||
//if (! empty($object->virtualhost))
|
//if (! empty($object->virtualhost))
|
||||||
//{
|
//{
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||||
@ -246,7 +246,7 @@ if (count($object->records) > 0)
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
//}
|
//}
|
||||||
|
|
||||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/websites/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/collab/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ if (count($object->records) > 0)
|
|||||||
$websitepage = new WebSitePage($db);
|
$websitepage = new WebSitePage($db);
|
||||||
$websitepage->fetch($pageid);
|
$websitepage->fetch($pageid);
|
||||||
|
|
||||||
$realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid;
|
$realpage=$urlwithroot.'/public/collab/index.php?website='.$website.'&page='.$pageid;
|
||||||
$pagealias = $websitepage->pageurl;
|
$pagealias = $websitepage->pageurl;
|
||||||
|
|
||||||
print '<div class="websiteinputurl">';
|
print '<div class="websiteinputurl">';
|
||||||
|
|||||||
@ -199,8 +199,8 @@ if ($action == 'add')
|
|||||||
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
|
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
|
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour",'int'), $fulldayevent?'00':GETPOST("apmin",'int'), $fulldayevent?'00':GETPOST("apsec",'int'), GETPOST("apmonth",'int'), GETPOST("apday",'int'), GETPOST("apyear",'int'));
|
||||||
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour"), $fulldayevent?'59':GETPOST("p2min"), $fulldayevent?'59':'0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
|
$datef=dol_mktime($fulldayevent?'23':GETPOST("p2hour",'int'), $fulldayevent?'59':GETPOST("p2min",'int'), $fulldayevent?'59':GETPOST("apsec",'int'), GETPOST("p2month",'int'), GETPOST("p2day",'int'), GETPOST("p2year",'int'));
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $datef && $percentage == 100)
|
if (! $datef && $percentage == 100)
|
||||||
@ -577,7 +577,7 @@ if ($action == 'mupdate')
|
|||||||
|
|
||||||
// Actions to delete doc
|
// Actions to delete doc
|
||||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
$permissioncreate = ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete));
|
$permissioncreate = ($user->rights->agenda->allactions->create || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->read));
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|
||||||
@ -1478,8 +1478,8 @@ if ($id > 0)
|
|||||||
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
|
$filedir=$conf->agenda->multidir_output[$conf->entity].'/'.$object->id;
|
||||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
|
|
||||||
$genallowed=$user->rights->agenda->myactions->create;
|
$genallowed=$user->rights->agenda->myactions->read;
|
||||||
$delallowed=$user->rights->agenda->myactions->delete;
|
$delallowed=$user->rights->agenda->myactions->create;
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
|
|||||||
@ -1375,7 +1375,7 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
if ($qualified && $datestart)
|
if ($qualified && $datestart)
|
||||||
{
|
{
|
||||||
$eventarray[$datestart]=$event;
|
$eventarray[]=$event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ if (! $sortorder) $sortorder="ASC";
|
|||||||
if (! $sortfield) $sortfield="name";
|
if (! $sortfield) $sortfield="name";
|
||||||
|
|
||||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
$modulepart='contract';
|
$modulepart='actions';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||||
if (! empty($conf->projet->enabled)) {
|
if (! empty($conf->projet->enabled)) {
|
||||||
@ -612,14 +613,14 @@ if (empty($reshook))
|
|||||||
// Close proposal
|
// Close proposal
|
||||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||||
{
|
{
|
||||||
if (! GETPOST('statut')) {
|
if (! GETPOST('statut','int')) {
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||||
$action = 'statut';
|
$action = 'statut';
|
||||||
} else {
|
} else {
|
||||||
// prevent browser refresh from closing proposal several times
|
// prevent browser refresh from closing proposal several times
|
||||||
if ($object->statut == Propal::STATUS_VALIDATED)
|
if ($object->statut == Propal::STATUS_VALIDATED)
|
||||||
{
|
{
|
||||||
$result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','alpha'));
|
$result=$object->cloture($user, GETPOST('statut','int'), GETPOST('note_private','none'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -1687,8 +1688,8 @@ if ($action == 'create')
|
|||||||
//Form to close proposal (signed or not)
|
//Form to close proposal (signed or not)
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('type' => 'select','name' => 'statut','label' => $langs->trans("CloseAs"),'values' => array(2=>$object->labelstatut [2],3=>$object->labelstatut [3])),
|
array('type' => 'select','name' => 'statut','label' => $langs->trans("CloseAs"),'values' => array(2=>$object->labelstatut [2],3=>$object->labelstatut [3])),
|
||||||
//array('type' => 'other','name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '<textarea cols="30" rows="' . ROWS_3 . '" wrap="soft" name="note_private" id="note_private">'.$object->note_private.'</textarea>'));
|
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => '') // Field to complete private note (not replace)
|
||||||
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"),'value' => $object->note_private));
|
);
|
||||||
|
|
||||||
if (! empty($conf->notification->enabled)) {
|
if (! empty($conf->notification->enabled)) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||||
@ -2284,6 +2285,14 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create an intervention
|
||||||
|
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
|
if ($user->rights->ficheinter->creer) {
|
||||||
|
$langs->load("interventions");
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddIntervention") . '</a></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create contract
|
// Create contract
|
||||||
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
@ -2343,8 +2352,8 @@ if ($action == 'create')
|
|||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$filedir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
$genallowed = $user->rights->propal->creer;
|
$genallowed = $user->rights->propal->lire;
|
||||||
$delallowed = $user->rights->propal->supprimer;
|
$delallowed = $user->rights->propal->creer;
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
@ -2354,6 +2363,15 @@ if ($action == 'create')
|
|||||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
|
||||||
|
|
||||||
|
// Show online signature link
|
||||||
|
$useonlinepayment = $conf->global->MAIN_FEATURES_LEVEL;
|
||||||
|
|
||||||
|
if ($object->statut != Propal::STATUS_DRAFT && $useonlinepayment)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
print showOnlineSignatureUrl('proposal', $object->ref);
|
||||||
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
|||||||
@ -90,11 +90,11 @@ class Proposals extends DolibarrApi
|
|||||||
* @param string $sortorder Sort order
|
* @param string $sortorder Sort order
|
||||||
* @param int $limit Limit for list
|
* @param int $limit Limit for list
|
||||||
* @param int $page Page number
|
* @param int $page Page number
|
||||||
* @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i}
|
* @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^2|3$/i}
|
||||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
||||||
* @return array Array of order objects
|
* @return array Array of order objects
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
@ -280,16 +280,16 @@ class Proposals extends DolibarrApi
|
|||||||
$request_data->date_end,
|
$request_data->date_end,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->fk_unit,
|
$request_data->fk_unit,
|
||||||
$this->element,
|
$request_data->origin,
|
||||||
$request_data->id,
|
$request_data->origin_id,
|
||||||
$request_data->multicurrency_subprice,
|
$request_data->multicurrency_subprice,
|
||||||
$request_data->fk_remise_except
|
$request_data->fk_remise_except
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,6 +507,49 @@ class Proposals extends DolibarrApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close (Accept or refuse) a quote / commercial proposal
|
||||||
|
*
|
||||||
|
* @param int $id Commercial proposal ID
|
||||||
|
* @param int $status Must be 2 (accepted) or 3 (refused) {@min 2}{@max 3}
|
||||||
|
* @param string $note_private Add this mention at end of private note
|
||||||
|
* @param int $notrigger Disabled triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/close
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function close($id, $status, $note_private='', $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->propal->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->propal->cloture(DolibarrApiAccess::$user, $status, $note_private, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already closed');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when closing Commercial Proposal: '.$this->propal->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Commercial Proposal closed (Ref='.$this->propal->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate fields before create or update object
|
* Validate fields before create or update object
|
||||||
*
|
*
|
||||||
@ -526,6 +569,7 @@ class Proposals extends DolibarrApi
|
|||||||
return $propal;
|
return $propal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
|
|||||||
@ -590,6 +590,11 @@ class Propal extends CommonObject
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -955,6 +960,48 @@ class Propal extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql) $error++;
|
if (! $resql) $error++;
|
||||||
|
|
||||||
|
if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
|
{
|
||||||
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add object linked
|
||||||
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
|
{
|
||||||
|
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
|
{
|
||||||
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
|
{
|
||||||
|
foreach($tmp_origin_id as $origin_id)
|
||||||
|
{
|
||||||
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
|
if (! $ret)
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||||
|
{
|
||||||
|
$origin_id = $tmp_origin_id;
|
||||||
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
|
if (! $ret)
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add linked object (deprecated, use ->linkedObjectsIds instead)
|
||||||
|
if (! $error && $this->origin && $this->origin_id)
|
||||||
|
{
|
||||||
|
$ret = $this->add_object_linked();
|
||||||
|
if (! $ret) dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insertion du detail des produits dans la base
|
* Insertion du detail des produits dans la base
|
||||||
*/
|
*/
|
||||||
@ -1252,7 +1299,7 @@ class Propal extends CommonObject
|
|||||||
$sql.= ", p.datep as dp";
|
$sql.= ", p.datep as dp";
|
||||||
$sql.= ", p.fin_validite as dfv";
|
$sql.= ", p.fin_validite as dfv";
|
||||||
$sql.= ", p.date_livraison as date_livraison";
|
$sql.= ", p.date_livraison as date_livraison";
|
||||||
$sql.= ", p.model_pdf, p.ref_client, p.extraparams";
|
$sql.= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams";
|
||||||
$sql.= ", p.note_private, p.note_public";
|
$sql.= ", p.note_private, p.note_public";
|
||||||
$sql.= ", p.fk_projet, p.fk_statut";
|
$sql.= ", p.fk_projet, p.fk_statut";
|
||||||
$sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture";
|
$sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture";
|
||||||
@ -1306,6 +1353,7 @@ class Propal extends CommonObject
|
|||||||
$this->socid = $obj->fk_soc;
|
$this->socid = $obj->fk_soc;
|
||||||
$this->fk_project = $obj->fk_projet;
|
$this->fk_project = $obj->fk_projet;
|
||||||
$this->modelpdf = $obj->model_pdf;
|
$this->modelpdf = $obj->model_pdf;
|
||||||
|
$this->last_main_doc = $obj->last_main_doc;
|
||||||
$this->note = $obj->note_private; // TODO deprecated
|
$this->note = $obj->note_private; // TODO deprecated
|
||||||
$this->note_private = $obj->note_private;
|
$this->note_private = $obj->note_private;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
@ -1505,48 +1553,6 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update value of extrafields on the proposal
|
|
||||||
*
|
|
||||||
* @param User $user Object user that modify
|
|
||||||
* @return int <0 if ko, >0 if ok
|
|
||||||
*/
|
|
||||||
function update_extrafields($user)
|
|
||||||
{
|
|
||||||
global $conf, $hookmanager;
|
|
||||||
|
|
||||||
$action='update';
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
|
||||||
$hookmanager->initHooks(array('propaldao'));
|
|
||||||
$parameters=array('id'=>$this->id);
|
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
|
||||||
{
|
|
||||||
$result=$this->insertExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($reshook < 0) $error++;
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set status to validated
|
* Set status to validated
|
||||||
*
|
*
|
||||||
@ -2257,8 +2263,8 @@ class Propal extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user Object user that close
|
* @param User $user Object user that close
|
||||||
* @param int $statut Statut
|
* @param int $statut Statut
|
||||||
* @param string $note Comment
|
* @param string $note Complete private note with this note
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function cloture($user, $statut, $note, $notrigger=0)
|
function cloture($user, $statut, $note, $notrigger=0)
|
||||||
@ -2270,8 +2276,10 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
$newprivatenote = dol_concatdesc($this->note_private, $note);
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||||
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($note)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
|
$sql.= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($newprivatenote)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -2297,7 +2305,7 @@ class Propal extends CommonObject
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($statut == self::STATUS_BILLED)
|
if ($statut == self::STATUS_BILLED) // Why this ?
|
||||||
{
|
{
|
||||||
$trigger_name='PROPAL_CLASSIFY_BILLED';
|
$trigger_name='PROPAL_CLASSIFY_BILLED';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -947,7 +947,7 @@ if ($resql)
|
|||||||
|
|
||||||
$filedir=$diroutputmassaction;
|
$filedir=$diroutputmassaction;
|
||||||
$genallowed=$user->rights->propal->lire;
|
$genallowed=$user->rights->propal->lire;
|
||||||
$delallowed=$user->rights->propal->lire;
|
$delallowed=$user->rights->propal->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
|
print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'','');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1686,6 +1686,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||||
|
|
||||||
|
// Amount
|
||||||
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
|
||||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||||
@ -2571,8 +2573,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||||
$filedir = $conf->commande->dir_output . '/' . $comref;
|
$filedir = $conf->commande->dir_output . '/' . $comref;
|
||||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
$genallowed = $user->rights->commande->creer;
|
$genallowed = $user->rights->commande->lire;
|
||||||
$delallowed = $user->rights->commande->supprimer;
|
$delallowed = $user->rights->commande->creer;
|
||||||
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
* @url GET /order/list
|
* @url GET /order/list
|
||||||
* @return array Array of order objects
|
* @return array Array of order objects
|
||||||
*/
|
*/
|
||||||
function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $societe = 0) {
|
function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode=0, $societe = 0) {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
@ -316,7 +316,7 @@ class CommandeApi extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -52,9 +52,9 @@ class Orders extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get properties of a commande object
|
* Get properties of an order object
|
||||||
*
|
*
|
||||||
* Return an array with commande informations
|
* Return an array with order informations
|
||||||
*
|
*
|
||||||
* @param int $id ID of order
|
* @param int $id ID of order
|
||||||
* @return array|mixed data without useless information
|
* @return array|mixed data without useless information
|
||||||
@ -176,7 +176,7 @@ class Orders extends DolibarrApi
|
|||||||
* Create order object
|
* Create order object
|
||||||
*
|
*
|
||||||
* @param array $request_data Request data
|
* @param array $request_data Request data
|
||||||
* @return int ID of commande
|
* @return int ID of order
|
||||||
*/
|
*/
|
||||||
function post($request_data = NULL)
|
function post($request_data = NULL)
|
||||||
{
|
{
|
||||||
@ -196,6 +196,7 @@ class Orders extends DolibarrApi
|
|||||||
}
|
}
|
||||||
$this->commande->lines = $lines;
|
$this->commande->lines = $lines;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if ($this->commande->create(DolibarrApiAccess::$user) < 0) {
|
if ($this->commande->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors));
|
throw new RestException(500, "Error creating order", array_merge(array($this->commande->error), $this->commande->errors));
|
||||||
}
|
}
|
||||||
@ -236,8 +237,8 @@ class Orders extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Add a line to given order
|
* Add a line to given order
|
||||||
*
|
*
|
||||||
* @param int $id Id of commande to update
|
* @param int $id Id of order to update
|
||||||
* @param array $request_data Orderline data
|
* @param array $request_data OrderLine data
|
||||||
*
|
*
|
||||||
* @url POST {id}/lines
|
* @url POST {id}/lines
|
||||||
*
|
*
|
||||||
@ -281,12 +282,13 @@ class Orders extends DolibarrApi
|
|||||||
$request_data->label,
|
$request_data->label,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->fk_unit,
|
$request_data->fk_unit,
|
||||||
$this->element,
|
$request_data->origin,
|
||||||
$request_data->id
|
$request_data->origin_id,
|
||||||
|
$request_data->multicurrency_subprice
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -295,9 +297,9 @@ class Orders extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Update a line to given order
|
* Update a line to given order
|
||||||
*
|
*
|
||||||
* @param int $id Id of commande to update
|
* @param int $id Id of order to update
|
||||||
* @param int $lineid Id of line to update
|
* @param int $lineid Id of line to update
|
||||||
* @param array $request_data Orderline data
|
* @param array $request_data OrderLine data
|
||||||
*
|
*
|
||||||
* @url PUT {id}/lines/{lineid}
|
* @url PUT {id}/lines/{lineid}
|
||||||
*
|
*
|
||||||
@ -310,7 +312,7 @@ class Orders extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commande not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
@ -338,7 +340,8 @@ class Orders extends DolibarrApi
|
|||||||
$request_data->label,
|
$request_data->label,
|
||||||
$request_data->special_code,
|
$request_data->special_code,
|
||||||
$request_data->array_options,
|
$request_data->array_options,
|
||||||
$request_data->fk_unit
|
$request_data->fk_unit,
|
||||||
|
$request_data->multicurrency_subprice
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
@ -387,7 +390,7 @@ class Orders extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Update order general fields (won't touch lines of order)
|
* Update order general fields (won't touch lines of order)
|
||||||
*
|
*
|
||||||
* @param int $id Id of commande to update
|
* @param int $id Id of order to update
|
||||||
* @param array $request_data Datas
|
* @param array $request_data Datas
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
@ -399,7 +402,7 @@ class Orders extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->commande->fetch($id);
|
$result = $this->commande->fetch($id);
|
||||||
if( ! $result ) {
|
if( ! $result ) {
|
||||||
throw new RestException(404, 'Commande not found');
|
throw new RestException(404, 'Order not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
@ -498,6 +501,47 @@ class Orders extends DolibarrApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close an order (Classify it as "Delivered")
|
||||||
|
*
|
||||||
|
* @param int $id Order ID
|
||||||
|
* @param int $notrigger Disabled triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/close
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function close($id, $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->commande->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Order not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->commande->cloture(DolibarrApiAccess::$user, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already closed');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when closing Order: '.$this->commande->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Order closed (Ref='.$this->commande->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean sensible object datas
|
* Clean sensible object datas
|
||||||
*
|
*
|
||||||
@ -509,6 +553,10 @@ class Orders extends DolibarrApi
|
|||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
unset($object->address);
|
unset($object->address);
|
||||||
|
unset($object->barcode_type);
|
||||||
|
unset($object->barcode_type_code);
|
||||||
|
unset($object->barcode_type_label);
|
||||||
|
unset($object->barcode_type_coder);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -557,9 +557,10 @@ class Commande extends CommonOrder
|
|||||||
* Close order
|
* Close order
|
||||||
*
|
*
|
||||||
* @param User $user Objet user that close
|
* @param User $user Objet user that close
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function cloture($user)
|
function cloture($user, $notrigger=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -579,11 +580,14 @@ class Commande extends CommonOrder
|
|||||||
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
$sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('ORDER_CLOSE',$user);
|
$result=$this->call_trigger('ORDER_CLOSE',$user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -873,6 +877,11 @@ class Commande extends CommonOrder
|
|||||||
{
|
{
|
||||||
$this->ref = $initialref;
|
$this->ref = $initialref;
|
||||||
|
|
||||||
|
if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
|
{
|
||||||
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
|
}
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
@ -885,7 +894,7 @@ class Commande extends CommonOrder
|
|||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -896,7 +905,7 @@ class Commande extends CommonOrder
|
|||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1077,11 +1086,12 @@ class Commande extends CommonOrder
|
|||||||
* Load an object from a proposal and create a new order into database
|
* Load an object from a proposal and create a new order into database
|
||||||
*
|
*
|
||||||
* @param Object $object Object source
|
* @param Object $object Object source
|
||||||
|
* @param User $user User making creation
|
||||||
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
||||||
*/
|
*/
|
||||||
function createFromProposal($object)
|
function createFromProposal($object, User $user)
|
||||||
{
|
{
|
||||||
global $conf,$user,$hookmanager;
|
global $conf, $hookmanager;
|
||||||
|
|
||||||
dol_include_once('/core/class/extrafields.class.php');
|
dol_include_once('/core/class/extrafields.class.php');
|
||||||
|
|
||||||
@ -1240,7 +1250,7 @@ class Commande extends CommonOrder
|
|||||||
{
|
{
|
||||||
global $mysoc, $conf, $langs, $user;
|
global $mysoc, $conf, $langs, $user;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
@ -1548,7 +1558,7 @@ class Commande extends CommonOrder
|
|||||||
$sql.= ', c.fk_shipping_method';
|
$sql.= ', c.fk_shipping_method';
|
||||||
$sql.= ', c.fk_warehouse';
|
$sql.= ', c.fk_warehouse';
|
||||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
||||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.last_main_doc, c.fk_delivery_address, c.extraparams';
|
||||||
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
||||||
$sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc";
|
$sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc";
|
||||||
$sql.= ", i.libelle as libelle_incoterms";
|
$sql.= ", i.libelle as libelle_incoterms";
|
||||||
@ -1603,6 +1613,7 @@ class Commande extends CommonOrder
|
|||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
$this->fk_project = $obj->fk_projet;
|
$this->fk_project = $obj->fk_projet;
|
||||||
$this->modelpdf = $obj->model_pdf;
|
$this->modelpdf = $obj->model_pdf;
|
||||||
|
$this->last_main_doc = $obj->last_main_doc;
|
||||||
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
$this->mode_reglement_id = $obj->fk_mode_reglement;
|
||||||
$this->mode_reglement_code = $obj->mode_reglement_code;
|
$this->mode_reglement_code = $obj->mode_reglement_code;
|
||||||
$this->mode_reglement = $obj->mode_reglement_libelle;
|
$this->mode_reglement = $obj->mode_reglement_libelle;
|
||||||
@ -3048,48 +3059,6 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update value of extrafields on order
|
|
||||||
*
|
|
||||||
* @param User $user Object user that modify
|
|
||||||
* @return int <0 if ko, >0 if ok
|
|
||||||
*/
|
|
||||||
function update_extrafields($user)
|
|
||||||
{
|
|
||||||
global $hookmanager, $conf;
|
|
||||||
|
|
||||||
$action='create';
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
|
||||||
// TODO le hook fait double emploi avec le trigger !!
|
|
||||||
$hookmanager->initHooks(array('orderdao'));
|
|
||||||
$parameters=array('id'=>$this->id);
|
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
|
||||||
{
|
|
||||||
$result=$this->insertExtraFields();
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ($reshook < 0) $error++;
|
|
||||||
|
|
||||||
if (!$error)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the customer order
|
* Delete the customer order
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1397,7 +1397,7 @@ if ($resql)
|
|||||||
|
|
||||||
$filedir=$diroutputmassaction;
|
$filedir=$diroutputmassaction;
|
||||||
$genallowed=$user->rights->commande->lire;
|
$genallowed=$user->rights->commande->lire;
|
||||||
$delallowed=$user->rights->commande->supprimer;
|
$delallowed=$user->rights->commande->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1114,7 +1114,7 @@ if ($resql)
|
|||||||
$bankstatic->id=$banklinestatic->fk_account;
|
$bankstatic->id=$banklinestatic->fk_account;
|
||||||
$bankstatic->label=$banklinestatic->bank_account_ref;
|
$bankstatic->label=$banklinestatic->bank_account_ref;
|
||||||
print ' ('.$langs->trans("TransferFrom").' ';
|
print ' ('.$langs->trans("TransferFrom").' ';
|
||||||
print $bankstatic->getNomUrl(1);
|
print $bankstatic->getNomUrl(1,'transactions');
|
||||||
print ' '.$langs->trans("toward").' ';
|
print ' '.$langs->trans("toward").' ';
|
||||||
$bankstatic->id=$objp->bankid;
|
$bankstatic->id=$objp->bankid;
|
||||||
$bankstatic->label=$objp->bankref;
|
$bankstatic->label=$objp->bankref;
|
||||||
@ -1131,7 +1131,7 @@ if ($resql)
|
|||||||
$banklinestatic->fetch($links[$key]['url_id']);
|
$banklinestatic->fetch($links[$key]['url_id']);
|
||||||
$bankstatic->id=$banklinestatic->fk_account;
|
$bankstatic->id=$banklinestatic->fk_account;
|
||||||
$bankstatic->label=$banklinestatic->bank_account_ref;
|
$bankstatic->label=$banklinestatic->bank_account_ref;
|
||||||
print $bankstatic->getNomUrl(1);
|
print $bankstatic->getNomUrl(1,'transactions');
|
||||||
print ')';
|
print ')';
|
||||||
}
|
}
|
||||||
//var_dump($links);
|
//var_dump($links);
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class BankAccounts extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $sqlfilters = '')
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
$list = array();
|
$list = array();
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ $hookmanager->initHooks(array($contextpage));
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('bankaccount');
|
$extralabels = $extrafields->fetch_name_optionals_label('bank_account');
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
@ -143,7 +143,7 @@ $title=$langs->trans('BankAccounts');
|
|||||||
// Load array of financial accounts (opened by default)
|
// Load array of financial accounts (opened by default)
|
||||||
$accounts = array();
|
$accounts = array();
|
||||||
|
|
||||||
$sql = "SELECT rowid, label, courant, rappro, account_number, fk_accountancy_journal, currency_code, datec as date_creation, tms as date_update";
|
$sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_accountancy_journal, b.currency_code, b.datec as date_creation, b.tms as date_update";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
@ -151,7 +151,7 @@ $parameters=array();
|
|||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bankcacount_extrafields as ef on (c.rowid = ef.fk_object)";
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||||
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
|
$sql.= " WHERE entity IN (".getEntity('bank_account').")";
|
||||||
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
||||||
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
||||||
|
|||||||
@ -4364,8 +4364,8 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||||
$genallowed = $user->rights->facture->creer;
|
$genallowed = $user->rights->facture->lire;
|
||||||
$delallowed = $user->rights->facture->supprimer;
|
$delallowed = $user->rights->facture->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||||
$somethingshown = $formfile->numoffiles;
|
$somethingshown = $formfile->numoffiles;
|
||||||
@ -4378,7 +4378,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Show online payment link
|
// Show online payment link
|
||||||
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));
|
||||||
|
|
||||||
if ($object->statut != 0 && $useonlinepayment)
|
if ($object->statut != Facture::STATUS_DRAFT && $useonlinepayment)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class InvoiceApi extends DolibarrApi
|
|||||||
* @url GET thirdparty/{socid}/invoice/list
|
* @url GET thirdparty/{socid}/invoice/list
|
||||||
* @url GET thirdparty/{socid}/invoice/list/{mode}
|
* @url GET thirdparty/{socid}/invoice/list/{mode}
|
||||||
*/
|
*/
|
||||||
function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid=0, $mode='') {
|
function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $socid=0, $mode='') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
|
|||||||
@ -75,6 +75,7 @@ class Invoices extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->invoice->fetchObjectLinked();
|
||||||
return $this->_cleanObjectDatas($this->invoice);
|
return $this->_cleanObjectDatas($this->invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ class Invoices extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException
|
* @throws RestException
|
||||||
*/
|
*/
|
||||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
$obj_ret = array();
|
$obj_ret = array();
|
||||||
@ -210,6 +211,142 @@ class Invoices extends DolibarrApi
|
|||||||
return $this->invoice->id;
|
return $this->invoice->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get lines of an invoice
|
||||||
|
*
|
||||||
|
* @param int $id Id of invoice
|
||||||
|
*
|
||||||
|
* @url GET {id}/lines
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getLines($id) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$this->invoice->getLinesArray();
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->invoice->lines as $line) {
|
||||||
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a line to a given invoice
|
||||||
|
*
|
||||||
|
* @param int $id Id of invoice to update
|
||||||
|
* @param int $lineid Id of line to update
|
||||||
|
* @param array $request_data InvoiceLine data
|
||||||
|
*
|
||||||
|
* @url PUT {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function putLine($id, $lineid, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
$updateRes = $this->invoice->updateline(
|
||||||
|
$lineid,
|
||||||
|
$request_data->desc,
|
||||||
|
$request_data->subprice,
|
||||||
|
$request_data->qty,
|
||||||
|
$request_data->remise_percent,
|
||||||
|
$request_data->date_start,
|
||||||
|
$request_data->date_end,
|
||||||
|
$request_data->tva_tx,
|
||||||
|
$request_data->localtax1_tx,
|
||||||
|
$request_data->localtax2_tx,
|
||||||
|
'HT',
|
||||||
|
$request_data->info_bits,
|
||||||
|
$request_data->product_type,
|
||||||
|
$request_data->fk_parent_line,
|
||||||
|
0,
|
||||||
|
$request_data->fk_fournprice,
|
||||||
|
$request_data->pa_ht,
|
||||||
|
$request_data->label,
|
||||||
|
$request_data->special_code,
|
||||||
|
$request_data->array_options,
|
||||||
|
$request_data->situation_percent,
|
||||||
|
$request_data->fk_unit,
|
||||||
|
$request_data->multicurrency_subprice
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
$result = $this->get($id);
|
||||||
|
unset($result->line);
|
||||||
|
return $this->_cleanObjectDatas($result);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes a line of a given invoice
|
||||||
|
*
|
||||||
|
* @param int $id Id of invoice
|
||||||
|
* @param int $lineid Id of the line to delete
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @throws 400
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
* @throws 405
|
||||||
|
*/
|
||||||
|
function deleteLine($id, $lineid) {
|
||||||
|
|
||||||
|
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
if(empty($lineid)) {
|
||||||
|
throw new RestException(400, 'Line ID is mandatory');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Invoice not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->deleteline($lineid);
|
||||||
|
if( $result < 0) {
|
||||||
|
throw new RestException(405, $this->invoice->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->invoice->fetch($id);
|
||||||
|
|
||||||
|
$this->invoice->getLinesArray();
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->invoice->lines as $line) {
|
||||||
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update invoice
|
* Update invoice
|
||||||
*
|
*
|
||||||
@ -276,95 +413,15 @@ class Invoices extends DolibarrApi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get lines of a given invoice
|
|
||||||
*
|
|
||||||
* @param int $id Id of invoice
|
|
||||||
*
|
|
||||||
* @url GET {id}/lines
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function getLines($id) {
|
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'Invoice not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
$this->invoice->getLinesArray();
|
|
||||||
$result = array();
|
|
||||||
foreach ($this->invoice->lines as $line) {
|
|
||||||
array_push($result,$this->_cleanObjectDatas($line));
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes a line of a given invoice
|
|
||||||
*
|
|
||||||
* @param int $id Id of invoice
|
|
||||||
* @param int $lineid Id of the line to delete
|
|
||||||
*
|
|
||||||
* @url DELETE {id}/lines/{lineid}
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws 400
|
|
||||||
* @throws 401
|
|
||||||
* @throws 404
|
|
||||||
* @throws 405
|
|
||||||
*/
|
|
||||||
function deleteLine($id, $lineid) {
|
|
||||||
|
|
||||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
|
||||||
throw new RestException(401);
|
|
||||||
}
|
|
||||||
if(empty($lineid)) {
|
|
||||||
throw new RestException(400, 'Line ID is mandatory');
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ! DolibarrApi::_checkAccessToResource('facture',$id)) {
|
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
|
||||||
if( ! $result ) {
|
|
||||||
throw new RestException(404, 'Invoice not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->invoice->deleteline($lineid);
|
|
||||||
if( $result < 0) {
|
|
||||||
throw new RestException(405, $this->invoice->error);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $this->invoice->fetch($id);
|
|
||||||
|
|
||||||
$this->invoice->getLinesArray();
|
|
||||||
$result = array();
|
|
||||||
foreach ($this->invoice->lines as $line) {
|
|
||||||
array_push($result,$this->_cleanObjectDatas($line));
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a line to a given invoice
|
* Add a line to a given invoice
|
||||||
*
|
*
|
||||||
* Exemple of POST query : { "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000", "fk_product": "1", "remise_percent": "0", "date_start": "", "date_end": "", "fk_code_ventilation": 0, "info_bits": "0", "fk_remise_except": null, "product_type": "1", "rang": "-1", "special_code": "0", "fk_parent_line": null, "fk_fournprice": null, "pa_ht": "0.00000000", "label": "", "array_options": [], "situation_percent": "100", "fk_prev_id": null, "fk_unit": null }
|
* Exemple of POST query : { "desc": "Desc", "subprice": "1.00000000", "qty": "1", "tva_tx": "20.000", "localtax1_tx": "0.000", "localtax2_tx": "0.000", "fk_product": "1", "remise_percent": "0", "date_start": "", "date_end": "", "fk_code_ventilation": 0, "info_bits": "0", "fk_remise_except": null, "product_type": "1", "rang": "-1", "special_code": "0", "fk_parent_line": null, "fk_fournprice": null, "pa_ht": "0.00000000", "label": "", "array_options": [], "situation_percent": "100", "fk_prev_id": null, "fk_unit": null }
|
||||||
*
|
*
|
||||||
* @param int $id Id of invoice
|
* @param int $id Id of invoice
|
||||||
* @param array $request_data Invoiceline data
|
* @param array $request_data InvoiceLine data
|
||||||
*
|
*
|
||||||
* @url POST {id}/addline
|
* @url POST {id}/lines
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -421,7 +478,7 @@ class Invoices extends DolibarrApi
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($updateRes > 0) {
|
if ($updateRes > 0) {
|
||||||
return $this->get($id)->line->rowid;
|
return $updateRes;
|
||||||
|
|
||||||
}
|
}
|
||||||
throw new RestException(400, 'Unable to insert the new line. Check your inputs.');
|
throw new RestException(400, 'Unable to insert the new line. Check your inputs.');
|
||||||
@ -482,7 +539,7 @@ class Invoices extends DolibarrApi
|
|||||||
/**
|
/**
|
||||||
* Validate an invoice
|
* Validate an invoice
|
||||||
*
|
*
|
||||||
* @param int $id Order ID
|
* @param int $id Invoice ID
|
||||||
* @param int $idwarehouse Warehouse ID
|
* @param int $idwarehouse Warehouse ID
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
*
|
*
|
||||||
@ -600,6 +657,10 @@ class Invoices extends DolibarrApi
|
|||||||
$object = parent::_cleanObjectDatas($object);
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
unset($object->address);
|
unset($object->address);
|
||||||
|
unset($object->barcode_type);
|
||||||
|
unset($object->barcode_type_code);
|
||||||
|
unset($object->barcode_type_label);
|
||||||
|
unset($object->barcode_type_coder);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,10 +201,19 @@ class FactureRec extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
|
{
|
||||||
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
|
}
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
foreach($this->linked_objects as $origin => $origin_id)
|
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
|
{
|
||||||
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
|
{
|
||||||
|
foreach($tmp_origin_id as $origin_id)
|
||||||
{
|
{
|
||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
@ -214,6 +223,18 @@ class FactureRec extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||||
|
{
|
||||||
|
$origin_id = $tmp_origin_id;
|
||||||
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
|
if (! $ret)
|
||||||
|
{
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -448,6 +448,11 @@ class Facture extends CommonInvoice
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql) $error++;
|
if (! $resql) $error++;
|
||||||
|
|
||||||
|
if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
|
{
|
||||||
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
|
}
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
@ -460,7 +465,7 @@ class Facture extends CommonInvoice
|
|||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -471,7 +476,7 @@ class Facture extends CommonInvoice
|
|||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -747,7 +752,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param int $invertdetail Reverse sign of amounts for lines
|
* @param int $invertdetail Reverse sign of amounts for lines
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function createFromCurrent($user,$invertdetail=0)
|
function createFromCurrent(User $user, $invertdetail=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -948,11 +953,12 @@ class Facture extends CommonInvoice
|
|||||||
* Load an object from an order and create a new invoice into database
|
* Load an object from an order and create a new invoice into database
|
||||||
*
|
*
|
||||||
* @param Object $object Object source
|
* @param Object $object Object source
|
||||||
|
* @param User $user Object user
|
||||||
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
* @return int <0 if KO, 0 if nothing done, 1 if OK
|
||||||
*/
|
*/
|
||||||
function createFromOrder($object)
|
function createFromOrder($object, User $user)
|
||||||
{
|
{
|
||||||
global $user,$hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
@ -1192,7 +1198,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ', f.datec as datec';
|
$sql.= ', f.datec as datec';
|
||||||
$sql.= ', f.date_valid as datev';
|
$sql.= ', f.date_valid as datev';
|
||||||
$sql.= ', f.tms as datem';
|
$sql.= ', f.tms as datem';
|
||||||
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc';
|
||||||
$sql.= ', f.fk_facture_source';
|
$sql.= ', f.fk_facture_source';
|
||||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams';
|
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet, f.extraparams';
|
||||||
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
|
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
|
||||||
@ -1261,6 +1267,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->user_author = $obj->fk_user_author;
|
$this->user_author = $obj->fk_user_author;
|
||||||
$this->user_valid = $obj->fk_user_valid;
|
$this->user_valid = $obj->fk_user_valid;
|
||||||
$this->modelpdf = $obj->model_pdf;
|
$this->modelpdf = $obj->model_pdf;
|
||||||
|
$this->last_main_doc = $obj->last_main_doc;
|
||||||
$this->situation_cycle_ref = $obj->situation_cycle_ref;
|
$this->situation_cycle_ref = $obj->situation_cycle_ref;
|
||||||
$this->situation_counter = $obj->situation_counter;
|
$this->situation_counter = $obj->situation_counter;
|
||||||
$this->situation_final = $obj->situation_final;
|
$this->situation_final = $obj->situation_final;
|
||||||
@ -2686,6 +2693,11 @@ class Facture extends CommonInvoice
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2698,7 +2710,7 @@ class Facture extends CommonInvoice
|
|||||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||||
* @param int $date_start Date de debut de validite du service
|
* @param int $date_start Date de debut de validite du service
|
||||||
* @param int $date_end Date de fin de validite du service
|
* @param int $date_end Date de fin de validite du service
|
||||||
* @param double $txtva VAT Rate
|
* @param double $txtva VAT Rate (Can be '8.5', '8.5 (ABC)')
|
||||||
* @param double $txlocaltax1 Local tax 1 rate
|
* @param double $txlocaltax1 Local tax 1 rate
|
||||||
* @param double $txlocaltax2 Local tax 2 rate
|
* @param double $txlocaltax2 Local tax 2 rate
|
||||||
* @param string $price_base_type HT or TTC
|
* @param string $price_base_type HT or TTC
|
||||||
|
|||||||
@ -1247,7 +1247,7 @@ if ($resql)
|
|||||||
|
|
||||||
$filedir=$diroutputmassaction;
|
$filedir=$diroutputmassaction;
|
||||||
$genallowed=$user->rights->facture->lire;
|
$genallowed=$user->rights->facture->lire;
|
||||||
$delallowed=$user->rights->facture->lire;
|
$delallowed=$user->rights->facture->creer;
|
||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ dol_mkdir($dir);
|
|||||||
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
|
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
|
||||||
if ($mode == 'customer')
|
if ($mode == 'customer')
|
||||||
{
|
{
|
||||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||||
}
|
}
|
||||||
if ($mode == 'supplier')
|
if ($mode == 'supplier')
|
||||||
{
|
{
|
||||||
@ -227,12 +227,13 @@ complete_head_from_modules($conf,$langs,null,$head,$h,$type);
|
|||||||
|
|
||||||
dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
|
||||||
|
|
||||||
|
// We use select_thirdparty_list instead of select_company so we can use $filter and share same code for customer and supplier.
|
||||||
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
$tmp_companies = $form->select_thirdparty_list($socid, 'socid', $filter, 1, 0, 0, array(), '', 1);
|
||||||
//Array passed as an argument to Form::selectarray to build a proper select input
|
//Array passed as an argument to Form::selectarray to build a proper select input
|
||||||
$companies = array();
|
$companies = array();
|
||||||
|
|
||||||
foreach ($tmp_companies as $value) {
|
foreach ($tmp_companies as $value) {
|
||||||
$companies[$value['value']] = $value['label'];
|
$companies[$value['key']] = $value['label'];
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||||
|
|||||||
@ -169,6 +169,20 @@ if ($action == 'create')
|
|||||||
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
|
$charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype;
|
||||||
|
|
||||||
$total = $charge->amount;
|
$total = $charge->amount;
|
||||||
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
|
|
||||||
|
//Add js for AutoFill
|
||||||
|
print ' $(document).ready(function () {';
|
||||||
|
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){
|
||||||
|
var amount = $(this).data("value");
|
||||||
|
document.getElementById($(this).data(\'rowid\')).value = amount ;
|
||||||
|
});';
|
||||||
|
print ' });'."\n";
|
||||||
|
|
||||||
|
print ' </script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("DoPayment"));
|
print load_fiche_titre($langs->trans("DoPayment"));
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
@ -188,14 +202,12 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("SocialContribution")."</td></tr>";
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Ref").'</td><td><a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid.'">'.$chid.'</a></td></tr>';
|
|
||||||
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Type")."</td><td>".$charge->type_libelle."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Period")."</td><td>".dol_print_date($charge->periode,'day')."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$charge->lib."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
/*print '<tr><td>'.$langs->trans("DateDue")."</td><td>".dol_print_date($charge->date_ech,'day')."</td></tr>\n";
|
||||||
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount")."</td><td>".price($charge->amount,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
||||||
|
|
||||||
$sql = "SELECT sum(p.amount) as total";
|
$sql = "SELECT sum(p.amount) as total";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||||
@ -207,12 +219,8 @@ if ($action == 'create')
|
|||||||
$sumpaid = $obj->total;
|
$sumpaid = $obj->total;
|
||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
|
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
print "<td colspan=\"2\">".$langs->trans("Payment").'</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||||
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$datepaye = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
@ -294,7 +302,12 @@ if ($action == 'create')
|
|||||||
if ($sumpaid < $objp->amount)
|
if ($sumpaid < $objp->amount)
|
||||||
{
|
{
|
||||||
$namef = "amount_".$objp->id;
|
$namef = "amount_".$objp->id;
|
||||||
print '<input type="text" size="8" name="'.$namef.'">';
|
$nameRemain = "remain_".$objp->id;
|
||||||
|
if (!empty($conf->use_javascript_ajax))
|
||||||
|
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'");
|
||||||
|
$remaintopay=$objp->amount - $sumpaid;
|
||||||
|
print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||||
|
print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -654,7 +654,9 @@ if ($id > 0)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<tr class="oddeven"><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
|
print '<tr class="oddeven"><td class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||||
|
print '<td></td><td></td><td></td><td></td>';
|
||||||
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
print '<tr><td colspan="'.$nbcols.'" align="right">'.$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
|
||||||
|
|||||||
@ -88,6 +88,7 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer)
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -42,6 +42,8 @@ $socid = GETPOST('socid','int');
|
|||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||||
|
|
||||||
|
$object = new ChargeSociales($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -68,7 +70,6 @@ $title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Info");
|
|||||||
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
$help_url = 'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
|
||||||
llxHeader("",$title,$help_url);
|
llxHeader("",$title,$help_url);
|
||||||
|
|
||||||
$object = new ChargeSociales($db);
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->info($id);
|
$object->info($id);
|
||||||
|
|
||||||
|
|||||||
@ -2124,8 +2124,8 @@ else
|
|||||||
$filename = dol_sanitizeFileName($object->ref);
|
$filename = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
$filedir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||||
$genallowed = $user->rights->contrat->creer;
|
$genallowed = $user->rights->contrat->lire;
|
||||||
$delallowed = $user->rights->contrat->supprimer;
|
$delallowed = $user->rights->contrat->creer;
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
|
|||||||
532
htdocs/contrat/class/api_contracts.class.php
Normal file
532
htdocs/contrat/class/api_contracts.class.php
Normal file
@ -0,0 +1,532 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
|
* Copyright (C) 2016 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API class for contracts
|
||||||
|
*
|
||||||
|
* @access protected
|
||||||
|
* @class DolibarrApiAccess {@requires user,external}
|
||||||
|
*/
|
||||||
|
class Contracts extends DolibarrApi
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
|
*/
|
||||||
|
static $FIELDS = array(
|
||||||
|
'socid',
|
||||||
|
'date_contrat',
|
||||||
|
'commercial_signature_id',
|
||||||
|
'commercial_suivi_id'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Contract $contract {@type Contrat}
|
||||||
|
*/
|
||||||
|
public $contract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
global $db, $conf;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->contract = new Contrat($this->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get properties of a contrat object
|
||||||
|
*
|
||||||
|
* Return an array with contrat informations
|
||||||
|
*
|
||||||
|
* @param int $id ID of contract
|
||||||
|
* @return array|mixed data without useless information
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function get($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->contract->fetchObjectLinked();
|
||||||
|
return $this->_cleanObjectDatas($this->contract);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List contracts
|
||||||
|
*
|
||||||
|
* Get a list of contracts
|
||||||
|
*
|
||||||
|
* @param string $sortfield Sort field
|
||||||
|
* @param string $sortorder Sort order
|
||||||
|
* @param int $limit Limit for list
|
||||||
|
* @param int $page Page number
|
||||||
|
* @param string $thirdparty_ids Thirdparty ids to filter contracts of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
|
||||||
|
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
|
* @return array Array of contract objects
|
||||||
|
*
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
|
||||||
|
global $db, $conf;
|
||||||
|
|
||||||
|
$obj_ret = array();
|
||||||
|
|
||||||
|
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
|
||||||
|
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
|
||||||
|
|
||||||
|
// If the internal user must only see his customers, force searching by him
|
||||||
|
$search_sale = 0;
|
||||||
|
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||||
|
|
||||||
|
$sql = "SELECT t.rowid";
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as t";
|
||||||
|
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||||
|
|
||||||
|
$sql.= ' WHERE t.entity IN ('.getEntity('contrat').')';
|
||||||
|
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||||
|
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||||
|
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
|
// Insert sale filter
|
||||||
|
if ($search_sale > 0)
|
||||||
|
{
|
||||||
|
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||||
|
}
|
||||||
|
// Add sql filters
|
||||||
|
if ($sqlfilters)
|
||||||
|
{
|
||||||
|
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||||
|
{
|
||||||
|
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||||
|
}
|
||||||
|
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||||
|
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql.= $db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) {
|
||||||
|
if ($page < 0)
|
||||||
|
{
|
||||||
|
$page = 0;
|
||||||
|
}
|
||||||
|
$offset = $limit * $page;
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog("API Rest request");
|
||||||
|
$result = $db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||||
|
while ($i < $min)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
$contrat_static = new Contrat($db);
|
||||||
|
if($contrat_static->fetch($obj->rowid)) {
|
||||||
|
$obj_ret[] = $this->_cleanObjectDatas($contrat_static);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new RestException(503, 'Error when retrieve contrat list : '.$db->lasterror());
|
||||||
|
}
|
||||||
|
if( ! count($obj_ret)) {
|
||||||
|
throw new RestException(404, 'No contract found');
|
||||||
|
}
|
||||||
|
return $obj_ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create contract object
|
||||||
|
*
|
||||||
|
* @param array $request_data Request data
|
||||||
|
* @return int ID of contrat
|
||||||
|
*/
|
||||||
|
function post($request_data = NULL)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401, "Insuffisant rights");
|
||||||
|
}
|
||||||
|
// Check mandatory fields
|
||||||
|
$result = $this->_validate($request_data);
|
||||||
|
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
$this->contract->$field = $value;
|
||||||
|
}
|
||||||
|
/*if (isset($request_data["lines"])) {
|
||||||
|
$lines = array();
|
||||||
|
foreach ($request_data["lines"] as $line) {
|
||||||
|
array_push($lines, (object) $line);
|
||||||
|
}
|
||||||
|
$this->contract->lines = $lines;
|
||||||
|
}*/
|
||||||
|
if ($this->contract->create(DolibarrApiAccess::$user) < 0) {
|
||||||
|
throw new RestException(500, "Error creating contract", array_merge(array($this->contract->error), $this->contract->errors));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->contract->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get lines of a contract
|
||||||
|
*
|
||||||
|
* @param int $id Id of contract
|
||||||
|
*
|
||||||
|
* @url GET {id}/lines
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getLines($id) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->lire) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$this->contract->getLinesArray();
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->contract->lines as $line) {
|
||||||
|
array_push($result,$this->_cleanObjectDatas($line));
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a line to given contract
|
||||||
|
*
|
||||||
|
* @param int $id Id of contrat to update
|
||||||
|
* @param array $request_data Contractline data
|
||||||
|
*
|
||||||
|
* @url POST {id}/lines
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function postLine($id, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
$updateRes = $this->contract->addline(
|
||||||
|
$request_data->desc,
|
||||||
|
$request_data->subprice,
|
||||||
|
$request_data->qty,
|
||||||
|
$request_data->tva_tx,
|
||||||
|
$request_data->localtax1_tx,
|
||||||
|
$request_data->localtax2_tx,
|
||||||
|
$request_data->fk_product,
|
||||||
|
$request_data->remise_percent,
|
||||||
|
$request_data->date_start, // date ouverture = date_start_real
|
||||||
|
$request_data->date_end, // date_cloture = date_end_real
|
||||||
|
$request_data->HT,
|
||||||
|
$request_data->subprice_excl_tax,
|
||||||
|
$request_data->info_bits,
|
||||||
|
$request_data->fk_fournprice,
|
||||||
|
$request_data->pa_ht,
|
||||||
|
$request_data->array_options,
|
||||||
|
$request_data->fk_unit,
|
||||||
|
$request_data->rang
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
return $updateRes;
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update a line to given contract
|
||||||
|
*
|
||||||
|
* @param int $id Id of contrat to update
|
||||||
|
* @param int $lineid Id of line to update
|
||||||
|
* @param array $request_data Contractline data
|
||||||
|
*
|
||||||
|
* @url PUT {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
function putLine($id, $lineid, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
|
||||||
|
$updateRes = $this->contract->updateline(
|
||||||
|
$lineid,
|
||||||
|
$request_data->desc,
|
||||||
|
$request_data->subprice,
|
||||||
|
$request_data->qty,
|
||||||
|
$request_data->remise_percent,
|
||||||
|
$request_data->date_ouveture_prevue,
|
||||||
|
$request_data->date_fin_validite,
|
||||||
|
$request_data->tva_tx,
|
||||||
|
$request_data->localtax1_tx,
|
||||||
|
$request_data->localtax2_tx,
|
||||||
|
$request_data->date_ouverture,
|
||||||
|
$request_data->date_cloture,
|
||||||
|
'HT',
|
||||||
|
$request_data->info_bits,
|
||||||
|
$request_data->fk_fourn_price,
|
||||||
|
$request_data->pa_ht,
|
||||||
|
$request_data->array_options,
|
||||||
|
$request_data->fk_unit
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
$result = $this->get($id);
|
||||||
|
unset($result->line);
|
||||||
|
return $this->_cleanObjectDatas($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a line to given contract
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param int $id Id of contract to update
|
||||||
|
* @param int $lineid Id of line to delete
|
||||||
|
*
|
||||||
|
* @url DELETE {id}/lines/{lineid}
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws 401
|
||||||
|
* @throws 404
|
||||||
|
*/
|
||||||
|
function deleteLine($id, $lineid) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_data = (object) $request_data;
|
||||||
|
$updateRes = $this->contract->deleteline($lineid, DolibarrApiAccess::$user);
|
||||||
|
if ($updateRes > 0) {
|
||||||
|
return $this->get($id);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update contract general fields (won't touch lines of contract)
|
||||||
|
*
|
||||||
|
* @param int $id Id of contrat to update
|
||||||
|
* @param array $request_data Datas
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function put($id, $request_data = NULL) {
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contrat not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
foreach($request_data as $field => $value) {
|
||||||
|
if ($field == 'id') continue;
|
||||||
|
$this->contract->$field = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->contract->update(DolibarrApiAccess::$user, 0))
|
||||||
|
return $this->get($id);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete contract
|
||||||
|
*
|
||||||
|
* @param int $id Contract ID
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function delete($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->supprimer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! $this->contract->delete(DolibarrApiAccess::$user)) {
|
||||||
|
throw new RestException(500, 'Error when delete contract : '.$this->contract->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Contract deleted'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate an contract
|
||||||
|
*
|
||||||
|
* @param int $id Contract ID
|
||||||
|
* @param int $idwarehouse Warehouse ID
|
||||||
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
|
*
|
||||||
|
* @url POST {id}/validate
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* FIXME An error 403 is returned if the request has an empty body.
|
||||||
|
* Error message: "Forbidden: Content type `text/plain` is not supported."
|
||||||
|
* Workaround: send this in the body
|
||||||
|
* {
|
||||||
|
* "idwarehouse": 0,
|
||||||
|
* "notrigger": 0
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
function validate($id, $idwarehouse=0, $notrigger=0)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->contrat->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->contract->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Contract not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->contract->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
|
||||||
|
if ($result == 0) {
|
||||||
|
throw new RestException(500, 'Error nothing done. May be object is already validated');
|
||||||
|
}
|
||||||
|
if ($result < 0) {
|
||||||
|
throw new RestException(500, 'Error when validating Contract: '.$this->contract->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'success' => array(
|
||||||
|
'code' => 200,
|
||||||
|
'message' => 'Contract validated (Ref='.$this->contract->ref.')'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean sensible object datas
|
||||||
|
*
|
||||||
|
* @param object $object Object to clean
|
||||||
|
* @return array Array of cleaned object properties
|
||||||
|
*/
|
||||||
|
function _cleanObjectDatas($object) {
|
||||||
|
|
||||||
|
$object = parent::_cleanObjectDatas($object);
|
||||||
|
|
||||||
|
unset($object->address);
|
||||||
|
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate fields before create or update object
|
||||||
|
*
|
||||||
|
* @param array $data Array with data to verify
|
||||||
|
* @return array
|
||||||
|
* @throws RestException
|
||||||
|
*/
|
||||||
|
function _validate($data)
|
||||||
|
{
|
||||||
|
$contrat = array();
|
||||||
|
foreach (Contracts::$FIELDS as $field) {
|
||||||
|
if (!isset($data[$field]))
|
||||||
|
throw new RestException(400, "$field field missing");
|
||||||
|
$contrat[$field] = $data[$field];
|
||||||
|
|
||||||
|
}
|
||||||
|
return $contrat;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -691,8 +691,8 @@ class Contrat extends CommonObject
|
|||||||
$sql.= " d.fk_user_ouverture,";
|
$sql.= " d.fk_user_ouverture,";
|
||||||
$sql.= " d.fk_user_cloture,";
|
$sql.= " d.fk_user_cloture,";
|
||||||
$sql.= " d.fk_unit";
|
$sql.= " d.fk_unit";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
|
||||||
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid";
|
$sql.= " WHERE d.fk_contrat = ".$this->id;
|
||||||
$sql.= " ORDER by d.rowid ASC";
|
$sql.= " ORDER by d.rowid ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||||
@ -728,7 +728,7 @@ class Contrat extends CommonObject
|
|||||||
$line->total_localtax1 = $objp->total_localtax1;
|
$line->total_localtax1 = $objp->total_localtax1;
|
||||||
$line->total_localtax2 = $objp->total_localtax2;
|
$line->total_localtax2 = $objp->total_localtax2;
|
||||||
$line->total_ttc = $objp->total_ttc;
|
$line->total_ttc = $objp->total_ttc;
|
||||||
$line->fk_product = $objp->fk_product;
|
$line->fk_product = (($objp->fk_product > 0)?$objp->fk_product:0);
|
||||||
$line->info_bits = $objp->info_bits;
|
$line->info_bits = $objp->info_bits;
|
||||||
|
|
||||||
$line->fk_fournprice = $objp->fk_fournprice;
|
$line->fk_fournprice = $objp->fk_fournprice;
|
||||||
@ -741,8 +741,16 @@ class Contrat extends CommonObject
|
|||||||
$line->fk_unit = $objp->fk_unit;
|
$line->fk_unit = $objp->fk_unit;
|
||||||
|
|
||||||
$line->ref = $objp->product_ref; // deprecated
|
$line->ref = $objp->product_ref; // deprecated
|
||||||
|
if (empty($objp->fk_product))
|
||||||
|
{
|
||||||
|
$line->label = ''; // deprecated
|
||||||
|
$line->libelle = $objp->description; // deprecated
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$line->label = $objp->product_label; // deprecated
|
$line->label = $objp->product_label; // deprecated
|
||||||
$line->libelle = $objp->product_label; // deprecated
|
$line->libelle = $objp->product_label; // deprecated
|
||||||
|
}
|
||||||
$line->product_ref = $objp->product_ref; // Ref product
|
$line->product_ref = $objp->product_ref; // Ref product
|
||||||
$line->product_desc = $objp->product_desc; // Description product
|
$line->product_desc = $objp->product_desc; // Description product
|
||||||
$line->product_label = $objp->product_label; // Label product
|
$line->product_label = $objp->product_label; // Label product
|
||||||
@ -759,7 +767,7 @@ class Contrat extends CommonObject
|
|||||||
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||||
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||||
|
|
||||||
// Retreive all extrafield for propal
|
// Retreive all extrafield for contract
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$line->fetch_optionals($line->id,$extralabelsline);
|
$line->fetch_optionals($line->id,$extralabelsline);
|
||||||
|
|
||||||
@ -789,108 +797,6 @@ class Contrat extends CommonObject
|
|||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selectionne les lignes contrat liees a aucun produit
|
|
||||||
$sql = "SELECT d.rowid, d.fk_contrat, d.statut, d.qty, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.rowid, d.remise_percent, d.subprice,";
|
|
||||||
$sql.= " d.total_ht,";
|
|
||||||
$sql.= " d.total_tva,";
|
|
||||||
$sql.= " d.total_localtax1,";
|
|
||||||
$sql.= " d.total_localtax2,";
|
|
||||||
$sql.= " d.total_ttc,";
|
|
||||||
$sql.= " d.info_bits, d.fk_product,";
|
|
||||||
$sql.= " d.date_ouverture_prevue, d.date_ouverture,";
|
|
||||||
$sql.= " d.date_fin_validite, d.date_cloture,";
|
|
||||||
$sql.= " d.fk_user_author,";
|
|
||||||
$sql.= " d.fk_user_ouverture,";
|
|
||||||
$sql.= " d.fk_user_cloture,";
|
|
||||||
$sql.= " d.fk_unit";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d";
|
|
||||||
$sql.= " WHERE d.fk_contrat = ".$this->id;
|
|
||||||
$sql.= " AND (d.fk_product IS NULL OR d.fk_product = 0)"; // fk_product = 0 gardee pour compatibilitee
|
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$objp = $this->db->fetch_object($result);
|
|
||||||
|
|
||||||
$line = new ContratLigne($this->db);
|
|
||||||
$line->id = $objp->rowid;
|
|
||||||
$line->fk_contrat = $objp->fk_contrat;
|
|
||||||
$line->libelle = $objp->description;
|
|
||||||
$line->desc = $objp->description;
|
|
||||||
$line->qty = $objp->qty;
|
|
||||||
$line->statut = $objp->statut;
|
|
||||||
$line->ref = '';
|
|
||||||
$line->tva_tx = $objp->tva_tx;
|
|
||||||
$line->localtax1_tx = $objp->localtax1_tx;
|
|
||||||
$line->localtax2_tx = $objp->localtax2_tx;
|
|
||||||
$line->localtax1_type = $objp->localtax1_type;
|
|
||||||
$line->localtax2_type = $objp->localtax2_type;
|
|
||||||
$line->subprice = $objp->subprice;
|
|
||||||
$line->remise_percent = $objp->remise_percent;
|
|
||||||
$line->price_ht = $objp->price_ht;
|
|
||||||
$line->price = (isset($objp->price)?$objp->price:null); // For backward compatibility
|
|
||||||
$line->total_ht = $objp->total_ht;
|
|
||||||
$line->total_tva = $objp->total_tva;
|
|
||||||
$line->total_localtax1= $objp->total_localtax1;
|
|
||||||
$line->total_localtax2= $objp->total_localtax2;
|
|
||||||
$line->total_ttc = $objp->total_ttc;
|
|
||||||
$line->fk_product = 0;
|
|
||||||
$line->info_bits = $objp->info_bits;
|
|
||||||
|
|
||||||
$line->fk_user_author = $objp->fk_user_author;
|
|
||||||
$line->fk_user_ouverture= $objp->fk_user_ouverture;
|
|
||||||
$line->fk_user_cloture = $objp->fk_user_cloture;
|
|
||||||
|
|
||||||
$line->description = $objp->description;
|
|
||||||
|
|
||||||
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
|
||||||
$line->date_ouverture = $this->db->jdate($objp->date_ouverture);
|
|
||||||
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
|
|
||||||
$line->date_cloture = $this->db->jdate($objp->date_cloture);
|
|
||||||
// For backward compatibility
|
|
||||||
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
|
||||||
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture);
|
|
||||||
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
|
||||||
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
|
||||||
$line->fk_unit = $objp->fk_unit;
|
|
||||||
|
|
||||||
if ($line->statut == 0) $this->nbofserviceswait++;
|
|
||||||
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
|
||||||
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
|
|
||||||
if ($line->statut == 5) $this->nbofservicesclosed++;
|
|
||||||
|
|
||||||
|
|
||||||
// Retreive all extrafield for propal
|
|
||||||
// fetch optionals attributes and labels
|
|
||||||
|
|
||||||
$line->fetch_optionals($line->id,$extralabelsline);
|
|
||||||
|
|
||||||
|
|
||||||
$this->lines[$pos] = $line;
|
|
||||||
$this->lines_id_index_mapper[$line->id] = $pos;
|
|
||||||
|
|
||||||
$total_ttc+=$objp->total_ttc;
|
|
||||||
$total_vat+=$objp->total_tva;
|
|
||||||
$total_ht+=$objp->total_ht;
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
$pos++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->free($result);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_syslog(get_class($this)."::Fetch Erreur lecture des lignes de contrat non liees aux produits");
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->nbofservices=count($this->lines);
|
$this->nbofservices=count($this->lines);
|
||||||
$this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products
|
$this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||||
$this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products
|
$this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||||
@ -1008,6 +914,11 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
if (! empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
|
{
|
||||||
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
|
}
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
@ -1020,7 +931,7 @@ class Contrat extends CommonObject
|
|||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1031,7 +942,7 @@ class Contrat extends CommonObject
|
|||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1400,13 +1311,14 @@ class Contrat extends CommonObject
|
|||||||
* @param int $pa_ht Buying price HT
|
* @param int $pa_ht Buying price HT
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @return int <0 si erreur, >0 si ok
|
* @param string $rang Position
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0, $fk_unit = null)
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0, $fk_unit = null, $rang=0)
|
||||||
{
|
{
|
||||||
global $user, $langs, $conf, $mysoc;
|
global $user, $langs, $conf, $mysoc;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits");
|
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits, $rang");
|
||||||
|
|
||||||
if ($this->statut >= 0)
|
if ($this->statut >= 0)
|
||||||
{
|
{
|
||||||
@ -1616,7 +1528,7 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
global $user, $conf, $langs, $mysoc;
|
global $user, $conf, $langs, $mysoc;
|
||||||
|
|
||||||
// Nettoyage parametres
|
// Clean parameters
|
||||||
$qty=trim($qty);
|
$qty=trim($qty);
|
||||||
$desc=trim($desc);
|
$desc=trim($desc);
|
||||||
$desc=trim($desc);
|
$desc=trim($desc);
|
||||||
@ -1625,6 +1537,7 @@ class Contrat extends CommonObject
|
|||||||
$localtax1tx = price2num($localtax1tx);
|
$localtax1tx = price2num($localtax1tx);
|
||||||
$localtax2tx = price2num($localtax2tx);
|
$localtax2tx = price2num($localtax2tx);
|
||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
|
if (empty($fk_fournprice)) $fk_fournprice=0;
|
||||||
|
|
||||||
$subprice = $price;
|
$subprice = $price;
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
@ -1701,7 +1614,7 @@ class Contrat extends CommonObject
|
|||||||
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
|
||||||
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
$sql.= ", total_localtax2='".price2num($total_localtax2)."'";
|
||||||
$sql.= ", total_ttc='". price2num($total_ttc)."'";
|
$sql.= ", total_ttc='". price2num($total_ttc)."'";
|
||||||
$sql.= ", fk_product_fournisseur_price='".$fk_fournprice."'";
|
$sql.= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null");
|
||||||
$sql.= ", buy_price_ht='".price2num($pa_ht)."'";
|
$sql.= ", buy_price_ht='".price2num($pa_ht)."'";
|
||||||
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
|
if ($date_start > 0) { $sql.= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; }
|
||||||
else { $sql.=",date_ouverture_prevue=null"; }
|
else { $sql.=",date_ouverture_prevue=null"; }
|
||||||
@ -1772,7 +1685,7 @@ class Contrat extends CommonObject
|
|||||||
* @param User $user User that delete
|
* @param User $user User that delete
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function deleteline($idline,$user)
|
function deleteline($idline, User $user)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -2343,6 +2256,16 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an array of order lines
|
||||||
|
*
|
||||||
|
* @return int >0 if OK, <0 if KO
|
||||||
|
*/
|
||||||
|
function getLinesArray()
|
||||||
|
{
|
||||||
|
return $this->fetch_lines();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a document onto disk according to template module.
|
* Create a document onto disk according to template module.
|
||||||
*
|
*
|
||||||
@ -3051,8 +2974,8 @@ class ContratLigne extends CommonObjectLine
|
|||||||
else $sql.= ' null,';
|
else $sql.= ' null,';
|
||||||
if ($this->pa_ht > 0) $sql.= ' '.price2num($this->pa_ht);
|
if ($this->pa_ht > 0) $sql.= ' '.price2num($this->pa_ht);
|
||||||
else $sql.= ' null';
|
else $sql.= ' null';
|
||||||
if ($this->date_ouverture_prevue > 0) { $sql.= ",'".$this->db->idate($this->date_ouverture_prevue)."'"; }
|
if ($this->date_ouverture > 0) { $sql.= ",'".$this->db->idate($this->date_ouverture)."'"; }
|
||||||
if ($this->date_fin_validite > 0) { $sql.= ",'".$this->db->idate($this->date_fin_validite)."'"; }
|
if ($this->date_cloture > 0) { $sql.= ",'".$this->db->idate($this->date_cloture)."'"; }
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||||
|
|||||||
@ -91,11 +91,13 @@ if ($action == 'builddoc' && $permissioncreate)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (empty($donotredirect)) // This is se when include is done by bulk action "Bill Orders"
|
if (empty($donotredirect)) // This is use when include is done by bulk action "Bill Orders"
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("FileGenerated"), null);
|
setEventMessages($langs->trans("FileGenerated"), null);
|
||||||
|
|
||||||
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
$redirecturl = $_SERVER['REQUEST_URI'];
|
||||||
|
$redirecturl = preg_replace('/&?action=builddoc/', '', $redirecturl); // Remove action=builddoc parameter to avoid infinite loop
|
||||||
|
header('Location: '.$redirecturl.'#builddoc');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -322,14 +322,14 @@ if (! $error && $massaction == 'confirm_presend')
|
|||||||
$replyto = $from;
|
$replyto = $from;
|
||||||
$subject = GETPOST('subject','none');
|
$subject = GETPOST('subject','none');
|
||||||
$message = GETPOST('message','none');
|
$message = GETPOST('message','none');
|
||||||
$sendtocc = GETPOST('sentocc');
|
|
||||||
$sendtobcc = '';
|
$sendtobcc = GETPOST('sendtoccc');
|
||||||
if ($objectclass == 'Propale') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO);
|
if ($objectclass == 'Propale') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||||
if ($objectclass == 'Commande') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO);
|
if ($objectclass == 'Commande') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||||
if ($objectclass == 'Facture') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
if ($objectclass == 'Facture') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO));
|
||||||
if ($objectclass == 'Supplier_Proposal') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO);
|
if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
|
||||||
if ($objectclass == 'CommandeFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO);
|
if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
|
||||||
if ($objectclass == 'FactureFournisseur') $sendtocc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO);
|
if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
|
||||||
|
|
||||||
// $listofqualifiedid is array with key = object id of qualified objects for the current thirdparty
|
// $listofqualifiedid is array with key = object id of qualified objects for the current thirdparty
|
||||||
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
|
$oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0);
|
||||||
|
|||||||
@ -211,15 +211,26 @@ if (file_exists($fullpathselecteddir))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enable jquery handlers on new generated HTML objects
|
// Enable jquery handlers on new generated HTML objects
|
||||||
print '<script type="text/javascript">';
|
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
|
||||||
print 'jQuery(".classfortooltip").tipTip({ maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});';
|
print '<script type="text/javascript">
|
||||||
// TODO Remove this. Is replaced with function as 3rd parameter of fileTree
|
jQuery(document).ready(function () {
|
||||||
print 'jQuery(".fmdirlia").click(function(e) {
|
jQuery(".classfortooltip").tooltip({
|
||||||
|
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
|
||||||
|
hide: { effect:\'toggle\', delay: 50 },
|
||||||
|
tooltipClass: "mytooltip",
|
||||||
|
content: function () {
|
||||||
|
return $(this).prop(\'title\'); /* To force to get title as is */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* TODO Remove this. Is replaced with function as 3rd parameter of fileTree */
|
||||||
|
jQuery(".fmdirlia").click(function(e) {
|
||||||
id=jQuery(this).attr(\'id\').substr(12);
|
id=jQuery(this).attr(\'id\').substr(12);
|
||||||
jQuery("#formuserfile_section_dir").val(jQuery(this).attr(\'rel\'));
|
jQuery("#formuserfile_section_dir").val(jQuery(this).attr(\'rel\'));
|
||||||
jQuery("#formuserfile_section_id").val(id);
|
jQuery("#formuserfile_section_id").val(id);
|
||||||
});';
|
});
|
||||||
print '</script>';
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
echo "</ul>\n";
|
echo "</ul>\n";
|
||||||
|
|
||||||
|
|||||||
@ -49,35 +49,35 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
|||||||
//global $hookmanager;
|
//global $hookmanager;
|
||||||
$hookmanager->initHooks(array('searchform'));
|
$hookmanager->initHooks(array('searchform'));
|
||||||
|
|
||||||
$search_boxvalue=GETPOST('q');
|
$search_boxvalue=GETPOST('q', 'none');
|
||||||
|
|
||||||
$arrayresult=array();
|
$arrayresult=array();
|
||||||
|
|
||||||
// Define $searchform
|
// Define $searchform
|
||||||
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
|
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
|
||||||
{
|
{
|
||||||
$arrayresult['searchintothirdparty']=array('position'=>10, 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
$arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php?sall='.urlencode($search_boxvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
|
if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
|
||||||
{
|
{
|
||||||
$arrayresult['searchintocontact']=array('position'=>15, 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
$arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php?sall='.urlencode($search_boxvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
|
if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
|
||||||
{
|
{
|
||||||
$arrayresult['searchintomember']=array('position'=>20, 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
$arrayresult['searchintomember']=array('position'=>20, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php?sall='.urlencode($search_boxvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
|
||||||
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
|
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
|
||||||
{
|
{
|
||||||
$arrayresult['searchintoproduct']=array('position'=>30, 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
$arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php?sall='.urlencode($search_boxvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
|
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
$arrayresult['searchintoprojects']=array('position'=>40, 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
$arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php?search_all='.urlencode($search_boxvalue));
|
||||||
}
|
}
|
||||||
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
|
if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_
|
|||||||
// HR
|
// HR
|
||||||
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
|
if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
|
||||||
{
|
{
|
||||||
$arrayresult['searchintouser']=array('position'=>200, 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
$arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/index.php?sall='.urlencode($search_boxvalue));
|
||||||
}
|
}
|
||||||
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
|
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
|||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
}
|
}
|
||||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||||
$nowarray=dol_getdate(dol_now(),true);
|
$nowarray=dol_getdate(dol_now(),true);
|
||||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||||
$startyear=$endyear-1;
|
$startyear=$endyear-1;
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
|||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
}
|
}
|
||||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||||
$nowarray=dol_getdate(dol_now(),true);
|
$nowarray=dol_getdate(dol_now(),true);
|
||||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||||
$startyear=$endyear-1;
|
$startyear=$endyear-1;
|
||||||
|
|||||||
@ -113,7 +113,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
|||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
}
|
}
|
||||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||||
$nowarray=dol_getdate(dol_now(),true);
|
$nowarray=dol_getdate(dol_now(),true);
|
||||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||||
$startyear=$endyear-1;
|
$startyear=$endyear-1;
|
||||||
|
|||||||
@ -112,7 +112,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
|||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
}
|
}
|
||||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||||
$nowarray=dol_getdate(dol_now(),true);
|
$nowarray=dol_getdate(dol_now(),true);
|
||||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||||
$startyear=$endyear-1;
|
$startyear=$endyear-1;
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
|||||||
$shownb=$tmparray['shownb'];
|
$shownb=$tmparray['shownb'];
|
||||||
$showtot=$tmparray['showtot'];
|
$showtot=$tmparray['showtot'];
|
||||||
}
|
}
|
||||||
if (empty($shownb) && empty($showtot)) $showtot=1;
|
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||||
$nowarray=dol_getdate(dol_now(),true);
|
$nowarray=dol_getdate(dol_now(),true);
|
||||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||||
$startyear=$endyear-1;
|
$startyear=$endyear-1;
|
||||||
|
|||||||
@ -275,7 +275,8 @@ class CMailFile
|
|||||||
// comme des injections mail par les serveurs de messagerie.
|
// comme des injections mail par les serveurs de messagerie.
|
||||||
$this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers);
|
$this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers);
|
||||||
|
|
||||||
$this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol;
|
//$this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol;
|
||||||
|
$this->message = 'This is a message with multiple parts in MIME format.'.$this->eol;
|
||||||
$this->message.= $text_body . $files_encoded;
|
$this->message.= $text_body . $files_encoded;
|
||||||
$this->message.= "--" . $this->mixed_boundary . "--" . $this->eol;
|
$this->message.= "--" . $this->mixed_boundary . "--" . $this->eol;
|
||||||
}
|
}
|
||||||
@ -961,8 +962,8 @@ class CMailFile
|
|||||||
|
|
||||||
//$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol;
|
//$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol;
|
||||||
|
|
||||||
$out.= "Content-Type: multipart/mixed; boundary=\"".$this->mixed_boundary."\"".$this->eol2;
|
$out.= "Content-Type: multipart/mixed;".$this->eol2." boundary=\"".$this->mixed_boundary."\"".$this->eol2;
|
||||||
$out.= "Content-Transfer-Encoding: 8bit".$this->eol2;
|
$out.= "Content-Transfer-Encoding: 8bit".$this->eol2; // TODO Seems to be ignored. Header is 7bit once received.
|
||||||
|
|
||||||
dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
|
dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out);
|
||||||
return $out;
|
return $out;
|
||||||
@ -1014,23 +1015,23 @@ class CMailFile
|
|||||||
|
|
||||||
if ($this->atleastoneimage)
|
if ($this->atleastoneimage)
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make RFC821 Compliant, replace bare linefeeds
|
// Make RFC821 Compliant, replace bare linefeeds
|
||||||
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $msgtext);
|
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $msgtext); // PCRE modifier /s means new lines are common chars
|
||||||
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||||
{
|
{
|
||||||
$strContent = preg_replace("/\r\n/si", "\n", $strContent);
|
$strContent = preg_replace("/\r\n/si", "\n", $strContent); // PCRE modifier /s means new lines are common chars
|
||||||
}
|
}
|
||||||
|
|
||||||
$strContentAltText = '';
|
$strContentAltText = '';
|
||||||
if ($this->msgishtml)
|
if ($this->msgishtml)
|
||||||
{
|
{
|
||||||
$strContentAltText = html_entity_decode(strip_tags($strContent));
|
$strContentAltText = html_entity_decode(strip_tags($strContent));
|
||||||
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n"));
|
$strContentAltText = rtrim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n"));
|
||||||
|
|
||||||
// Check if html header already in message, if not complete the message
|
// Check if html header already in message, if not complete the message
|
||||||
$strContent = $this->checkIfHTML($strContent);
|
$strContent = $this->checkIfHTML($strContent);
|
||||||
@ -1038,31 +1039,35 @@ class CMailFile
|
|||||||
|
|
||||||
// Make RFC2045 Compliant, split lines
|
// Make RFC2045 Compliant, split lines
|
||||||
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
|
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
|
||||||
$strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content.
|
// TODO Encode main content into base64 and use the chunk_split, or quoted-printable
|
||||||
|
$strContent = rtrim(wordwrap($strContent, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n")); // TODO Using this method creates unexpected line break on text/plain content.
|
||||||
|
|
||||||
if ($this->msgishtml)
|
if ($this->msgishtml)
|
||||||
{
|
{
|
||||||
if ($this->atleastoneimage)
|
if ($this->atleastoneimage)
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;
|
||||||
$out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message
|
$out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
$out.= "Content-Type: multipart/related; boundary=\"".$this->related_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/related;".$this->eol." boundary=\"".$this->related_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->related_boundary . $this->eol;
|
$out.= "--" . $this->related_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
|
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;
|
||||||
$out.= $this->eol.$strContentAltText.$this->eol;
|
$out.= $this->eol.$strContentAltText.$this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol; // TODO Use base64
|
||||||
$out.= $this->eol.$strContent.$this->eol;
|
$out.= $this->eol.$strContent.$this->eol;
|
||||||
|
|
||||||
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
|
if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part
|
||||||
@ -1073,6 +1078,7 @@ class CMailFile
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
$out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol;
|
||||||
|
//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;
|
||||||
$out.= $this->eol.$strContent.$this->eol;
|
$out.= $this->eol.$strContent.$this->eol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -511,6 +511,13 @@ abstract class CommonDocGenerator
|
|||||||
'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs),
|
'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Units
|
||||||
|
if ($conf->global->PRODUCT_USE_UNITS)
|
||||||
|
{
|
||||||
|
$resarray['line_unit']=$outputlangs->trans($line->getLabelOfUnit('long'));
|
||||||
|
$resarray['line_unit_short']=$outputlangs->trans($line->getLabelOfUnit('short'));
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieve extrafields
|
// Retrieve extrafields
|
||||||
$extrafieldkey=$line->element;
|
$extrafieldkey=$line->element;
|
||||||
$array_key="line";
|
$array_key="line";
|
||||||
|
|||||||
@ -340,6 +340,15 @@ abstract class CommonObject
|
|||||||
|
|
||||||
// No constructor as it is an abstract class
|
// No constructor as it is an abstract class
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if an object manage the multicompany field and how.
|
||||||
|
*
|
||||||
|
* @return int 0=No entity field managed, 1=Test with field entity, 2=Test with link to thirdparty (and sales representative)
|
||||||
|
*/
|
||||||
|
function getIsmultientitymanaged()
|
||||||
|
{
|
||||||
|
return $this->ismultientitymanaged;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check an object id/ref exists
|
* Check an object id/ref exists
|
||||||
@ -1338,16 +1347,16 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && empty($user->rights->societe->client->voir))) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
||||||
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
||||||
if (! empty($filter))
|
if (! empty($filter))
|
||||||
{
|
{
|
||||||
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
||||||
$sql.=$filter;
|
$sql.=$filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
||||||
|
|
||||||
//print $filter.' '.$sql."<br>";
|
//print $filter.' '.$sql."<br>";
|
||||||
@ -1363,16 +1372,16 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
||||||
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if (empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
|
||||||
if (! empty($filter))
|
if (! empty($filter))
|
||||||
{
|
{
|
||||||
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
if (! preg_match('/^\s*AND/i', $filter)) $sql.=" AND "; // For backward compatibility
|
||||||
$sql.=$filter;
|
$sql.=$filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2 || ($this->element != 'societe' && empty($this->isnolinkedbythird) && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element, 1).')';
|
||||||
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
|
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
|
||||||
|
|
||||||
@ -3648,11 +3657,12 @@ abstract class CommonObject
|
|||||||
* Return HTML table table of source object lines
|
* Return HTML table table of source object lines
|
||||||
* TODO Move this and previous function into output html class file (htmlline.class.php).
|
* TODO Move this and previous function into output html class file (htmlline.class.php).
|
||||||
* If lines are into a template, title must also be into a template
|
* If lines are into a template, title must also be into a template
|
||||||
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
|
* But for the moment we don't know if it's possible, so we keep the method available on overloaded objects.
|
||||||
*
|
*
|
||||||
|
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printOriginLinesList()
|
function printOriginLinesList($restrictlist='')
|
||||||
{
|
{
|
||||||
global $langs, $hookmanager, $conf;
|
global $langs, $hookmanager, $conf;
|
||||||
|
|
||||||
@ -3674,8 +3684,6 @@ abstract class CommonObject
|
|||||||
|
|
||||||
foreach ($this->lines as $line)
|
foreach ($this->lines as $line)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)))
|
||||||
{
|
{
|
||||||
if (empty($line->fk_parent_line))
|
if (empty($line->fk_parent_line))
|
||||||
@ -3687,7 +3695,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->printOriginLine($line,$var);
|
$this->printOriginLine($line, $var, $restrictlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -3702,9 +3710,10 @@ abstract class CommonObject
|
|||||||
*
|
*
|
||||||
* @param CommonObjectLine $line Line
|
* @param CommonObjectLine $line Line
|
||||||
* @param string $var Var
|
* @param string $var Var
|
||||||
|
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printOriginLine($line,$var)
|
function printOriginLine($line, $var, $restrictlist='')
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
@ -3803,9 +3812,13 @@ abstract class CommonObject
|
|||||||
$this->tpl['price'] = price($line->subprice);
|
$this->tpl['price'] = price($line->subprice);
|
||||||
$this->tpl['multicurrency_price'] = price($line->multicurrency_subprice);
|
$this->tpl['multicurrency_price'] = price($line->multicurrency_subprice);
|
||||||
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' ';
|
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : ' ';
|
||||||
if($conf->global->PRODUCT_USE_UNITS) $this->tpl['unit'] = $line->getLabelOfUnit('long');
|
if ($conf->global->PRODUCT_USE_UNITS) $this->tpl['unit'] = $langs->transnoentities($line->getLabelOfUnit('long'));
|
||||||
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' ';
|
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? vatrate($line->remise_percent, true) : ' ';
|
||||||
|
|
||||||
|
// Is the line strike or not
|
||||||
|
$this->tpl['strike']=0;
|
||||||
|
if ($restrictlist == 'services' && $line->product_type != Product::TYPE_SERVICE) $this->tpl['strike']=1;
|
||||||
|
|
||||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||||
// Use global variables + $dateSelector + $seller and $buyer
|
// Use global variables + $dateSelector + $seller and $buyer
|
||||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
|
||||||
@ -4043,13 +4056,14 @@ abstract class CommonObject
|
|||||||
|
|
||||||
if (in_array(get_class($this), array('Adherent')))
|
if (in_array(get_class($this), array('Adherent')))
|
||||||
{
|
{
|
||||||
$arrayofrecords = array(); // The write_file of templates of adherent class need this
|
$arrayofrecords = array(); // The write_file of templates of adherent class need this var
|
||||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
|
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||||
}
|
}
|
||||||
|
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
|
||||||
|
|
||||||
if ($resultwritefile > 0)
|
if ($resultwritefile > 0)
|
||||||
{
|
{
|
||||||
@ -4076,9 +4090,19 @@ abstract class CommonObject
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||||
$ecmfile=new EcmFiles($this->db);
|
$ecmfile=new EcmFiles($this->db);
|
||||||
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
$result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename);
|
||||||
|
|
||||||
|
if (! empty($conf->global->PROPOSAL_USE_ONLINE_SIGN))
|
||||||
|
{
|
||||||
|
if (empty($ecmfile->share)) // Because object not found or share not set yet
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||||
|
$ecmfile->share = getRandomPassword(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||||
$ecmfile->fullpath_orig = '';
|
$ecmfile->fullpath_orig = '';
|
||||||
$ecmfile->gen_or_uploaded = 'generated';
|
$ecmfile->gen_or_uploaded = 'generated';
|
||||||
$ecmfile->description = ''; // indexed content
|
$ecmfile->description = ''; // indexed content
|
||||||
@ -4093,7 +4117,7 @@ abstract class CommonObject
|
|||||||
{
|
{
|
||||||
$ecmfile->filepath = $rel_dir;
|
$ecmfile->filepath = $rel_dir;
|
||||||
$ecmfile->filename = $filename;
|
$ecmfile->filename = $filename;
|
||||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
$ecmfile->label = md5_file(dol_osencode($destfull)); // hash of file content
|
||||||
$ecmfile->fullpath_orig = '';
|
$ecmfile->fullpath_orig = '';
|
||||||
$ecmfile->gen_or_uploaded = 'generated';
|
$ecmfile->gen_or_uploaded = 'generated';
|
||||||
$ecmfile->description = ''; // indexed content
|
$ecmfile->description = ''; // indexed content
|
||||||
@ -4104,6 +4128,21 @@ abstract class CommonObject
|
|||||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*$this->result['fullname']=$destfull;
|
||||||
|
$this->result['filepath']=$ecmfile->filepath;
|
||||||
|
$this->result['filename']=$ecmfile->filename;*/
|
||||||
|
|
||||||
|
// Update the last_main_doc field into main object
|
||||||
|
$update_main_doc_field=0;
|
||||||
|
if (! empty($obj->update_main_doc_field)) $update_main_doc_field=1;
|
||||||
|
if ($update_main_doc_field && ! empty($this->table_element))
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".($ecmfile->filepath.'/'.$ecmfile->filename)."'";
|
||||||
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) dol_print_error($this->db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4598,11 +4637,12 @@ abstract class CommonObject
|
|||||||
* @param Extrafields $extrafields Extrafield Object
|
* @param Extrafields $extrafields Extrafield Object
|
||||||
* @param string $mode Show output (view) or input (edit) for extrafield
|
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||||
* @param array $params Optional parameters
|
* @param array $params Optional parameters
|
||||||
|
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='')
|
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='')
|
||||||
{
|
{
|
||||||
global $_POST, $conf, $langs, $action;
|
global $_POST, $conf, $langs, $action;
|
||||||
|
|
||||||
@ -4630,12 +4670,12 @@ abstract class CommonObject
|
|||||||
|
|
||||||
switch($mode) {
|
switch($mode) {
|
||||||
case "view":
|
case "view":
|
||||||
$value=$this->array_options["options_".$key];
|
$value=$this->array_options["options_".$key.$keysuffix];
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values.
|
$getposttemp = GETPOST($keyprefix.'options_'.$key.$keysuffix, 'none'); // GETPOST can get value from GET, POST or setup of default values.
|
||||||
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
|
// GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
|
||||||
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET('options_'.$key))
|
if (is_array($getposttemp) || $getposttemp != '' || GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix))
|
||||||
{
|
{
|
||||||
if (is_array($getposttemp)) {
|
if (is_array($getposttemp)) {
|
||||||
// $getposttemp is an array but following code expects a comma separated string
|
// $getposttemp is an array but following code expects a comma separated string
|
||||||
@ -4675,12 +4715,12 @@ abstract class CommonObject
|
|||||||
// Convert date into timestamp format (value in memory must be a timestamp)
|
// Convert date into timestamp format (value in memory must be a timestamp)
|
||||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||||
{
|
{
|
||||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$this->db->jdate($this->array_options['options_'.$key]);
|
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?dol_mktime(GETPOST($keyprefix.'options_'.$key.$keysuffix."hour",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."min",'int',3), 0, GETPOST($keyprefix.'options_'.$key.$keysuffix."month",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."day",'int',3), GETPOST($keyprefix.'options_'.$key.$keysuffix."year",'int',3)):$this->db->jdate($this->array_options['options_'.$key]);
|
||||||
}
|
}
|
||||||
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
// Convert float submited string into real php numeric (value in memory must be a php numeric)
|
||||||
if (in_array($extrafields->attribute_type[$key],array('price','double')))
|
if (in_array($extrafields->attribute_type[$key],array('price','double')))
|
||||||
{
|
{
|
||||||
$value = isset($_POST["options_".$key])?price2num($_POST["options_".$key]):$this->array_options['options_'.$key];
|
$value = GETPOSTISSET($keyprefix.'options_'.$key.$keysuffix)?price2num(GETPOST($keyprefix.'options_'.$key.$keysuffix,'int',3)):$this->array_options['options_'.$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
$labeltoshow = $langs->trans($label);
|
$labeltoshow = $langs->trans($label);
|
||||||
@ -4699,7 +4739,7 @@ abstract class CommonObject
|
|||||||
$out .= $extrafields->showOutputField($key, $value);
|
$out .= $extrafields->showOutputField($key, $value);
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
$out .= $extrafields->showInputField($key, $value, '', $keyprefix, '', 0, $this->id);
|
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4712,7 +4752,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
// Add code to manage list depending on others
|
// Add code to manage list depending on others
|
||||||
if (! empty($conf->use_javascript_ajax))
|
if (! empty($conf->use_javascript_ajax)) {
|
||||||
$out .= '
|
$out .= '
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
@ -4744,9 +4784,11 @@ abstract class CommonObject
|
|||||||
</script>'."\n";
|
</script>'."\n";
|
||||||
$out .= '<!-- /showOptionalsInput --> '."\n";
|
$out .= '<!-- /showOptionalsInput --> '."\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rights used for this class
|
* Returns the rights used for this class
|
||||||
* @return stdClass
|
* @return stdClass
|
||||||
|
|||||||
@ -51,7 +51,8 @@ abstract class CommonObjectLine extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the text label from units dictionary
|
* Returns the translation key from units dictionary.
|
||||||
|
* A langs->trans() must be called on result to get translated value.
|
||||||
*
|
*
|
||||||
* @param string $type Label type (long or short)
|
* @param string $type Label type (long or short)
|
||||||
* @return string|int <0 if ko, label if ok
|
* @return string|int <0 if ko, label if ok
|
||||||
|
|||||||
@ -43,11 +43,6 @@ class EmailSenderProfile extends CommonObject
|
|||||||
* @var string Name of table without prefix where object is stored
|
* @var string Name of table without prefix where object is stored
|
||||||
*/
|
*/
|
||||||
public $table_element = 'c_email_senderprofile';
|
public $table_element = 'c_email_senderprofile';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array Does this field is linked to a thirdparty ?
|
|
||||||
*/
|
|
||||||
protected $isnolinkedbythird = 1;
|
|
||||||
/**
|
/**
|
||||||
* @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
* @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
*/
|
*/
|
||||||
@ -273,6 +268,8 @@ class EmailSenderProfile extends CommonObject
|
|||||||
$result = '';
|
$result = '';
|
||||||
$companylink = '';
|
$companylink = '';
|
||||||
|
|
||||||
|
$label=$this->label;
|
||||||
|
|
||||||
$url='';
|
$url='';
|
||||||
//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
|
//$url = dol_buildpath('/monmodule/emailsenderprofile_card.php',1).'?id='.$this->id;
|
||||||
|
|
||||||
|
|||||||
@ -806,13 +806,13 @@ class ExtraFields
|
|||||||
* @param string $key Key of attribute
|
* @param string $key Key of attribute
|
||||||
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
* @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value)
|
||||||
* @param string $moreparam To add more parametes on html input tag
|
* @param string $moreparam To add more parametes on html input tag
|
||||||
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||||
* @param mixed $showsize Value for css to define size. May also be a numeric.
|
* @param mixed $showsize Value for css to define size. May also be a numeric.
|
||||||
* @param int $objectid Current object id
|
* @param int $objectid Current object id
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showInputField($key, $value, $moreparam='', $keyprefix='', $keysuffix='', $showsize=0, $objectid=0)
|
function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0, $objectid=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -831,7 +831,7 @@ class ExtraFields
|
|||||||
|
|
||||||
if ($computed)
|
if ($computed)
|
||||||
{
|
{
|
||||||
if ($keysuffix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
if ($keyprefix != 'search_') return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
|
||||||
else return '';
|
else return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,26 +893,26 @@ class ExtraFields
|
|||||||
if (! is_object($form)) $form=new Form($this->db);
|
if (! is_object($form)) $form=new Form($this->db);
|
||||||
|
|
||||||
// TODO Must also support $moreparam
|
// TODO Must also support $moreparam
|
||||||
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1);
|
$out = $form->select_date($value, $keyprefix.'options_'.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
|
||||||
}
|
}
|
||||||
elseif (in_array($type,array('int')))
|
elseif (in_array($type,array('int')))
|
||||||
{
|
{
|
||||||
$tmp=explode(',',$size);
|
$tmp=explode(',',$size);
|
||||||
$newsize=$tmp[0];
|
$newsize=$tmp[0];
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'varchar')
|
elseif ($type == 'varchar')
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif (in_array($type, array('mail', 'phone', 'url')))
|
elseif (in_array($type, array('mail', 'phone', 'url')))
|
||||||
{
|
{
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'text')
|
elseif ($type == 'text')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor=new DolEditor($keysuffix.'options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
$doleditor=new DolEditor($keyprefix.'options_'.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
||||||
$out=$doleditor->Create(1);
|
$out=$doleditor->Create(1);
|
||||||
}
|
}
|
||||||
elseif ($type == 'boolean')
|
elseif ($type == 'boolean')
|
||||||
@ -923,21 +923,21 @@ class ExtraFields
|
|||||||
} else {
|
} else {
|
||||||
$checked=' value="1" ';
|
$checked=' value="1" ';
|
||||||
}
|
}
|
||||||
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
elseif ($type == 'price')
|
elseif ($type == 'price')
|
||||||
{
|
{
|
||||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
$value=price($value);
|
$value=price($value);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||||
}
|
}
|
||||||
elseif ($type == 'double')
|
elseif ($type == 'double')
|
||||||
{
|
{
|
||||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||||
$value=price($value);
|
$value=price($value);
|
||||||
}
|
}
|
||||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||||
}
|
}
|
||||||
elseif ($type == 'select')
|
elseif ($type == 'select')
|
||||||
{
|
{
|
||||||
@ -945,10 +945,10 @@ class ExtraFields
|
|||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
$out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
$out.='<option value="0"> </option>';
|
$out.='<option value="0"> </option>';
|
||||||
foreach ($param['options'] as $key => $val)
|
foreach ($param['options'] as $key => $val)
|
||||||
{
|
{
|
||||||
@ -967,10 +967,10 @@ class ExtraFields
|
|||||||
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2))
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||||
$out.= ajax_combobox($keysuffix.'options_'.$key.$keyprefix, array(), 0);
|
$out.= ajax_combobox($keyprefix.'options_'.$key.$keysuffix, array(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'').'>';
|
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||||
if (is_array($param['options']))
|
if (is_array($param['options']))
|
||||||
{
|
{
|
||||||
$param_list=array_keys($param['options']);
|
$param_list=array_keys($param['options']);
|
||||||
@ -1132,7 +1132,7 @@ class ExtraFields
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$value_arr=explode(',',$value);
|
$value_arr=explode(',',$value);
|
||||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, (empty($param['options'])?null:$param['options']), $value_arr, '', 0, '', 0, '100%');
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif ($type == 'radio')
|
elseif ($type == 'radio')
|
||||||
@ -1140,11 +1140,11 @@ class ExtraFields
|
|||||||
$out='';
|
$out='';
|
||||||
foreach ($param['options'] as $keyopt => $val)
|
foreach ($param['options'] as $keyopt => $val)
|
||||||
{
|
{
|
||||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keysuffix.'options_'.$key.$keyprefix.'" '.($moreparam?$moreparam:'');
|
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||||
$out.=' value="'.$keyopt.'"';
|
$out.=' value="'.$keyopt.'"';
|
||||||
$out.=' id="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'"';
|
$out.=' id="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'"';
|
||||||
$out.= ($value==$keyopt?'checked':'');
|
$out.= ($value==$keyopt?'checked':'');
|
||||||
$out.='/><label for="'.$keysuffix.'options_'.$key.$keyprefix.'_'.$keyopt.'">'.$val.'</label><br>';
|
$out.='/><label for="'.$keyprefix.'options_'.$key.$keysuffix.'_'.$keyopt.'">'.$val.'</label><br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($type == 'chkbxlst')
|
elseif ($type == 'chkbxlst')
|
||||||
@ -1286,7 +1286,7 @@ class ExtraFields
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
$out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $data, $value_arr, '', 0, '', 0, '100%');
|
$out=$form->multiselectarray($keyprefix.'options_'.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||||
@ -1316,7 +1316,7 @@ class ExtraFields
|
|||||||
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
|
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$valuetoshow.'" >';
|
$out.='<input type="text" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$valuetoshow.'" >';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1327,10 +1327,10 @@ class ExtraFields
|
|||||||
elseif ($type == 'password')
|
elseif ($type == 'password')
|
||||||
{
|
{
|
||||||
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
||||||
$out='<input type="'.($keysuffix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||||
}
|
}
|
||||||
if (!empty($hidden)) {
|
if (!empty($hidden)) {
|
||||||
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';
|
$out='<input type="hidden" value="'.$value.'" name="'.$keyprefix.'options_'.$key.$keysuffix.'" id="'.$keyprefix.'options_'.$key.$keysuffix.'"/>';
|
||||||
}
|
}
|
||||||
/* Add comments
|
/* Add comments
|
||||||
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
if ($type == 'date') $out.=' (YYYY-MM-DD)';
|
||||||
@ -1339,6 +1339,7 @@ class ExtraFields
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML string to put an output field into a page
|
* Return HTML string to put an output field into a page
|
||||||
*
|
*
|
||||||
|
|||||||
@ -438,8 +438,11 @@ class Form
|
|||||||
|
|
||||||
$s='';$textfordialog='';
|
$s='';$textfordialog='';
|
||||||
|
|
||||||
|
if ($tooltiptrigger == '')
|
||||||
|
{
|
||||||
$htmltext=str_replace('"',""",$htmltext);
|
$htmltext=str_replace('"',""",$htmltext);
|
||||||
if ($tooltiptrigger != '')
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$classfortooltip='classfortooltiponclick';
|
$classfortooltip='classfortooltiponclick';
|
||||||
$textfordialog.='<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
|
$textfordialog.='<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
|
||||||
@ -4519,6 +4522,8 @@ class Form
|
|||||||
{
|
{
|
||||||
global $langs,$conf,$mysoc;
|
global $langs,$conf,$mysoc;
|
||||||
|
|
||||||
|
$langs->load('errors');
|
||||||
|
|
||||||
$return='';
|
$return='';
|
||||||
|
|
||||||
// Define defaultnpr, defaultttx and defaultcode
|
// Define defaultnpr, defaultttx and defaultcode
|
||||||
@ -4687,7 +4692,7 @@ class Form
|
|||||||
*
|
*
|
||||||
* @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 (emptydate must be 0).
|
||||||
* @param string $prefix Prefix for fields name
|
* @param string $prefix Prefix for fields name
|
||||||
* @param int $h 1=Show also hours
|
* @param int $h 1=Show also hours (-1 has same effect, but hour and minutes are prefilled with 23:59 if $set_time = -1)
|
||||||
* @param int $m 1=Show also minutes
|
* @param int $m 1=Show also minutes
|
||||||
* @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
|
* @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
|
||||||
* @param string $form_name Not used
|
* @param string $form_name Not used
|
||||||
@ -4742,6 +4747,7 @@ class Form
|
|||||||
{
|
{
|
||||||
$shour = dol_print_date($set_time, "%H");
|
$shour = dol_print_date($set_time, "%H");
|
||||||
$smin = dol_print_date($set_time, "%M");
|
$smin = dol_print_date($set_time, "%M");
|
||||||
|
$ssec = dol_print_date($set_time, "%S");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -4750,8 +4756,9 @@ class Form
|
|||||||
$syear = '';
|
$syear = '';
|
||||||
$smonth = '';
|
$smonth = '';
|
||||||
$sday = '';
|
$sday = '';
|
||||||
$shour = !isset($conf->global->MAIN_DEFAULT_DATE_HOUR) ? '' : $conf->global->MAIN_DEFAULT_DATE_HOUR;
|
$shour = !isset($conf->global->MAIN_DEFAULT_DATE_HOUR) ? ($h == -1 ? '23' : '') : $conf->global->MAIN_DEFAULT_DATE_HOUR;
|
||||||
$smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? '' : $conf->global->MAIN_DEFAULT_DATE_MIN;
|
$smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? ($h == -1 ? '59' : '') : $conf->global->MAIN_DEFAULT_DATE_MIN;
|
||||||
|
$ssec = !isset($conf->global->MAIN_DEFAULT_DATE_SEC) ? ($h == -1 ? '59' : '') : $conf->global->MAIN_DEFAULT_DATE_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
|
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
|
||||||
@ -4932,6 +4939,8 @@ class Form
|
|||||||
$retstring.='<option value="'.$min.'"'.(($min == $smin)?' selected':'').'>'.$min.(empty($conf->dol_optimize_smallscreen)?'':'').'</option>';
|
$retstring.='<option value="'.$min.'"'.(($min == $smin)?' selected':'').'>'.$min.(empty($conf->dol_optimize_smallscreen)?'':'').'</option>';
|
||||||
}
|
}
|
||||||
$retstring.='</select>';
|
$retstring.='</select>';
|
||||||
|
|
||||||
|
$retstring.='<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a "Now" link
|
// Add a "Now" link
|
||||||
@ -5243,6 +5252,7 @@ class Form
|
|||||||
* @param string $placeholder String to use as placeholder
|
* @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)
|
* @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
|
* @return string HTML select string
|
||||||
|
* @see ajax_combobox in ajax.lib.php
|
||||||
*/
|
*/
|
||||||
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
|
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
|
||||||
{
|
{
|
||||||
@ -5252,7 +5262,7 @@ class Form
|
|||||||
// TODO Use an internal dolibarr component instead of select2
|
// TODO Use an internal dolibarr component instead of select2
|
||||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
|
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
|
||||||
|
|
||||||
$out='<input type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'">';
|
$out='<select type="text" class="'.$htmlname.($morecss?' '.$morecss:'').'" '.($moreparam?$moreparam.' ':'').'name="'.$htmlname.'"></select>';
|
||||||
|
|
||||||
$tmpplugin='select2';
|
$tmpplugin='select2';
|
||||||
$outdelayed="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
$outdelayed="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
|
||||||
@ -5267,44 +5277,40 @@ class Form
|
|||||||
url: "'.$url.'",
|
url: "'.$url.'",
|
||||||
dataType: \'json\',
|
dataType: \'json\',
|
||||||
delay: 250,
|
delay: 250,
|
||||||
data: function (searchTerm, pageNumber, context) {
|
data: function (params) {
|
||||||
return {
|
return {
|
||||||
q: searchTerm, // search term
|
q: params.term, // search term
|
||||||
page: pageNumber
|
page: params.page
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
results: function (remoteData, pageNumber, query) {
|
processResults: function (data) {
|
||||||
console.log(remoteData);
|
// parse the results into the format expected by Select2.
|
||||||
saveRemoteData = remoteData;
|
// since we are using custom formatting functions we do not need to alter the remote JSON data
|
||||||
|
//console.log(data);
|
||||||
|
saveRemoteData = data;
|
||||||
/* format json result for select2 */
|
/* format json result for select2 */
|
||||||
result = []
|
result = []
|
||||||
$.each( remoteData, function( key, value ) {
|
$.each( data, function( key, value ) {
|
||||||
result.push({id: key, text: value.text});
|
result.push({id: key, text: value.text});
|
||||||
});
|
});
|
||||||
//return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
|
//return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
|
||||||
|
//console.log(result);
|
||||||
return {results: result, more: false}
|
return {results: result, more: false}
|
||||||
},
|
},
|
||||||
/*processResults: function (data, page) {
|
|
||||||
// parse the results into the format expected by Select2.
|
|
||||||
// since we are using custom formatting functions we do not need to
|
|
||||||
// alter the remote JSON data
|
|
||||||
console.log(data);
|
|
||||||
return {
|
|
||||||
results: data.items
|
|
||||||
};
|
|
||||||
},*/
|
|
||||||
cache: true
|
cache: true
|
||||||
},
|
},
|
||||||
dropdownCssClass: "css-'.$htmlname.'",
|
language: select2arrayoflanguage,
|
||||||
|
/* dropdownCssClass: "css-'.$htmlname.'", */
|
||||||
placeholder: "'.dol_escape_js($placeholder).'",
|
placeholder: "'.dol_escape_js($placeholder).'",
|
||||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
||||||
minimumInputLength: '.$minimumInputLength.',
|
minimumInputLength: '.$minimumInputLength.',
|
||||||
formatResult: function(result, container, query, escapeMarkup) {
|
formatResult: function(result, container, query, escapeMarkup) {
|
||||||
return escapeMarkup(result.text);
|
return escapeMarkup(result.text);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
'.($callurlonselect ? '
|
'.($callurlonselect ? '
|
||||||
|
/* Code to execute a GET when we select a value */
|
||||||
$(".'.$htmlname.'").change(function() {
|
$(".'.$htmlname.'").change(function() {
|
||||||
var selected = $(".'.$htmlname.'").select2("val");
|
var selected = $(".'.$htmlname.'").select2("val");
|
||||||
$(".'.$htmlname.'").select2("val",""); /* reset visible combo value */
|
$(".'.$htmlname.'").select2("val",""); /* reset visible combo value */
|
||||||
@ -6442,7 +6448,7 @@ class Form
|
|||||||
*/
|
*/
|
||||||
function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array())
|
function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array())
|
||||||
{
|
{
|
||||||
global $db,$conf,$langs;
|
global $db, $conf, $langs, $user;
|
||||||
|
|
||||||
$sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
|
$sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
|
||||||
$sql.= ' AND entity IN (0,'.getEntity('').')';
|
$sql.= ' AND entity IN (0,'.getEntity('').')';
|
||||||
@ -6453,13 +6459,14 @@ class Form
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
$out = '<select name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
|
||||||
if ($useempty) $out.= '<option value="0"></option>';
|
if ($useempty) $out.= '<option value="0"> </option>';
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql))
|
while ($obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$out.= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
|
$out.= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
|
||||||
}
|
}
|
||||||
$out.= '</select>';
|
$out.= '</select>';
|
||||||
|
if (! empty($htmlname) && $user->admin) $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||||
|
|
||||||
if (!empty($target))
|
if (!empty($target))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -59,7 +59,7 @@ abstract class DoliDB implements Database
|
|||||||
public $lastqueryerror;
|
public $lastqueryerror;
|
||||||
/** @var string Last error message */
|
/** @var string Last error message */
|
||||||
public $lasterror;
|
public $lasterror;
|
||||||
/** @var int Last error number */
|
/** @var string Last error number. For example: 'DB_ERROR_RECORD_ALREADY_EXISTS', '12345', ... */
|
||||||
public $lasterrno;
|
public $lasterrno;
|
||||||
|
|
||||||
/** @var bool Status */
|
/** @var bool Status */
|
||||||
|
|||||||
@ -48,7 +48,7 @@ $Config['Enabled'] = true ;
|
|||||||
$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access
|
$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access
|
||||||
|
|
||||||
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website)?'':'_'.$website).'&entity='.$extEntity.'&file=' ;
|
$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=medias'.(empty($website)?'':'_'.$website).'&entity='.$extEntity.'&file=' ;
|
||||||
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/' . $entity : '') . '/medias/') : ('/websites/'.$website));
|
$Config['UserFilesAbsolutePathRelative'] = (empty($website) ? ((!empty($entity) ? '/' . $entity : '') . '/medias/') : ('/website/'.$website));
|
||||||
|
|
||||||
|
|
||||||
// Fill the following value it you prefer to specify the absolute path for the
|
// Fill the following value it you prefer to specify the absolute path for the
|
||||||
|
|||||||
@ -34,7 +34,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
|||||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||||
|
|
||||||
if (! defined('DISABLE_JQUERY_TABLEDND')) define('DISABLE_JQUERY_TABLEDND',1);
|
if (! defined('DISABLE_JQUERY_TABLEDND')) define('DISABLE_JQUERY_TABLEDND',1);
|
||||||
if (! defined('DISABLE_JQUERY_TIPTIP')) define('DISABLE_JQUERY_TIPTIP',1);
|
|
||||||
if (! defined('DISABLE_JQUERY_JNOTIFY')) define('DISABLE_JQUERY_JNOTIFY',1);
|
if (! defined('DISABLE_JQUERY_JNOTIFY')) define('DISABLE_JQUERY_JNOTIFY',1);
|
||||||
if (! defined('DISABLE_JQUERY_FLOT')) define('DISABLE_JQUERY_FLOT',1);
|
if (! defined('DISABLE_JQUERY_FLOT')) define('DISABLE_JQUERY_FLOT',1);
|
||||||
if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1);
|
if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1);
|
||||||
|
|||||||
@ -152,237 +152,27 @@ jQuery(function($){
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set select2 translations (if module was loaded).
|
* Set array used for select2 translations
|
||||||
*/
|
*/
|
||||||
(function ($) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
if (typeof $.fn.select2 != "undefined") {
|
var select2arrayoflanguage = {
|
||||||
/* console.log($.fn.select2);
|
matches: function (matches) { return matches + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2ResultFoundUseArrows")); ?>"; },
|
||||||
console.log("ok"); */
|
noResults: function () { return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2NotFound")); ?>"; },
|
||||||
|
inputTooShort: function (input) {
|
||||||
$.fn.select2.locales['xx'] = {
|
var n = input.minimum;
|
||||||
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
|
console.log(input);
|
||||||
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
|
console.log(input.minimum);
|
||||||
formatInputTooShort: function (input, min) { var n = min - input.length;
|
if (n > 1) return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2MoreCharacters")); ?>";
|
||||||
if (n > 1) return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>";
|
else return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2MoreCharacter")); ?>"
|
||||||
else return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacter")); ?>"
|
|
||||||
},
|
},
|
||||||
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
|
loadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2LoadingMoreResults")); ?>"; },
|
||||||
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
|
searching: function () { return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2SearchInProgress")); ?>"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend($.fn.select2.defaults, $.fn.select2.locales['xx']);
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
})(jQuery);
|
* For calendar input
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* =================================================================
|
|
||||||
* Purpose:
|
|
||||||
* Pour la saisie des dates par calendrier Input: base "/theme/eldy" dateFieldID
|
|
||||||
* "dateo" Nom du champ format "dd/MM/yyyy" Format issu de Dolibarr de
|
|
||||||
* SimpleDateFormat a utiliser pour retour
|
|
||||||
* ==================================================================
|
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
function showDP(base,dateFieldID,format,codelang)
|
|
||||||
{
|
|
||||||
// check to see if another box is already showing
|
|
||||||
var alreadybox=getObjectFromID("DPCancel");
|
|
||||||
if (alreadybox) closeDPBox(); // This erase value of showDP.datefieldID
|
|
||||||
|
|
||||||
// alert("showDP "+codelang);
|
|
||||||
showDP.datefieldID=dateFieldID; // Must be after the close
|
|
||||||
|
|
||||||
var dateField=getObjectFromID(dateFieldID);
|
|
||||||
|
|
||||||
// get positioning
|
|
||||||
var thetop=getTop(dateField)+dateField.offsetHeight;
|
|
||||||
|
|
||||||
// var xxx=getObjectFromID('bottompage');
|
|
||||||
// alert(xxx.style.pixelTop);
|
|
||||||
// alert(document.body.clientHeight);
|
|
||||||
// alert(document.body.style.offsetTop);
|
|
||||||
// alert(thetop);
|
|
||||||
// alert(window.innerHeight);
|
|
||||||
if (thetop+160 > window.innerHeight)
|
|
||||||
thetop=thetop-160-20;
|
|
||||||
var theleft=getLeft(dateField);
|
|
||||||
if (theleft+140 > window.innerWidth)
|
|
||||||
theleft= theleft-140+dateField.offsetWidth-15;
|
|
||||||
|
|
||||||
showDP.box=document.createElement("div");
|
|
||||||
showDP.box.className="bodyline";
|
|
||||||
showDP.box.style.display="block";
|
|
||||||
showDP.box.style.zIndex="1000";
|
|
||||||
showDP.box.style.position="absolute";
|
|
||||||
showDP.box.style.top=thetop + "px";
|
|
||||||
showDP.box.style.left=theleft + "px";
|
|
||||||
|
|
||||||
if (dateField.value) // Si il y avait valeur initiale dans champ
|
|
||||||
{
|
|
||||||
selDate=getDateFromFormat(dateField.value,format);
|
|
||||||
if (selDate)
|
|
||||||
{
|
|
||||||
// Success to parse value in field according to format
|
|
||||||
year=selDate.getFullYear();
|
|
||||||
month=selDate.getMonth()+1;
|
|
||||||
day=selDate.getDate();
|
|
||||||
datetime=selDate.getTime();
|
|
||||||
ymd=formatDate(selDate,'yyyyMMdd');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Failed to parse value in field according to format
|
|
||||||
selDate=new Date();
|
|
||||||
year=selDate.getFullYear();
|
|
||||||
month=selDate.getUTCMonth()+1;
|
|
||||||
day=selDate.getDate();
|
|
||||||
datetime=selDate.getTime();
|
|
||||||
ymd=formatDate(selDate,'yyyyMMdd');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
selDate=new Date();
|
|
||||||
year=selDate.getFullYear();
|
|
||||||
month=selDate.getUTCMonth()+1;
|
|
||||||
day=selDate.getDate();
|
|
||||||
datetime=selDate.getTime();
|
|
||||||
ymd=formatDate(selDate,'yyyyMMdd');
|
|
||||||
}
|
|
||||||
loadMonth(base,month,year,ymd,codelang);
|
|
||||||
hideSelectBoxes();
|
|
||||||
document.body.appendChild(showDP.box);
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetDP(base,dateFieldID,format,codelang)
|
|
||||||
{
|
|
||||||
var dateField=getObjectFromID(dateFieldID);
|
|
||||||
dateField.value = formatDate(new Date(), format);
|
|
||||||
dpChangeDay(dateFieldID,format);
|
|
||||||
|
|
||||||
var alreadybox=getObjectFromID("DPCancel");
|
|
||||||
if (alreadybox) showDP(base,dateFieldID,format,codelang);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadMonth(base,month,year,ymd,codelang)
|
|
||||||
{
|
|
||||||
// showDP.box.innerHTML="Loading...";
|
|
||||||
// alert(codelang);
|
|
||||||
var theURL=base+"datepicker.php?cm=shw&lang="+codelang;
|
|
||||||
theURL+="&m="+encodeURIComponent(month);
|
|
||||||
theURL+="&y="+encodeURIComponent(year);
|
|
||||||
if (selDate)
|
|
||||||
{
|
|
||||||
theURL+="&sd="+ymd;
|
|
||||||
}
|
|
||||||
|
|
||||||
var req=null;
|
|
||||||
|
|
||||||
req=loadXMLDoc(theURL,null,false);
|
|
||||||
if (req.responseText == '') alert('Failed to get URL '.theURL);
|
|
||||||
// alert(theURL+' - '+req.responseText); // L'url doit avoir la meme racine
|
|
||||||
// que la pages et elements sinon pb de securite.
|
|
||||||
showDP.box.innerHTML=req.responseText;
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeDPBox()
|
|
||||||
{
|
|
||||||
document.body.removeChild(showDP.box);
|
|
||||||
displaySelectBoxes();
|
|
||||||
showDP.box=null;
|
|
||||||
showDP.datefieldID=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function dpClickDay(year,month,day,format)
|
|
||||||
{
|
|
||||||
var thefield=getObjectFromID(showDP.datefieldID);
|
|
||||||
var thefieldday=getObjectFromID(showDP.datefieldID+"day");
|
|
||||||
var thefieldmonth=getObjectFromID(showDP.datefieldID+"month");
|
|
||||||
var thefieldyear=getObjectFromID(showDP.datefieldID+"year");
|
|
||||||
|
|
||||||
var dt = new Date(year, month-1, day);
|
|
||||||
|
|
||||||
thefield.value=formatDate(dt,format);
|
|
||||||
if(thefield.onchange) thefield.onchange.call(thefield);
|
|
||||||
|
|
||||||
thefieldday.value=day;
|
|
||||||
if(thefieldday.onchange) thefieldday.onchange.call(thefieldday);
|
|
||||||
thefieldmonth.value=month;
|
|
||||||
if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth);
|
|
||||||
thefieldyear.value=year;
|
|
||||||
if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear);
|
|
||||||
|
|
||||||
closeDPBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
function dpHighlightDay(year,month,day,months){
|
|
||||||
var displayinfo=getObjectFromID("dpExp");
|
|
||||||
displayinfo.innerHTML=months[month-1]+" "+day+", "+year;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This Function returns the top position of an object
|
|
||||||
function getTop(theitem){
|
|
||||||
var offsetTrail = theitem;
|
|
||||||
var offsetTop = 0;
|
|
||||||
while (offsetTrail) {
|
|
||||||
offsetTop += offsetTrail.offsetTop;
|
|
||||||
offsetTrail = offsetTrail.offsetParent;
|
|
||||||
}
|
|
||||||
if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined")
|
|
||||||
offsetTop += document.body.TopMargin;
|
|
||||||
return offsetTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This Function returns the left position of an object
|
|
||||||
function getLeft(theitem){
|
|
||||||
var offsetTrail = theitem;
|
|
||||||
var offsetLeft = 0;
|
|
||||||
while (offsetTrail) {
|
|
||||||
offsetLeft += offsetTrail.offsetLeft;
|
|
||||||
offsetTrail = offsetTrail.offsetParent;
|
|
||||||
}
|
|
||||||
if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined")
|
|
||||||
offsetLeft += document.body.leftMargin;
|
|
||||||
return offsetLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
|
|
||||||
// not put popup completely on the front)
|
|
||||||
// Used only bu popup calendar
|
|
||||||
function hideSelectBoxes() {
|
|
||||||
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
|
|
||||||
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
|
|
||||||
{
|
|
||||||
for(var i = 0; i < document.all.length; i++)
|
|
||||||
{
|
|
||||||
if(document.all[i].tagName)
|
|
||||||
if(document.all[i].tagName == "SELECT")
|
|
||||||
document.all[i].style.visibility="hidden";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and
|
|
||||||
// not put popup completely on the front)
|
|
||||||
// Used only bu popup calendar
|
|
||||||
function displaySelectBoxes() {
|
|
||||||
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
|
|
||||||
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1)
|
|
||||||
{
|
|
||||||
for(var i = 0; i < document.all.length; i++)
|
|
||||||
{
|
|
||||||
if(document.all[i].tagName)
|
|
||||||
if(document.all[i].tagName == "SELECT")
|
|
||||||
document.all[i].style.visibility="visible";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Returns an object given an id
|
// Returns an object given an id
|
||||||
function getObjectFromID(id){
|
function getObjectFromID(id){
|
||||||
@ -426,69 +216,6 @@ function dpChangeDay(dateFieldID,format)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create XMLHttpRequest object and load url
|
|
||||||
// Used by calendar or other ajax processes
|
|
||||||
// Return req built or false if error
|
|
||||||
function loadXMLDoc(url,readyStateFunction,async)
|
|
||||||
{
|
|
||||||
// req must be defined by caller with
|
|
||||||
// var req = false;
|
|
||||||
|
|
||||||
// branch for native XMLHttpRequest object (Mozilla, Safari...)
|
|
||||||
if (window.XMLHttpRequest)
|
|
||||||
{
|
|
||||||
req = new XMLHttpRequest();
|
|
||||||
|
|
||||||
// if (req.overrideMimeType) {
|
|
||||||
// req.overrideMimeType('text/xml');
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// branch for IE/Windows ActiveX version
|
|
||||||
else if (window.ActiveXObject)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
req = new ActiveXObject("Msxml2.XMLHTTP");
|
|
||||||
}
|
|
||||||
catch (e)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
req = new ActiveXObject("Microsoft.XMLHTTP");
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If XMLHttpRequestObject req is ok, call URL
|
|
||||||
if (! req)
|
|
||||||
{
|
|
||||||
alert('Cannot create XMLHTTP instance');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (readyStateFunction) req.onreadystatechange = readyStateFunction;
|
|
||||||
// Exemple of function for readyStateFuncyion:
|
|
||||||
// function ()
|
|
||||||
// {
|
|
||||||
// if ( (req.readyState == 4) && (req.status == 200) ) {
|
|
||||||
// if (req.responseText == 1) { newStatus = 'AAA'; }
|
|
||||||
// if (req.responseText == 0) { newStatus = 'BBB'; }
|
|
||||||
// if (currentStatus != newStatus) {
|
|
||||||
// if (newStatus == "AAA") { obj.innerHTML = 'AAA'; }
|
|
||||||
// else { obj.innerHTML = 'BBB'; }
|
|
||||||
// currentStatus = newStatus;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
req.open("GET", url, async);
|
|
||||||
req.send(null);
|
|
||||||
return req;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* Function:
|
* Function:
|
||||||
@ -552,9 +279,9 @@ function formatDate(date,format)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* Function:
|
* Function: getDateFromFormat(date_string, format_string)
|
||||||
* getDateFromFormat(date_string, format_string) Purpose: This function takes a
|
* Purpose: This function takes a date string and a format string.
|
||||||
* date string and a format string. It parses the date string with format and it
|
* It parses the date string with format and it
|
||||||
* returns the date as a javascript Date() object. If date does not match
|
* returns the date as a javascript Date() object. If date does not match
|
||||||
* format, it returns 0. The format string can use the following tags:
|
* format, it returns 0. The format string can use the following tags:
|
||||||
* Field | Tags
|
* Field | Tags
|
||||||
@ -650,8 +377,7 @@ function getDateFromFormat(val,format)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* Function:
|
* Function: stringIsInteger(string)
|
||||||
* stringIsInteger(string)
|
|
||||||
* Purpose: Return true if string is an integer
|
* Purpose: Return true if string is an integer
|
||||||
* ==================================================================
|
* ==================================================================
|
||||||
*/
|
*/
|
||||||
@ -670,8 +396,7 @@ function stringIsInteger(str)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* Function:
|
* Function: getIntegerInString(string,pos,minlength,maxlength)
|
||||||
* getIntegerInString(string,pos,minlength,maxlength)
|
|
||||||
* Purpose: Return part of string from position i that is integer
|
* Purpose: Return part of string from position i that is integer
|
||||||
* ==================================================================
|
* ==================================================================
|
||||||
*/
|
*/
|
||||||
@ -689,8 +414,7 @@ function getIntegerInString(str,i,minlength,maxlength)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* Purpose:
|
* Purpose: Clean string to have it url encoded
|
||||||
* Clean string to have it url encoded
|
|
||||||
* Input: s
|
* Input: s
|
||||||
* Author: Laurent Destailleur
|
* Author: Laurent Destailleur
|
||||||
* Licence: GPL
|
* Licence: GPL
|
||||||
@ -706,8 +430,7 @@ function urlencode(s) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* Purpose:
|
* Purpose: Applique un delai avant execution. Used for autocompletion of companies.
|
||||||
* Applique un delai avant execution. Used for autocompletion of companies.
|
|
||||||
* Input: funct, delay
|
* Input: funct, delay
|
||||||
* Author: Regis Houssin
|
* Author: Regis Houssin
|
||||||
* Licence: GPL
|
* Licence: GPL
|
||||||
@ -955,6 +678,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* =================================================================
|
* =================================================================
|
||||||
* This is to allow to transform all select box into ajax autocomplete box
|
* This is to allow to transform all select box into ajax autocomplete box
|
||||||
@ -1070,6 +794,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
|
|||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to output a dialog bog for copy/paste
|
* Function to output a dialog bog for copy/paste
|
||||||
*
|
*
|
||||||
|
|||||||
@ -387,6 +387,7 @@ function ajax_autoselect($htmlname, $addlink='')
|
|||||||
* @param int $forcefocus Force focus on field
|
* @param int $forcefocus Force focus on field
|
||||||
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
|
* @param string $widthTypeOfAutocomplete 'resolve' or 'off'
|
||||||
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
|
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
|
||||||
|
* @see selectArrayAjax of html.form.class
|
||||||
*/
|
*/
|
||||||
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
|
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
|
||||||
{
|
{
|
||||||
@ -404,10 +405,23 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
|
|||||||
$msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
$msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
var query = {};
|
||||||
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
|
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
|
||||||
dir: \'ltr\',
|
dir: \'ltr\',
|
||||||
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */
|
||||||
minimumInputLength: '.$minLengthToAutocomplete.'
|
minimumInputLength: '.$minLengthToAutocomplete.',
|
||||||
|
language: select2arrayoflanguage,
|
||||||
|
templateResult: function (data, container) { /* Format visible output into combo list */
|
||||||
|
/* Code to add class of origin option propagated to the new select2 li tag */
|
||||||
|
if (data.element) {
|
||||||
|
$(container).addClass($(data.element).attr("class"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.text;
|
||||||
|
},
|
||||||
|
templateSelection: function (selection) { /* Format visible output of selected value */
|
||||||
|
return selection.text;
|
||||||
|
},
|
||||||
})';
|
})';
|
||||||
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
if ($forcefocus) $msg.= '.select2(\'focus\')';
|
||||||
$msg.= ';'."\n";
|
$msg.= ';'."\n";
|
||||||
|
|||||||
@ -145,6 +145,27 @@ function societe_prepare_head(Societe $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->ACCOUNTING_ENABLE_LETTERING))
|
||||||
|
{
|
||||||
|
// Tab to accountancy
|
||||||
|
if (! empty($conf->accounting->enabled) && $object->client>0)
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettrage.php?socid='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("TabAccountingCustomer");
|
||||||
|
$head[$h][2] = 'accounting';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tab to accountancy
|
||||||
|
if (! empty($conf->accounting->enabled) && $object->fournisseur>0)
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettrage_supplier.php?socid='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("TabAccountingSupplier");
|
||||||
|
$head[$h][2] = 'accounting_supplier';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Related items
|
// Related items
|
||||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
|
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||||
{
|
{
|
||||||
@ -185,6 +206,34 @@ function societe_prepare_head(Societe $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->website->enabled) && (!empty($user->rights->societe->lire) ))
|
||||||
|
{
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/societe/website.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("WebSites");
|
||||||
|
$nbNote = 0;
|
||||||
|
$sql = "SELECT COUNT(n.rowid) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."websiteaccount as n";
|
||||||
|
$sql.= " WHERE fk_soc = ".$object->id;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$nbNote=$obj->nb;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
|
$head[$h][2] = 'website';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// 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 add new tab
|
||||||
|
|||||||
@ -47,7 +47,7 @@ function dol_basename($pathfile)
|
|||||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
|
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
|
||||||
* but must not contains the start and end '/'. Filter is checked into basename only.
|
* but must not contains the start and end '/'. Filter is checked into basename only.
|
||||||
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath.
|
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath.
|
||||||
* @param string $sortcriteria Sort criteria ("","fullname","relativename","name","date","size")
|
* @param string $sortcriteria Sort criteria ('','fullname','relativename','name','date','size')
|
||||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
||||||
* @param int $nohook Disable all hooks
|
* @param int $nohook Disable all hooks
|
||||||
|
|||||||
@ -2654,7 +2654,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
/**
|
/**
|
||||||
* Show picto whatever it's its name (generic function)
|
* Show picto whatever it's its name (generic function)
|
||||||
*
|
*
|
||||||
* @param string $titlealt Text on title and alt. If text is "TextA:TextB", use Text A on alt and Text B on title. Alt only if param notitle is set to 1.
|
* @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1.
|
||||||
* @param string $picto Name of image file to show ('filenew', ...)
|
* @param string $picto Name of image file to show ('filenew', ...)
|
||||||
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||||
@ -2664,12 +2664,13 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
|||||||
* @param int $pictoisfullpath If 1, image path is a full path
|
* @param int $pictoisfullpath If 1, image path is a full path
|
||||||
* @param int $srconly Return only content of the src attribute of img.
|
* @param int $srconly Return only content of the src attribute of img.
|
||||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||||
|
* @param string $alt Force alt for bind peoplae
|
||||||
* @return string Return img tag
|
* @return string Return img tag
|
||||||
* @see #img_object, #img_picto_common
|
* @see #img_object, #img_picto_common
|
||||||
*/
|
*/
|
||||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0)
|
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0, $alt='')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $langs;
|
||||||
|
|
||||||
// Define fullpathpicto to use into src
|
// Define fullpathpicto to use into src
|
||||||
if ($pictoisfullpath)
|
if ($pictoisfullpath)
|
||||||
@ -2680,6 +2681,23 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($picto == 'switch_off')
|
||||||
|
{
|
||||||
|
$enabledisablehtml='';
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-off valignmiddle" style="font-size: 2em; color: #999;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("EnableOverwriteTranslation");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
|
return $enabledisablehtml;
|
||||||
|
}
|
||||||
|
if ($picto == 'switch_on')
|
||||||
|
{
|
||||||
|
$enabledisablehtml='';
|
||||||
|
$enabledisablehtml.='<span class="fa fa-toggle-on valignmiddle" style="font-size: 2em; color: #227722;" alt="'.dol_escape_htmltag($titlealt).'">';
|
||||||
|
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $enabledisablehtml.=$langs->trans("DisableOverwriteTranslation");
|
||||||
|
$enabledisablehtml.='</span>';
|
||||||
|
return $enabledisablehtml;
|
||||||
|
}
|
||||||
|
|
||||||
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
|
||||||
$url = DOL_URL_ROOT;
|
$url = DOL_URL_ROOT;
|
||||||
$theme = $conf->theme;
|
$theme = $conf->theme;
|
||||||
@ -2716,11 +2734,13 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
if ($srconly) return $fullpathpicto;
|
if ($srconly) return $fullpathpicto;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmparray=array(0=>$titlealt);
|
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people
|
||||||
if (preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
|
//$tmparray=array(0=>$titlealt);
|
||||||
$title=$tmparray[0];
|
//if (empty($notitle) && preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
|
||||||
$alt=empty($tmparray[1])?'':$tmparray[1];
|
//$title=$tmparray[0];
|
||||||
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($moreatt?' '.$moreatt:' class="inline-block valigntextbottom"').'>'; // Alt is used for accessibility, title for popup
|
//$alt=empty($tmparray[1])?'':$tmparray[1];
|
||||||
|
$title=$titlealt;
|
||||||
|
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($title))?'':' title="'.dol_escape_htmltag($title).'"').($moreatt?' '.$moreatt:' class="inline-block"').'>'; // Alt is used for accessibility, title for popup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6791,3 +6811,37 @@ function getDictvalue($tablename, $field, $id, $checkentity=false, $rowidfield='
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the color is light
|
||||||
|
*
|
||||||
|
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
|
||||||
|
* @return int -1 : Error with argument passed |0 : color is dark | 1 : color is light
|
||||||
|
*/
|
||||||
|
function colorIsLight($stringcolor)
|
||||||
|
{
|
||||||
|
$res = -1;
|
||||||
|
if (!empty($stringcolor))
|
||||||
|
{
|
||||||
|
$res = 0;
|
||||||
|
$tmp=explode(',', $stringcolor);
|
||||||
|
if (count($tmp) > 1) // This is a comma RGB ('255','255','255')
|
||||||
|
{
|
||||||
|
$r = $tmp[0];
|
||||||
|
$g = $tmp[1];
|
||||||
|
$b = $tmp[2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$hexr=$stringcolor[0].$stringcolor[1];
|
||||||
|
$hexg=$stringcolor[2].$stringcolor[3];
|
||||||
|
$hexb=$stringcolor[4].$stringcolor[5];
|
||||||
|
$r = hexdec($hexr);
|
||||||
|
$g = hexdec($hexg);
|
||||||
|
$b = hexdec($hexb);
|
||||||
|
}
|
||||||
|
$bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
|
||||||
|
if ($bright > 0.6) $res = 1;
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user