Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2015-12-12 13:19:55 +01:00
commit 5f4be14dd2
540 changed files with 12520 additions and 24924 deletions

View File

@ -19,7 +19,7 @@ EvalMath 1.0 BSD Yes
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
Mobiledetect 2.8.3 MIT License Yes Detect mobile devices browsers
Mobiledetect 2.8.17 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
@ -28,7 +28,7 @@ php-iban 1.4.7 LGPL-3+ Yes
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.6 LGPL-3+ Yes PDF generation
TCPDF 6.2.12 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:

View File

@ -533,8 +533,10 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/PHPExcel/Shared/PDF`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/PHPExcel/Shared/PCLZip`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;

View File

@ -18,12 +18,10 @@
"ccampbell/chromephp": "^4.1",
"ckeditor/ckeditor": "dev-full/4.3.x#0b7c3f1",
"mike42/escpos-php": "dev-master",
"mobiledetect/mobiledetectlib": "2.8.3",
"mobiledetect/mobiledetectlib": "2.8.17",
"phpoffice/phpexcel": "1.8.1",
"restler/framework": "^3.0",
"tecnickcom/tcpdf": "6.2.6",
"raven/raven": "^0.12.0",
"firephp/firephp-core": "^0.4.0"
"tecnickcom/tcpdf": "6.2.12"
},
"suggest": {
"ext-mysqlnd": "To use with MySQL or MariaDB",
@ -38,7 +36,9 @@
"ext-mbstring": "Handle non UTF-8 databases",
"ext-soap": "Native SOAP",
"ext-zip": "ODT and Excel support",
"ext-xml": "Excel support"
"ext-xml": "Excel support",
"firephp/firephp-core": "Logging to Firebug console support",
"raven/raven": "Sentry logging server support"
},
"config": {
"vendor-dir": "htdocs/includes"

125
composer.lock generated
View File

@ -4,7 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "335eb7bd5c2eb116fd2da80b4f48e857",
"hash": "d8229cbb9aea945c9ca803bbe54d7aa7",
"content-hash": "47929ed42fb67e5159ccec6a3a5a45eb",
"packages": [
{
"name": "ccampbell/chromephp",
@ -90,54 +91,18 @@
],
"time": "2014-02-26 15:43:10"
},
{
"name": "firephp/firephp-core",
"version": "v0.4.0",
"source": {
"type": "git",
"url": "https://github.com/firephp/firephp-core.git",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firephp/firephp-core/zipball/fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"reference": "fabad0f2503f9577fe8dd2cb1d1c7cd73ed2aacf",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"lib/FirePHPCore/FirePHP.class.php",
"lib/FirePHPCore/fb.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christoph Dorn",
"email": "christoph@christophdorn.com",
"homepage": "http://christophdorn.com"
}
],
"description": "Traditional FirePHPCore library for sending PHP variables to the browser.",
"homepage": "https://github.com/firephp/firephp-core",
"time": "2013-04-23 15:28:20"
},
{
"name": "mike42/escpos-php",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/mike42/escpos-php.git",
"reference": "0564ff94de45564221eca99c4cd5ab24492894c2"
"reference": "63648d03d47b81e8f6c1020ac92f051a3f3b5793"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/0564ff94de45564221eca99c4cd5ab24492894c2",
"reference": "0564ff94de45564221eca99c4cd5ab24492894c2",
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/63648d03d47b81e8f6c1020ac92f051a3f3b5793",
"reference": "63648d03d47b81e8f6c1020ac92f051a3f3b5793",
"shasum": ""
},
"require": {
@ -182,26 +147,28 @@
"print",
"receipt"
],
"time": "2015-11-02 10:50:46"
"time": "2015-12-04 10:23:55"
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.3",
"version": "2.8.17",
"source": {
"type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git",
"reference": "f5753e4b90daffe50c902e99df5ce3c58fca3fee"
"reference": "b87da5f63a76e9615a0c74fcf168657b1ea7e41d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/f5753e4b90daffe50c902e99df5ce3c58fca3fee",
"reference": "f5753e4b90daffe50c902e99df5ce3c58fca3fee",
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/b87da5f63a76e9615a0c74fcf168657b1ea7e41d",
"reference": "b87da5f63a76e9615a0c74fcf168657b1ea7e41d",
"shasum": ""
},
"require": {
"php": ">=5.0.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"johnkary/phpunit-speedtrap": "~1.0@dev",
"phpunit/phpunit": "*"
},
"type": "library",
@ -221,7 +188,7 @@
{
"name": "Serban Ghita",
"email": "serbanghita@gmail.com",
"homepage": "http://ghita.org",
"homepage": "http://mobiledetect.net",
"role": "Developer"
}
],
@ -234,7 +201,7 @@
"mobile detector",
"php mobile detect"
],
"time": "2014-07-10 20:00:25"
"time": "2015-09-17 14:45:21"
},
{
"name": "phpoffice/phpexcel",
@ -293,60 +260,6 @@
],
"time": "2015-05-01 07:00:55"
},
{
"name": "raven/raven",
"version": "0.12.1",
"source": {
"type": "git",
"url": "https://github.com/getsentry/raven-php.git",
"reference": "b325984c792ff89f985b73da9a3ad8ed8b520bca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/raven-php/zipball/b325984c792ff89f985b73da9a3ad8ed8b520bca",
"reference": "b325984c792ff89f985b73da9a3ad8ed8b520bca",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.2.4"
},
"require-dev": {
"fabpot/php-cs-fixer": "^1.8.0",
"phpunit/phpunit": "^4.6.6"
},
"bin": [
"bin/raven"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.12.x-dev"
}
},
"autoload": {
"psr-0": {
"Raven_": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD"
],
"authors": [
{
"name": "David Cramer",
"email": "dcramer@gmail.com"
}
],
"description": "A PHP client for Sentry (http://getsentry.com)",
"homepage": "http://getsentry.com",
"keywords": [
"log",
"logging"
],
"time": "2015-08-25 22:38:46"
},
{
"name": "restler/framework",
"version": "3.0.0",
@ -423,16 +336,16 @@
},
{
"name": "tecnickcom/tcpdf",
"version": "6.2.6",
"version": "6.2.12",
"source": {
"type": "git",
"url": "https://github.com/tecnickcom/TCPDF.git",
"reference": "a2e8f5b505a7a14a4ed960313c4baf699fd1f4bb"
"reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/a2e8f5b505a7a14a4ed960313c4baf699fd1f4bb",
"reference": "a2e8f5b505a7a14a4ed960313c4baf699fd1f4bb",
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f",
"reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f",
"shasum": ""
},
"require": {
@ -482,7 +395,7 @@
"pdf417",
"qrcode"
],
"time": "2015-01-28 18:51:40"
"time": "2015-09-12 10:08:34"
}
],
"packages-dev": [],

View File

@ -303,6 +303,7 @@ else if ($id)
dol_print_error($db);
}
}
$db->close();
llxFooter();
llxFooter();
$db->close();

View File

@ -55,6 +55,5 @@ if ($id)
print '</div>';
}
$db->close();
llxFooter();
$db->close();

View File

@ -30,6 +30,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Langs
$langs->load("accountancy");
@ -52,6 +53,7 @@ if ($sortfield == "")
$offset = $conf->liste_limit * $page;
$formventilation = new FormVentilation($db);
$formother = new FormOther($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
@ -77,7 +79,20 @@ if ($action == 'delbookkeeping') {
setEventMessages($object->error, $object->errors, 'errors');
}
}
} // Export
}
elseif ($action == 'delbookkeepingyear') {
$delyear = GETPOST('delyear', 'int');
if (! empty($delyear)) {
$object = new BookKeeping($db);
$result = $object->delete_by_year($delyear);
Header("Location: list.php");
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}// Export
else if ($action == 'export_csv') {
header('Content-Type: text/csv');
@ -147,7 +162,7 @@ else {
print_barre_liste($langs->trans("Bookkeeping"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num);
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
/*print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="delbookkeeping">';
@ -155,6 +170,16 @@ else {
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '</form>';*/
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="delbookkeepingyear">';
print $formother->select_year(GETPOST('delyear'),'delyear');
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '</form>';
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';

View File

@ -372,6 +372,36 @@ class BookKeeping extends CommonObject
$this->db->commit();
return 1;
}
/**
* Delete bookkepping by importkey
*
* @param string $delyear year to delete
* @return int Result
*/
function delete_by_year($delyear) {
$this->db->begin();
// first check if line not yet in bookkeeping
$sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
$sql .= " WHERE YEAR(doc_date) = ".$delyear;
$resql = $this->db->query($sql);
if (! $resql) {
$this->errors[] = "Error " . $this->db->lasterror();
foreach ( $this->errors as $errmsg ) {
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
}
$this->db->rollback();
return - 1;
}
$this->db->commit();
return 1;
}
/**
* Create object into database

View File

@ -70,7 +70,7 @@ class FormVentilation extends Form
$selected = ' selected ';
}
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . $obj->import_key . '</OPTION>';
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key,'dayhourtext') . '</OPTION>';
$i ++;
}

View File

@ -87,10 +87,10 @@ if (! $user->rights->accounting->ventilation->dispatch)
accessforbidden();
$formventilation = new FormVentilation($db);
$accounting = new AccountingAccount($db);
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT,1);
$aarowid_p = $accounting->fetch('',$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT,1);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
@ -278,6 +278,8 @@ if ($result) {
$code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if (! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell;
} else {
@ -290,12 +292,14 @@ if ($result) {
}
if ($objp->type_l == 1) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
if ($objp->aarowid == '') {
$objp->aarowid_suggest = $aarowid_s;
}
} elseif ($objp->type_l == 0) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
if ($objp->aarowid == '') {
$objp->aarowid_suggest = $aarowid_p;
}
}
if ($objp->code_sell_l != $objp->code_sell_p)
$code_sell_p_l_differ = 'color:red';
@ -311,10 +315,12 @@ if ($result) {
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '&nbsp;';
print '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';

View File

@ -16,7 +16,7 @@
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License fr more details.
* 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/>.
@ -57,7 +57,7 @@ $langs->load("bank");
$langs->load('bills');
$langs->load("accountancy");
$id_accountancy_journal = GETPOST('id_account','int');
$id_bank_account = GETPOST('id_account','int');
$date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday');
@ -70,17 +70,12 @@ $action = GETPOST('action');
$now = dol_now();
// Security check
if ($user->societe_id > 0)
if ($user->societe_id > 0 && empty($id_bank_account))
accessforbidden();
/*
* View
*/
if (empty($id_accountancy_journal))
{
accessforbidden();
}
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
@ -107,7 +102,7 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
$sql .= " WHERE ba.rowid=".$id_accountancy_journal;
$sql .= " WHERE ba.rowid=".$id_bank_account;
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ba.entity = " . $conf->entity;
}
@ -125,7 +120,12 @@ $paymentdonstatic = new PaymentDonation($db);
$paymentvatstatic = new TVA($db);
$paymentsalstatic = new PaymentSalary($db);
dol_syslog("accountancy/journal/bankjournal.php:: sql=" . $sql, LOG_DEBUG);
// Get code of finance journal
$bank_code_journal = new Account($db);
$result=$bank_code_journal->fetch($id_bank_account);
$journal=$bank_code_journal->accountancy_journal;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
@ -288,8 +288,10 @@ if ($result) {
*/
// Write bookkeeping
if ($action == 'writeBookKeeping')
if ($action == 'writebookkeeping')
{
$now=dol_now();
$error = 0;
foreach ( $tabpay as $key => $val )
{
@ -309,8 +311,9 @@ if ($action == 'writeBookKeeping')
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
$bookkeeping->code_journal = $journal;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create=$now;
if ($tabtype[$key] == 'payment') {
@ -327,7 +330,7 @@ if ($action == 'writeBookKeeping')
}
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
@ -336,7 +339,7 @@ if ($action == 'writeBookKeeping')
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
$bookkeeping->doc_ref = $objmid->ref_supplier.' ('.$objmid->ref.')';;
}
}
@ -360,8 +363,9 @@ if ($action == 'writeBookKeeping')
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
$bookkeeping->code_journal = $journal;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create=$now;
if ($tabtype[$key] == 'sc') {
$bookkeeping->code_tiers = '';
@ -383,7 +387,7 @@ if ($action == 'writeBookKeeping')
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid = 'SELECT facf.ref_supplier,facf.ref';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
@ -392,7 +396,7 @@ if ($action == 'writeBookKeeping')
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->facnumber;
$bookkeeping->doc_ref = $objmid->ref_supplier.' ('.$objmid->ref.')';
}
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
@ -433,7 +437,6 @@ if ($action == 'writeBookKeeping')
if ($action == 'export_csv')
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
@ -443,16 +446,20 @@ if ($action == 'export_csv')
{
$sep = ";";
foreach ( $tabpay as $key => $val ) {
foreach ($tabpay as $key => $val)
{
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $bank_journal . $sep;
print $journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
@ -557,67 +564,26 @@ if ($action == 'export_csv')
}
}
}
}
else
}
else
{
$form = new Form($db);
llxHeader('', $langs->trans("BankJournal"));
llxHeader('', $langs->trans("FinanceJournal"));
$namereport = $langs->trans("BankJournal");
$description = $langs->trans("DescBankJournal");
$nom = $langs->trans("FinanceJournal" . ' - ' . $journal);
$builddate = time();
$description = $langs->trans("DescFinanceJournal") . '<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
// Report
$h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal;
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'card';
dol_fiche_head($head, 'card', $langs->trans("BankJournal"), 0, 'payment');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">';
print '<table width="100%" class="border">';
// Title
print '<tr>';
print '<td width="110">'.$langs->trans("ReportName").'</td>';
print '<td colspan="3">'.$namereport.'</td>';
print '</td>';
print '</tr>';
// Period report
print '<tr>';
print '<td>'.$langs->trans("ReportPeriod").'</td>';
if (! $periodlink) print '<td colspan="3">';
else print '<td>';
if ($period) print $period;
if ($periodlink) print '</td><td colspan="2">'.$periodlink;
print '</td>';
print '</tr>';
// Description
print '<tr>';
print '<td>'.$langs->trans("ReportDescription").'</td>';
print '<td colspan="3">'.$description.'</td>';
print '</tr>';
print '<tr>';
print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '</div>';
// End report
$varlink = 'id_account='.$id_bank_account;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '
<script type="text/javascript">
function launch_export() {
@ -625,8 +591,8 @@ else
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
function writeBookKeeping() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("writeBookKeeping");
function writebookkeeping() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("writebookkeeping");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
@ -709,7 +675,6 @@ else
print "</table>";
// End of page
llxFooter();
}
llxFooter();
$db->close();

View File

@ -42,5 +42,5 @@ llxHeader('', 'Journaux', '');
$form = new Form($db);
// End of page
$db->close();
llxFooter();
llxFooter();
$db->close();

View File

@ -86,7 +86,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,";
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur, s.fournisseur,";
$sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
@ -137,7 +137,7 @@ if ($result) {
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
$tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->ref;
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier.' ('.$obj->ref.')';
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->description;
$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
@ -488,7 +488,6 @@ if ($action == 'export_csv')
print "</table>";
// End of page
llxFooter();
}
llxFooter();
$db->close();

View File

@ -531,8 +531,6 @@ if ($action == 'export_csv')
print "</table>";
// End of page
llxFooter();
}
llxFooter();
$db->close();

View File

@ -94,8 +94,8 @@ $formventilation = new FormVentilation($db);
$accounting = new AccountingAccount($db);
// TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT,1);
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT,1);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers

View File

@ -77,6 +77,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -166,6 +166,6 @@ print "</table>\n";
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
print '</form>';
$db->close();
llxFooter();
$db->close();

View File

@ -158,6 +158,5 @@ print '</div>';
print info_admin($langs->trans("NoNeedForDeliveryReceipts"));
$db->close();
llxFooter();
$db->close();

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -320,6 +320,5 @@ else
}
$db->close();
llxFooter();
$db->close();

View File

@ -576,6 +576,5 @@ print '</table>';
print '<br>';
$db->close();
llxFooter();
$db->close();

View File

@ -325,6 +325,5 @@ if (function_exists("ldap_connect"))
}
}
$db->close();
llxFooter();
$db->close();

View File

@ -337,7 +337,6 @@ if (function_exists("ldap_connect"))
}
}
llxFooter();
$db->close();
llxFooter();

View File

@ -257,6 +257,5 @@ if (function_exists("ldap_connect"))
}
}
$db->close();
llxFooter();
$db->close();

View File

@ -452,6 +452,5 @@ if (function_exists("ldap_connect"))
}
}
$db->close();
llxFooter();
$db->close();

View File

@ -521,6 +521,6 @@ print '</form>';
print '</table>';
llxFooter();
$db->close();
llxFooter();

View File

@ -466,7 +466,5 @@ elseif ($action == 'edit')
print '<br>';
}
$db->close();
llxFooter();
$db->close();

View File

@ -218,7 +218,5 @@ print '</table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -284,6 +284,5 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION))
}
*/
$db->close();
llxFooter();
$db->close();

View File

@ -208,6 +208,5 @@ print '</div>';
print '</form>';
$db->close();
llxFooter();
$db->close();

View File

@ -604,6 +604,6 @@ print "</tr>\n";
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->supplier_proposal->dir_output."</td>\n</tr>\n";
print "</table>\n<br>";
llxFooter();
$db->close();
llxFooter();

View File

@ -51,3 +51,4 @@ print '</table>';
llxFooter();
$db->close();

View File

@ -226,6 +226,5 @@ print '</div>';
print '</form>';
$db->close();
llxFooter();
$db->close();

View File

@ -162,4 +162,5 @@ foreach($listofapis['v1'] as $key => $val)
}
llxFooter();
$db->close();

View File

@ -190,3 +190,4 @@ else {
}
llxFooter();
$db->close();

View File

@ -82,6 +82,5 @@ print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="'.$conf-
print '</td></tr>';
print '</table><br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div></form>';
$db->close();
llxFooter();
$db->close();

View File

@ -218,7 +218,7 @@ if ($user->rights->bookmark->creer)
print '</div>';
llxFooter();
$db->close();
llxFooter();

View File

@ -188,6 +188,5 @@ print '<div class="center"><input type="submit" class="button" value="'.$langs->
print "</form>\n";
$db->close();
llxFooter();
$db->close();

View File

@ -121,5 +121,5 @@ print '</td></tr>';
print '</table>';
$db->close();
llxFooter();
llxFooter();
$db->close();

View File

@ -64,6 +64,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -150,7 +150,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -63,6 +63,5 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
print '</div>';
}
$db->close();
llxFooter();
$db->close();

View File

@ -171,6 +171,5 @@ if ($_socid > 0)
}
$db->close();
llxFooter();
$db->close();

View File

@ -862,8 +862,8 @@ if (empty($reshook))
$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we muste keep this value
$date_start = dol_mktime(0, 0, 0, GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
@ -957,8 +957,8 @@ if (empty($reshook))
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
// Extrafields
$extrafieldsline = new ExtraFields($db);

View File

@ -89,7 +89,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -88,7 +88,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -199,6 +199,5 @@ if ($socid > 0)
}
$db->close();
llxFooter();
$db->close();

View File

@ -544,6 +544,5 @@ if ($socid > 0)
}
$db->close();
llxFooter();
$db->close();

View File

@ -626,8 +626,8 @@ if (empty($reshook))
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
// Clean parameters
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), 0, GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), 0, GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT');
// Ecrase $pu par celui du produit
@ -833,8 +833,8 @@ if (empty($reshook))
// Clean parameters
$date_start='';
$date_end='';
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
$description=dol_htmlcleanlastbr(GETPOST('product_desc'));
$pu_ht=GETPOST('price_ht');
$vat_rate=(GETPOST('tva_tx')?GETPOST('tva_tx'):0);

View File

@ -62,7 +62,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -89,6 +89,5 @@ print "<tr ".$bc[$var]."><td>".$langs->trans("BankBalance")."</td><td align=\"ri
print "</table>";
$db->close();
llxFooter();
$db->close();

View File

@ -97,6 +97,5 @@ else
}
print "</table>";
$db->close();
llxFooter();
$db->close();

View File

@ -1041,8 +1041,5 @@ else
}
$db->close();
llxFooter();
$db->close();

View File

@ -62,7 +62,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -353,7 +353,5 @@ if ($_POST["action"] == "search" && ! $num)
print $langs->trans("NoRecordFound");
}
$db->close();
llxFooter();
$db->close();

View File

@ -339,6 +339,5 @@ else
print $langs->trans("ErrorBankAccountNotFound");
}
$db->close();
llxFooter();
$db->close();

View File

@ -188,6 +188,5 @@ print '<br><div class="center"><input type="submit" class="button" value="'.$lan
print "</form>";
$db->close();
llxFooter();
$db->close();

View File

@ -210,6 +210,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -58,6 +58,5 @@ if ($id)
print '</div>';
}
$db->close();
llxFooter();
$db->close();

View File

@ -54,6 +54,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -269,8 +269,6 @@ if ($id)
print "</div>";
}
llxFooter();
$db->close();
llxFooter();

View File

@ -318,7 +318,5 @@ if($conf->global->$calc ==0){
}
print '</table>';
$db->close();
llxFooter();
$db->close();

View File

@ -280,6 +280,5 @@ print '</td></tr></table>';
print '</td></tr>';
print '</table>';
$db->close();
llxFooter();
$db->close();

View File

@ -663,6 +663,5 @@ else
$i++;
}
$db->close();
llxFooter();
$db->close();

View File

@ -92,6 +92,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -118,6 +118,5 @@ if ($resql)
print "</table>";
}
$db->close();
llxFooter();
$db->close();

View File

@ -31,8 +31,5 @@ llxHeader();
print load_fiche_titre("Payments");
$db->close();
llxFooter();
$db->close();

View File

@ -63,6 +63,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -323,7 +323,5 @@ if ($_GET["action"] == 'create')
print "</form>\n";
}
$db->close();
llxFooter();
$db->close();

View File

@ -299,7 +299,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -157,5 +157,5 @@ else
dol_print_error($db);
}
llxFooter();
$db->close();

View File

@ -178,6 +178,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -159,6 +159,5 @@ if ($prev_id)
}
}
$db->close();
llxFooter();
$db->close();

View File

@ -192,7 +192,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -124,6 +124,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -247,9 +247,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -372,7 +372,5 @@ if ($id)
print "</div>";
}
$db->close();
llxFooter();
$db->close();

View File

@ -252,7 +252,5 @@ print "</td></tr></table>";
print '</td></tr>';
print '</table>';
$db->close();
llxFooter();
$db->close();

View File

@ -313,7 +313,5 @@ print '</table>';
echo '</td></tr>';
echo '</table>';
$db->close();
llxFooter();
$db->close();

View File

@ -638,6 +638,5 @@ else
}
echo '</table>';
$db->close();
llxFooter();
$db->close();

View File

@ -707,6 +707,5 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
}
print '</table>';
$db->close();
llxFooter();
$db->close();

View File

@ -160,6 +160,5 @@ else
print "Error ID incorrect";
}
$db->close();
llxFooter();
$db->close();

View File

@ -144,6 +144,5 @@ else
print "Error ID incorrect";
}
$db->close();
llxFooter();
$db->close();

View File

@ -100,6 +100,6 @@ else
{
print $db->error();
}
$db->close();
llxFooter();
$db->close();

View File

@ -55,6 +55,5 @@ print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
$db->close();

View File

@ -85,9 +85,9 @@ class CSMSFile
/**
* Send mail that was prepared by constructor
* Send sms that was prepared by constructor
*
* @return boolean True if mail sent, false otherwise
* @return boolean True if sms sent, false otherwise
*/
function sendfile()
{
@ -168,7 +168,7 @@ class CSMSFile
}
else
{
// Send mail method not correctly defined
// Send sms method not correctly defined
// --------------------------------------
return 'Bad value for MAIN_SMS_SENDMODE constant';
@ -176,7 +176,7 @@ class CSMSFile
}
else
{
$this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_SMS';
$this->error='No sms sent. Feature is disabled by option MAIN_DISABLE_ALL_SMS';
dol_syslog("CSMSFile::sendfile: ".$this->error, LOG_WARNING);
}
@ -187,7 +187,7 @@ class CSMSFile
/**
* Write content of a SMTP request into a dump file (mode = all)
* Write content of a SendSms request into a dump file (mode = all)
* Used for debugging.
*
* @return void
@ -215,7 +215,7 @@ class CSMSFile
}
/**
* Write content of a SMTP request into a dump file (mode = all)
* Write content of a SendSms result into a dump file (mode = all)
* Used for debugging.
*
* @param int $result Result of sms sending

View File

@ -364,6 +364,7 @@ abstract class CommonObject
dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
return -1;
}
if ($ref || $ref_ext) $sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class()."::isExistingObject", LOG_DEBUG);
$resql = $db->query($sql);

View File

@ -56,7 +56,7 @@ print '<html>'."\n";
print '<head>'."\n";
if (GETPOST('mode') && GETPOST('mode') == 'test')
{
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js"></script>'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php"></script>'."\n";
}
else
{
@ -288,4 +288,4 @@ function displayBox($selectedDate,$month,$year)
</tr>
</table>
<?php
}//end function
}//end function

View File

@ -1,25 +1,49 @@
// Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
// Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// or see http://www.gnu.org/
<?php
/* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
//
// \file htdocs/core/js/lib_head.js
// \brief File that include javascript functions (included if option use_javascript activated)
//
/**
* \file htdocs/core/js/lib_head.js.php
* \brief File that include javascript functions (included if option use_javascript activated)
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
session_cache_limiter(FALSE);
require_once '../../main.inc.php';
// Define javascript type
header('Content-type: text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache');
?>
/*
* =================================================================
@ -923,7 +947,6 @@ function copyToClipboard(text,text2)
return false;
}
/*
* Provide a function to get an URL GET parameter in javascript
*
@ -938,3 +961,99 @@ function getParameterByName(name, valueifnotfound)
results = regex.exec(location.search);
return results === null ? valueifnotfound : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Code in the public domain from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
(function() {
/**
* Decimal adjustment of a number.
*
* @param {String} type The type of adjustment.
* @param {Number} value The number.
* @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
* @returns {Number} The adjusted value.
*/
function decimalAdjust(type, value, exp) {
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
// If the value is not a number or the exp is not an integer...
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
return NaN;
}
// Shift
value = value.toString().split('e');
value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
// Shift back
value = value.toString().split('e');
return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
}
// Decimal round
if (!Math.round10) {
Math.round10 = function(value, exp) {
return decimalAdjust('round', value, exp);
};
}
// Decimal floor
if (!Math.floor10) {
Math.floor10 = function(value, exp) {
return decimalAdjust('floor', value, exp);
};
}
// Decimal ceil
if (!Math.ceil10) {
Math.ceil10 = function(value, exp) {
return decimalAdjust('ceil', value, exp);
};
}
})();
/**
* Function similar to PHP price2num()
*
* @param {number|string} amount The amount to convert/clean
* @returns {string} The amount in universal numeric format (Example: '99.99999')
* @todo Implement rounding parameter
*/
function price2numjs(amount) {
if (amount == '') return '';
<?php
$dec = ',';
$thousand = ' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") {
$dec = $langs->transnoentitiesnoconv("SeparatorDecimal");
}
if ($langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") {
$thousand = $langs->transnoentitiesnoconv("SeparatorThousand");
}
print "var dec='" . $dec . "'; var thousand='" . $thousand . "';\n"; // Set var in javascript
?>
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
var amount = amount.toString();
// rounding for unit price
var rounding = main_rounding_unit;
var pos = amount.indexOf(dec);
var decpart = '';
if (pos >= 0) decpart = amount.substr(pos + 1).replace('/0+$/i', ''); // Remove 0 for decimal part
var nbdec = decpart.length;
if (nbdec > rounding) rounding = nbdec;
// If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.');
amount = amount.replace(' ', ''); // To avoid spaces
amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount = amount.replace(dec, '.');
return Math.round10(amount, rounding);
}

View File

@ -35,9 +35,10 @@
* @param string $exportlink Link for export or ''
* @param array $moreparam Array with list of params to add into form
* @param string $calcmode Calculation mode
* @param string $varlink Add a variable into the address of the page
* @return void
*/
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='')
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
{
global $langs;
@ -45,14 +46,16 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
print "\n\n<!-- debut cartouche rapport -->\n";
if(! empty($varlink)) $varlink = '?'.$varlink;
$h=0;
$head[$h][0] = $_SERVER["PHP_SELF"];
$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
$head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report';
dol_fiche_head($head, 'report');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
foreach($moreparam as $key => $value)
{
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
@ -115,7 +118,8 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
print '</form>';
print '</div>';
dol_fiche_end();
print "\n<!-- fin cartouche rapport -->\n\n";
}

View File

@ -464,43 +464,6 @@ if (! empty($usemargins) && $user->rights->margins->creer)
return true;
}
/* Function similar to price2num in PHP */
function price2numjs(num)
{
if (num == '') return '';
<?php
$dec=','; $thousand=' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
print "var dec='".$dec."'; var thousand='".$thousand."';\n"; // Set var in javascript
?>
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
var amount = num.toString();
// rounding for unit price
var rounding = main_rounding_unit;
var pos = amount.indexOf(dec);
var decpart = '';
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale
var nbdec = decpart.length;
if (nbdec > rounding) rounding = nbdec;
// If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount=amount.replace(',','.');
amount=amount.replace(' ',''); // To avoid spaces
amount=amount.replace(thousand,''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount=amount.replace(dec,'.');
return parseFloat(amount).toFixed(rounding);
}
<?php
}
?>
@ -594,7 +557,7 @@ jQuery(document).ready(function() {
/* Define default price at loading */
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
$("#buying_price").val(Math.round(defaultprice,<?php print ($conf->global->MAIN_MAX_DECIMALS_UNIT ? $conf->global->MAIN_MAX_DECIMALS_UNIT : 5); ?>));
$("#buying_price").val(defaultprice);
$("#fournprice_predef").change(function() {
console.log("change on fournprice_predef");

View File

@ -375,42 +375,6 @@ if (! empty($conf->margin->enabled))
return true;
}
/* Function similar to price2num in PHP */
function price2numjs(num)
{
if (num == '') return '';
<?php
$dec=','; $thousand=' ';
if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") $dec=$langs->transnoentitiesnoconv("SeparatorDecimal");
if ($langs->transnoentitiesnoconv("SeparatorThousand")!= "SeparatorThousand") $thousand=$langs->transnoentitiesnoconv("SeparatorThousand");
print "var dec='".$dec."'; var thousand='".$thousand."';\n"; // Set var in javascript
?>
var main_max_dec_shown = <?php echo $conf->global->MAIN_MAX_DECIMALS_SHOWN; ?>;
var main_rounding_unit = <?php echo $conf->global->MAIN_MAX_DECIMALS_UNIT; ?>;
var main_rounding_tot = <?php echo $conf->global->MAIN_MAX_DECIMALS_TOT; ?>;
var amount = num.toString();
// rounding for unit price
var rounding = main_rounding_unit;
var pos = amount.indexOf(dec);
var decpart = '';
if (pos >= 0) decpart = amount.substr(pos+1).replace('/0+$/i',''); // Remove 0 for decimal part
var nbdec = decpart.length;
if (nbdec > rounding) rounding = nbdec;
// If rounding higher than max shown
if (rounding > main_max_dec_shown) rounding = main_max_dec_shown;
if (thousand != ',' && thousand != '.') amount=amount.replace(',','.');
amount=amount.replace(' ',''); // To avoid spaces
amount=amount.replace(thousand,''); // Replace of thousand before replace of dec to avoid pb if thousand is .
amount=amount.replace(dec,'.');
return parseFloat(amount).toFixed(rounding);
}
<?php
}
?>

View File

@ -55,6 +55,5 @@ dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';
$db->close();
llxFooter();
llxFooter();
$db->close();

View File

@ -57,6 +57,5 @@ if ($id)
print '</div>';
}
$db->close();
llxFooter();
$db->close();

View File

@ -236,7 +236,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -308,7 +308,5 @@ if (GETPOST("action") == 'create')
print "</form>\n";
}
$db->close();
llxFooter();
$db->close();

View File

@ -285,6 +285,5 @@ if ($_GET["action"] != 'edit')
// End of page
$db->close();
llxFooter();
$db->close();

View File

@ -364,6 +364,5 @@ if ($user->rights->ecm->read)
*/
// End of page
$db->close();
llxFooter();
$db->close();

View File

@ -167,6 +167,5 @@ if ($mesg) { print $mesg."<br>"; }
print $langs->trans("FeatureNotYetAvailable");
// End of page
$db->close();
llxFooter();
$db->close();

View File

@ -237,6 +237,5 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -1198,9 +1198,8 @@ else
print $langs->trans('NotUserRightToView');
print '</div>';
$db->close();
llxFooter();
$db->close();
exit;
}

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