@@ -369,12 +369,12 @@ discard block |
||
| 369 | 369 | if ($links[$key]['type'] == 'payment') { |
| 370 | 370 | $paymentstatic->id = $links[$key]['url_id']; |
| 371 | 371 | $paymentstatic->ref = $links[$key]['url_id']; |
| 372 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this |
|
| 372 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this |
|
| 373 | 373 | $tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id; |
| 374 | 374 | } elseif ($links[$key]['type'] == 'payment_supplier') { |
| 375 | 375 | $paymentsupplierstatic->id = $links[$key]['url_id']; |
| 376 | 376 | $paymentsupplierstatic->ref = $links[$key]['url_id']; |
| 377 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsupplierstatic->getNomUrl(2); |
|
| 377 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); |
|
| 378 | 378 | $tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id; |
| 379 | 379 | } elseif ($links[$key]['type'] == 'company') { |
| 380 | 380 | $societestatic->id = $links[$key]['url_id']; |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | $chargestatic->id = $links[$key]['url_id']; |
| 410 | 410 | $chargestatic->ref = $links[$key]['url_id']; |
| 411 | 411 | |
| 412 | - $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); |
|
| 412 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); |
|
| 413 | 413 | $reg = array(); |
| 414 | 414 | if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { |
| 415 | 415 | if ($reg[1] == 'socialcontribution') { |
@@ -426,13 +426,13 @@ discard block |
||
| 426 | 426 | // Retrieve the accounting code of the social contribution of the payment from link of payment. |
| 427 | 427 | // Note: We have the social contribution id, it can be faster to get accounting code from social contribution id. |
| 428 | 428 | $sqlmid = "SELECT cchgsoc.accountancy_code"; |
| 429 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc"; |
|
| 430 | - $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type = cchgsoc.id"; |
|
| 431 | - $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge = chgsoc.rowid"; |
|
| 432 | - $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid AND bkurl.type = 'payment_sc'"; |
|
| 433 | - $sqlmid .= " WHERE bkurl.fk_bank = ".((int) $obj->rowid); |
|
| 429 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc"; |
|
| 430 | + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type = cchgsoc.id"; |
|
| 431 | + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge = chgsoc.rowid"; |
|
| 432 | + $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid AND bkurl.type = 'payment_sc'"; |
|
| 433 | + $sqlmid .= " WHERE bkurl.fk_bank = " . ((int) $obj->rowid); |
|
| 434 | 434 | |
| 435 | - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG); |
|
| 435 | + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); |
|
| 436 | 436 | $resultmid = $db->query($sqlmid); |
| 437 | 437 | if ($resultmid) { |
| 438 | 438 | $objmid = $db->fetch_object($resultmid); |
@@ -442,14 +442,14 @@ discard block |
||
| 442 | 442 | $paymentdonstatic->id = $links[$key]['url_id']; |
| 443 | 443 | $paymentdonstatic->ref = $links[$key]['url_id']; |
| 444 | 444 | $paymentdonstatic->fk_donation = $links[$key]['url_id']; |
| 445 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2); |
|
| 445 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2); |
|
| 446 | 446 | $tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id; |
| 447 | 447 | $tabtp[$obj->rowid][$account_pay_donation] += $amounttouse; |
| 448 | 448 | } elseif ($links[$key]['type'] == 'member') { |
| 449 | 449 | $paymentsubscriptionstatic->id = $links[$key]['url_id']; |
| 450 | 450 | $paymentsubscriptionstatic->ref = $links[$key]['url_id']; |
| 451 | 451 | $paymentsubscriptionstatic->label = $links[$key]['label']; |
| 452 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2); |
|
| 452 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsubscriptionstatic->getNomUrl(2); |
|
| 453 | 453 | $tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id; |
| 454 | 454 | $paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id); |
| 455 | 455 | $tabtp[$obj->rowid][$account_pay_subscription] += $amounttouse; |
@@ -457,14 +457,14 @@ discard block |
||
| 457 | 457 | $paymentvatstatic->id = $links[$key]['url_id']; |
| 458 | 458 | $paymentvatstatic->ref = $links[$key]['url_id']; |
| 459 | 459 | $paymentvatstatic->label = $links[$key]['label']; |
| 460 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2); |
|
| 460 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); |
|
| 461 | 461 | $tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id; |
| 462 | 462 | $tabtp[$obj->rowid][$account_pay_vat] += $amounttouse; |
| 463 | 463 | } elseif ($links[$key]['type'] == 'payment_salary') { |
| 464 | 464 | $paymentsalstatic->id = $links[$key]['url_id']; |
| 465 | 465 | $paymentsalstatic->ref = $links[$key]['url_id']; |
| 466 | 466 | $paymentsalstatic->label = $links[$key]['label']; |
| 467 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2); |
|
| 467 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); |
|
| 468 | 468 | $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; |
| 469 | 469 | |
| 470 | 470 | // This part of code is no more required. it is here to solve case where a link were missing (with v14.0.0) and keep writing in accountancy complete. |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $paymentvariousstatic->id = $links[$key]['url_id']; |
| 513 | 513 | $paymentvariousstatic->ref = $links[$key]['url_id']; |
| 514 | 514 | $paymentvariousstatic->label = $links[$key]['label']; |
| 515 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvariousstatic->getNomUrl(2); |
|
| 515 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2); |
|
| 516 | 516 | $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; |
| 517 | 517 | $paymentvariousstatic->fetch($paymentvariousstatic->id); |
| 518 | 518 | $account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word |
@@ -523,14 +523,14 @@ discard block |
||
| 523 | 523 | $paymentloanstatic->id = $links[$key]['url_id']; |
| 524 | 524 | $paymentloanstatic->ref = $links[$key]['url_id']; |
| 525 | 525 | $paymentloanstatic->fk_loan = $links[$key]['url_id']; |
| 526 | - $tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2); |
|
| 526 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentloanstatic->getNomUrl(2); |
|
| 527 | 527 | $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; |
| 528 | 528 | //$tabtp[$obj->rowid][$account_pay_loan] += $amounttouse; |
| 529 | 529 | $sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest'; |
| 530 | - $sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l'; |
|
| 531 | - $sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid); |
|
| 530 | + $sqlmid .= ' FROM ' . MAIN_DB_PREFIX . 'payment_loan as pl, ' . MAIN_DB_PREFIX . 'loan as l'; |
|
| 531 | + $sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = ' . ((int) $obj->rowid); |
|
| 532 | 532 | |
| 533 | - dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG); |
|
| 533 | + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); |
|
| 534 | 534 | $resultmid = $db->query($sqlmid); |
| 535 | 535 | if ($resultmid) { |
| 536 | 536 | $objmid = $db->fetch_object($resultmid); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | } |
| 541 | 541 | } elseif ($links[$key]['type'] == 'banktransfert') { |
| 542 | 542 | $accountLinestatic->fetch($links[$key]['url_id']); |
| 543 | - $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1); |
|
| 543 | + $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer") . '- ' . $accountLinestatic ->getNomUrl(1); |
|
| 544 | 544 | $tabtp[$obj->rowid][$account_transfer] += $amounttouse; |
| 545 | 545 | $bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']); |
| 546 | 546 | $tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2); |
@@ -653,16 +653,16 @@ discard block |
||
| 653 | 653 | // Line into bank account |
| 654 | 654 | foreach ($tabbq[$key] as $k => $mt) { |
| 655 | 655 | if ($mt) { |
| 656 | - $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch |
|
| 656 | + $accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch |
|
| 657 | 657 | $account_label = $accountingaccount->label; |
| 658 | 658 | |
| 659 | 659 | $reflabel = ''; |
| 660 | 660 | if (!empty($val['lib'])) { |
| 661 | - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; |
|
| 661 | + $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; |
|
| 662 | 662 | } |
| 663 | - $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); |
|
| 663 | + $reflabel .= $langs->trans("Bank") . ' ' . dol_string_nohtmltag($val['bank_account_ref']); |
|
| 664 | 664 | if (!empty($val['soclib'])) { |
| 665 | - $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); |
|
| 665 | + $reflabel .= " - " . dol_string_nohtmltag($val['soclib']); |
|
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | $bookkeeping = new BookKeeping($db); |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists |
| 699 | 699 | $error++; |
| 700 | 700 | $errorforline++; |
| 701 | - setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
|
| 701 | + setEventMessages('Transaction for (' . $bookkeeping->doc_type . ', ' . $bookkeeping->fk_doc . ', ' . $bookkeeping->fk_docdet . ') were already recorded', null, 'warnings'); |
|
| 702 | 702 | } else { |
| 703 | 703 | $error++; |
| 704 | 704 | $errorforline++; |
@@ -719,10 +719,10 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | $reflabel = ''; |
| 721 | 721 | if (!empty($val['lib'])) { |
| 722 | - $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); |
|
| 722 | + $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib'] ? " - " : ""); |
|
| 723 | 723 | } |
| 724 | 724 | if ($tabtype[$key] == 'banktransfert') { |
| 725 | - $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); |
|
| 725 | + $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount') . ' ' . $account_transfer); |
|
| 726 | 726 | } else { |
| 727 | 727 | $reflabel .= dol_string_nohtmltag($val['soclib']); |
| 728 | 728 | } |
@@ -769,43 +769,43 @@ discard block |
||
| 769 | 769 | } elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution |
| 770 | 770 | $bookkeeping->subledger_account = ''; |
| 771 | 771 | $bookkeeping->subledger_label = ''; |
| 772 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 772 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 773 | 773 | $bookkeeping->numero_compte = $k; |
| 774 | 774 | $bookkeeping->label_compte = $accountingaccount->label; |
| 775 | 775 | } elseif ($tabtype[$key] == 'payment_vat') { |
| 776 | 776 | $bookkeeping->subledger_account = ''; |
| 777 | 777 | $bookkeeping->subledger_label = ''; |
| 778 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 778 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 779 | 779 | $bookkeeping->numero_compte = $k; |
| 780 | 780 | $bookkeeping->label_compte = $accountingaccount->label; |
| 781 | 781 | } elseif ($tabtype[$key] == 'payment_donation') { |
| 782 | 782 | $bookkeeping->subledger_account = ''; |
| 783 | 783 | $bookkeeping->subledger_label = ''; |
| 784 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 784 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 785 | 785 | $bookkeeping->numero_compte = $k; |
| 786 | 786 | $bookkeeping->label_compte = $accountingaccount->label; |
| 787 | 787 | } elseif ($tabtype[$key] == 'member') { |
| 788 | 788 | $bookkeeping->subledger_account = ''; |
| 789 | 789 | $bookkeeping->subledger_label = ''; |
| 790 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 790 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 791 | 791 | $bookkeeping->numero_compte = $k; |
| 792 | 792 | $bookkeeping->label_compte = $accountingaccount->label; |
| 793 | 793 | } elseif ($tabtype[$key] == 'payment_loan') { |
| 794 | 794 | $bookkeeping->subledger_account = ''; |
| 795 | 795 | $bookkeeping->subledger_label = ''; |
| 796 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 796 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 797 | 797 | $bookkeeping->numero_compte = $k; |
| 798 | 798 | $bookkeeping->label_compte = $accountingaccount->label; |
| 799 | 799 | } elseif ($tabtype[$key] == 'payment_various') { |
| 800 | 800 | $bookkeeping->subledger_account = $k; |
| 801 | 801 | $bookkeeping->subledger_label = $tabcompany[$key]['name']; |
| 802 | - $accountingaccount->fetch(null, $tabpay[$key]["account_various"], true); // TODO Use a cache |
|
| 802 | + $accountingaccount->fetch(null, $tabpay[$key]["account_various"], true); // TODO Use a cache |
|
| 803 | 803 | $bookkeeping->numero_compte = $tabpay[$key]["account_various"]; |
| 804 | 804 | $bookkeeping->label_compte = $accountingaccount->label; |
| 805 | 805 | } elseif ($tabtype[$key] == 'banktransfert') { |
| 806 | 806 | $bookkeeping->subledger_account = ''; |
| 807 | 807 | $bookkeeping->subledger_label = ''; |
| 808 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 808 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache |
|
| 809 | 809 | $bookkeeping->numero_compte = $k; |
| 810 | 810 | $bookkeeping->label_compte = $accountingaccount->label; |
| 811 | 811 | } else { |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists |
| 829 | 829 | $error++; |
| 830 | 830 | $errorforline++; |
| 831 | - setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
|
| 831 | + setEventMessages('Transaction for (' . $bookkeeping->doc_type . ', ' . $bookkeeping->fk_doc . ', ' . $bookkeeping->fk_docdet . ') were already recorded', null, 'warnings'); |
|
| 832 | 832 | } else { |
| 833 | 833 | $error++; |
| 834 | 834 | $errorforline++; |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | if ($mt) { |
| 849 | 849 | $reflabel = ''; |
| 850 | 850 | if (!empty($val['lib'])) { |
| 851 | - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; |
|
| 851 | + $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; |
|
| 852 | 852 | } |
| 853 | 853 | $reflabel .= dol_string_nohtmltag('WaitingAccount'); |
| 854 | 854 | |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists |
| 880 | 880 | $error++; |
| 881 | 881 | $errorforline++; |
| 882 | - setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); |
|
| 882 | + setEventMessages('Transaction for (' . $bookkeeping->doc_type . ', ' . $bookkeeping->fk_doc . ', ' . $bookkeeping->fk_docdet . ') were already recorded', null, 'warnings'); |
|
| 883 | 883 | } else { |
| 884 | 884 | $error++; |
| 885 | 885 | $errorforline++; |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) { |
| 895 | 895 | $error++; |
| 896 | 896 | $errorforline++; |
| 897 | - setEventMessages('We tried to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors'); |
|
| 897 | + setEventMessages('We tried to insert a non balanced transaction in book for ' . $ref . '. Canceled. Surely a bug.', null, 'errors'); |
|
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | if (!$errorforline) { |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | |
| 906 | 906 | $MAXNBERRORS = 5; |
| 907 | 907 | if ($error >= $MAXNBERRORS) { |
| 908 | - setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors'); |
|
| 908 | + setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped") . ' (>' . $MAXNBERRORS . ')', null, 'errors'); |
|
| 909 | 909 | break; // Break in the foreach |
| 910 | 910 | } |
| 911 | 911 | } |
@@ -923,15 +923,15 @@ discard block |
||
| 923 | 923 | |
| 924 | 924 | // Must reload data, so we make a redirect |
| 925 | 925 | if (count($tabpay) != $error) { |
| 926 | - $param = 'id_journal='.$id_journal; |
|
| 927 | - $param .= '&date_startday='.$date_startday; |
|
| 928 | - $param .= '&date_startmonth='.$date_startmonth; |
|
| 929 | - $param .= '&date_startyear='.$date_startyear; |
|
| 930 | - $param .= '&date_endday='.$date_endday; |
|
| 931 | - $param .= '&date_endmonth='.$date_endmonth; |
|
| 932 | - $param .= '&date_endyear='.$date_endyear; |
|
| 933 | - $param .= '&in_bookkeeping='.$in_bookkeeping; |
|
| 934 | - header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : '')); |
|
| 926 | + $param = 'id_journal=' . $id_journal; |
|
| 927 | + $param .= '&date_startday=' . $date_startday; |
|
| 928 | + $param .= '&date_startmonth=' . $date_startmonth; |
|
| 929 | + $param .= '&date_startyear=' . $date_startyear; |
|
| 930 | + $param .= '&date_endday=' . $date_endday; |
|
| 931 | + $param .= '&date_endmonth=' . $date_endmonth; |
|
| 932 | + $param .= '&date_endyear=' . $date_endyear; |
|
| 933 | + $param .= '&in_bookkeeping=' . $in_bookkeeping; |
|
| 934 | + header("Location: " . $_SERVER['PHP_SELF'] . ($param ? '?' . $param : '')); |
|
| 935 | 935 | exit; |
| 936 | 936 | } |
| 937 | 937 | } |
@@ -944,20 +944,20 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | $filename = 'journal'; |
| 946 | 946 | $type_export = 'journal'; |
| 947 | - include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; |
|
| 947 | + include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; |
|
| 948 | 948 | |
| 949 | 949 | // CSV header line |
| 950 | - print '"'.$langs->transnoentitiesnoconv("BankId").'"'.$sep; |
|
| 951 | - print '"'.$langs->transnoentitiesnoconv("Date").'"'.$sep; |
|
| 952 | - print '"'.$langs->transnoentitiesnoconv("PaymentMode").'"'.$sep; |
|
| 953 | - print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep; |
|
| 954 | - print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep; |
|
| 955 | - print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep; |
|
| 956 | - print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep; |
|
| 957 | - print '"'.$langs->transnoentitiesnoconv("AccountingDebit").'"'.$sep; |
|
| 958 | - print '"'.$langs->transnoentitiesnoconv("AccountingCredit").'"'.$sep; |
|
| 959 | - print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep; |
|
| 960 | - print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep; |
|
| 950 | + print '"' . $langs->transnoentitiesnoconv("BankId") . '"' . $sep; |
|
| 951 | + print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep; |
|
| 952 | + print '"' . $langs->transnoentitiesnoconv("PaymentMode") . '"' . $sep; |
|
| 953 | + print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep; |
|
| 954 | + print '"' . $langs->transnoentitiesnoconv("LedgerAccount") . '"' . $sep; |
|
| 955 | + print '"' . $langs->transnoentitiesnoconv("SubledgerAccount") . '"' . $sep; |
|
| 956 | + print '"' . $langs->transnoentitiesnoconv("Label") . '"' . $sep; |
|
| 957 | + print '"' . $langs->transnoentitiesnoconv("AccountingDebit") . '"' . $sep; |
|
| 958 | + print '"' . $langs->transnoentitiesnoconv("AccountingCredit") . '"' . $sep; |
|
| 959 | + print '"' . $langs->transnoentitiesnoconv("Journal") . '"' . $sep; |
|
| 960 | + print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep; |
|
| 961 | 961 | print "\n"; |
| 962 | 962 | |
| 963 | 963 | foreach ($tabpay as $key => $val) { |
@@ -970,24 +970,24 @@ discard block |
||
| 970 | 970 | if ($mt) { |
| 971 | 971 | $reflabel = ''; |
| 972 | 972 | if (!empty($val['lib'])) { |
| 973 | - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; |
|
| 973 | + $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; |
|
| 974 | 974 | } |
| 975 | - $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); |
|
| 975 | + $reflabel .= $langs->trans("Bank") . ' ' . dol_string_nohtmltag($val['bank_account_ref']); |
|
| 976 | 976 | if (!empty($val['soclib'])) { |
| 977 | - $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); |
|
| 977 | + $reflabel .= " - " . dol_string_nohtmltag($val['soclib']); |
|
| 978 | 978 | } |
| 979 | 979 | |
| 980 | - print '"'.$key.'"'.$sep; |
|
| 981 | - print '"'.$date.'"'.$sep; |
|
| 982 | - print '"'.$val["type_payment"].'"'.$sep; |
|
| 983 | - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; |
|
| 984 | - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; |
|
| 985 | - print " ".$sep; |
|
| 986 | - print '"'.$reflabel.'"'.$sep; |
|
| 987 | - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; |
|
| 988 | - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; |
|
| 989 | - print '"'.$journal.'"'.$sep; |
|
| 990 | - print '"'.dol_string_nohtmltag($ref).'"'.$sep; |
|
| 980 | + print '"' . $key . '"' . $sep; |
|
| 981 | + print '"' . $date . '"' . $sep; |
|
| 982 | + print '"' . $val["type_payment"] . '"' . $sep; |
|
| 983 | + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; |
|
| 984 | + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; |
|
| 985 | + print " " . $sep; |
|
| 986 | + print '"' . $reflabel . '"' . $sep; |
|
| 987 | + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; |
|
| 988 | + print '"' . ($mt < 0 ? price(-$mt) : '') . '"' . $sep; |
|
| 989 | + print '"' . $journal . '"' . $sep; |
|
| 990 | + print '"' . dol_string_nohtmltag($ref) . '"' . $sep; |
|
| 991 | 991 | print "\n"; |
| 992 | 992 | } |
| 993 | 993 | } |
@@ -998,35 +998,35 @@ discard block |
||
| 998 | 998 | if ($mt) { |
| 999 | 999 | $reflabel = ''; |
| 1000 | 1000 | if (!empty($val['lib'])) { |
| 1001 | - $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); |
|
| 1001 | + $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib'] ? " - " : ""); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | if ($tabtype[$key] == 'banktransfert') { |
| 1004 | - $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); |
|
| 1004 | + $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount') . ' ' . $account_transfer); |
|
| 1005 | 1005 | } else { |
| 1006 | 1006 | $reflabel .= dol_string_nohtmltag($val['soclib']); |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - print '"'.$key.'"'.$sep; |
|
| 1010 | - print '"'.$date.'"'.$sep; |
|
| 1011 | - print '"'.$val["type_payment"].'"'.$sep; |
|
| 1012 | - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; |
|
| 1009 | + print '"' . $key . '"' . $sep; |
|
| 1010 | + print '"' . $date . '"' . $sep; |
|
| 1011 | + print '"' . $val["type_payment"] . '"' . $sep; |
|
| 1012 | + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; |
|
| 1013 | 1013 | if ($tabtype[$key] == 'payment_supplier') { |
| 1014 | - print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER').'"'.$sep; |
|
| 1014 | + print '"' . getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') . '"' . $sep; |
|
| 1015 | 1015 | } elseif ($tabtype[$key] == 'payment') { |
| 1016 | - print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep; |
|
| 1016 | + print '"' . getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') . '"' . $sep; |
|
| 1017 | 1017 | } elseif ($tabtype[$key] == 'payment_expensereport') { |
| 1018 | - print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; |
|
| 1018 | + print '"' . getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') . '"' . $sep; |
|
| 1019 | 1019 | } elseif ($tabtype[$key] == 'payment_salary') { |
| 1020 | - print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; |
|
| 1020 | + print '"' . getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') . '"' . $sep; |
|
| 1021 | 1021 | } else { |
| 1022 | - print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; |
|
| 1022 | + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; |
|
| 1023 | 1023 | } |
| 1024 | - print '"'.length_accounta(html_entity_decode($k)).'"'.$sep; |
|
| 1025 | - print '"'.$reflabel.'"'.$sep; |
|
| 1026 | - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; |
|
| 1027 | - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; |
|
| 1028 | - print '"'.$journal.'"'.$sep; |
|
| 1029 | - print '"'.dol_string_nohtmltag($ref).'"'.$sep; |
|
| 1024 | + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; |
|
| 1025 | + print '"' . $reflabel . '"' . $sep; |
|
| 1026 | + print '"' . ($mt < 0 ? price(-$mt) : '') . '"' . $sep; |
|
| 1027 | + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; |
|
| 1028 | + print '"' . $journal . '"' . $sep; |
|
| 1029 | + print '"' . dol_string_nohtmltag($ref) . '"' . $sep; |
|
| 1030 | 1030 | print "\n"; |
| 1031 | 1031 | } |
| 1032 | 1032 | } |
@@ -1035,21 +1035,21 @@ discard block |
||
| 1035 | 1035 | if ($mt) { |
| 1036 | 1036 | $reflabel = ''; |
| 1037 | 1037 | if (!empty($val['lib'])) { |
| 1038 | - $reflabel .= dol_string_nohtmltag($val['lib'])." - "; |
|
| 1038 | + $reflabel .= dol_string_nohtmltag($val['lib']) . " - "; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | $reflabel .= dol_string_nohtmltag('WaitingAccount'); |
| 1041 | 1041 | |
| 1042 | - print '"'.$key.'"'.$sep; |
|
| 1043 | - print '"'.$date.'"'.$sep; |
|
| 1044 | - print '"'.$val["type_payment"].'"'.$sep; |
|
| 1045 | - print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep; |
|
| 1046 | - print '"'.length_accounta(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep; |
|
| 1042 | + print '"' . $key . '"' . $sep; |
|
| 1043 | + print '"' . $date . '"' . $sep; |
|
| 1044 | + print '"' . $val["type_payment"] . '"' . $sep; |
|
| 1045 | + print '"' . length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')) . '"' . $sep; |
|
| 1046 | + print '"' . length_accounta(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')) . '"' . $sep; |
|
| 1047 | 1047 | print $sep; |
| 1048 | - print '"'.$reflabel.'"'.$sep; |
|
| 1049 | - print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; |
|
| 1050 | - print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep; |
|
| 1051 | - print '"'.$journal.'"'.$sep; |
|
| 1052 | - print '"'.dol_string_nohtmltag($ref).'"'.$sep; |
|
| 1048 | + print '"' . $reflabel . '"' . $sep; |
|
| 1049 | + print '"' . ($mt < 0 ? price(-$mt) : '') . '"' . $sep; |
|
| 1050 | + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; |
|
| 1051 | + print '"' . $journal . '"' . $sep; |
|
| 1052 | + print '"' . dol_string_nohtmltag($ref) . '"' . $sep; |
|
| 1053 | 1053 | print "\n"; |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
@@ -1074,23 +1074,23 @@ discard block |
||
| 1074 | 1074 | $salarystatic = new Salary($db); |
| 1075 | 1075 | $variousstatic = new PaymentVarious($db); |
| 1076 | 1076 | |
| 1077 | - $title = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); |
|
| 1077 | + $title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $accountingjournalstatic->getNomUrl(0, 2, 1, '', 1); |
|
| 1078 | 1078 | |
| 1079 | 1079 | llxHeader('', dol_string_nohtmltag($title)); |
| 1080 | 1080 | |
| 1081 | 1081 | $nom = $title; |
| 1082 | 1082 | $builddate = dol_now(); |
| 1083 | 1083 | //$description = $langs->trans("DescFinanceJournal") . '<br>'; |
| 1084 | - $description = $langs->trans("DescJournalOnlyBindedVisible").'<br>'; |
|
| 1084 | + $description = $langs->trans("DescJournalOnlyBindedVisible") . '<br>'; |
|
| 1085 | 1085 | |
| 1086 | 1086 | $listofchoices = array( |
| 1087 | 1087 | 'notyet' => $langs->trans("NotYetInGeneralLedger"), |
| 1088 | 1088 | 'already' => $langs->trans("AlreadyInGeneralLedger") |
| 1089 | 1089 | ); |
| 1090 | - $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); |
|
| 1091 | - $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
| 1090 | + $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); |
|
| 1091 | + $period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
| 1092 | 1092 | |
| 1093 | - $varlink = 'id_journal='.$id_journal; |
|
| 1093 | + $varlink = 'id_journal=' . $id_journal; |
|
| 1094 | 1094 | $periodlink = ''; |
| 1095 | 1095 | $exportlink = ''; |
| 1096 | 1096 | |
@@ -1101,14 +1101,14 @@ discard block |
||
| 1101 | 1101 | if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { |
| 1102 | 1102 | // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) |
| 1103 | 1103 | // Fiscal period test |
| 1104 | - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); |
|
| 1104 | + $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear WHERE entity = " . ((int) $conf->entity); |
|
| 1105 | 1105 | $resql = $db->query($sql); |
| 1106 | 1106 | if ($resql) { |
| 1107 | 1107 | $obj = $db->fetch_object($resql); |
| 1108 | 1108 | if ($obj->nb == 0) { |
| 1109 | - print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); |
|
| 1110 | - $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); |
|
| 1111 | - $desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'</strong>', $desc); |
|
| 1109 | + print '<br><div class="warning">' . img_warning() . ' ' . $langs->trans("TheFiscalPeriodIsNotDefined"); |
|
| 1110 | + $desc = ' : ' . $langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); |
|
| 1111 | + $desc = str_replace('{link}', '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("FiscalPeriod") . '</strong>', $desc); |
|
| 1112 | 1112 | print $desc; |
| 1113 | 1113 | print '</div>'; |
| 1114 | 1114 | } |
@@ -1118,14 +1118,14 @@ discard block |
||
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | 1120 | // Bank test |
| 1121 | - $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0"; |
|
| 1121 | + $sql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "bank_account WHERE entity = " . ((int) $conf->entity) . " AND fk_accountancy_journal IS NULL AND clos=0"; |
|
| 1122 | 1122 | $resql = $db->query($sql); |
| 1123 | 1123 | if ($resql) { |
| 1124 | 1124 | $obj = $db->fetch_object($resql); |
| 1125 | 1125 | if ($obj->nb > 0) { |
| 1126 | - print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); |
|
| 1127 | - $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 6, '{link}'); |
|
| 1128 | - $desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>', $desc); |
|
| 1126 | + print '<br><div class="warning">' . img_warning() . ' ' . $langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); |
|
| 1127 | + $desc = ' : ' . $langs->trans("AccountancyAreaDescBank", 6, '{link}'); |
|
| 1128 | + $desc = str_replace('{link}', '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("BankAccounts") . '</strong>', $desc); |
|
| 1129 | 1129 | print $desc; |
| 1130 | 1130 | print '</div>'; |
| 1131 | 1131 | } |
@@ -1138,9 +1138,9 @@ discard block |
||
| 1138 | 1138 | if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' |
| 1139 | 1139 | || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' |
| 1140 | 1140 | || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { |
| 1141 | - print($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); |
|
| 1142 | - $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); |
|
| 1143 | - $desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc); |
|
| 1141 | + print($desc ? '' : '<br>') . '<div class="warning">' . img_warning() . ' ' . $langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); |
|
| 1142 | + $desc = ' : ' . $langs->trans("AccountancyAreaDescMisc", 4, '{link}'); |
|
| 1143 | + $desc = str_replace('{link}', '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>', $desc); |
|
| 1144 | 1144 | print $desc; |
| 1145 | 1145 | print '</div>'; |
| 1146 | 1146 | } |
@@ -1149,17 +1149,17 @@ discard block |
||
| 1149 | 1149 | print '<br><div class="tabsAction tabsActionNoBottom centerimp">'; |
| 1150 | 1150 | |
| 1151 | 1151 | if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') { |
| 1152 | - print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; |
|
| 1152 | + print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />'; |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' |
| 1156 | 1156 | || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1') { |
| 1157 | - print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; |
|
| 1157 | + print '<input type="button" class="butActionRefused classfortooltip" title="' . dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")) . '" value="' . $langs->trans("WriteBookKeeping") . '" />'; |
|
| 1158 | 1158 | } else { |
| 1159 | 1159 | if ($in_bookkeeping == 'notyet') { |
| 1160 | - print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; |
|
| 1160 | + print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; |
|
| 1161 | 1161 | } else { |
| 1162 | - print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; |
|
| 1162 | + print '<a class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>'; |
|
| 1163 | 1163 | } |
| 1164 | 1164 | } |
| 1165 | 1165 | |
@@ -1191,14 +1191,14 @@ discard block |
||
| 1191 | 1191 | print '<div class="div-table-responsive">'; |
| 1192 | 1192 | print '<table class="noborder centpercent">'; |
| 1193 | 1193 | print '<tr class="liste_titre">'; |
| 1194 | - print "<td>".$langs->trans("Date")."</td>"; |
|
| 1195 | - print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").")</td>"; |
|
| 1196 | - print "<td>".$langs->trans("AccountAccounting")."</td>"; |
|
| 1197 | - print "<td>".$langs->trans("SubledgerAccount")."</td>"; |
|
| 1198 | - print "<td>".$langs->trans("LabelOperation")."</td>"; |
|
| 1199 | - print '<td class="center">'.$langs->trans("PaymentMode")."</td>"; |
|
| 1200 | - print '<td class="right">'.$langs->trans("AccountingDebit")."</td>"; |
|
| 1201 | - print '<td class="right">'.$langs->trans("AccountingCredit")."</td>"; |
|
| 1194 | + print "<td>" . $langs->trans("Date") . "</td>"; |
|
| 1195 | + print "<td>" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ")</td>"; |
|
| 1196 | + print "<td>" . $langs->trans("AccountAccounting") . "</td>"; |
|
| 1197 | + print "<td>" . $langs->trans("SubledgerAccount") . "</td>"; |
|
| 1198 | + print "<td>" . $langs->trans("LabelOperation") . "</td>"; |
|
| 1199 | + print '<td class="center">' . $langs->trans("PaymentMode") . "</td>"; |
|
| 1200 | + print '<td class="right">' . $langs->trans("AccountingDebit") . "</td>"; |
|
| 1201 | + print '<td class="right">' . $langs->trans("AccountingCredit") . "</td>"; |
|
| 1202 | 1202 | print "</tr>\n"; |
| 1203 | 1203 | |
| 1204 | 1204 | $r = ''; |
@@ -1213,29 +1213,29 @@ discard block |
||
| 1213 | 1213 | if ($mt) { |
| 1214 | 1214 | $reflabel = ''; |
| 1215 | 1215 | if (!empty($val['lib'])) { |
| 1216 | - $reflabel .= $val['lib']." - "; |
|
| 1216 | + $reflabel .= $val['lib'] . " - "; |
|
| 1217 | 1217 | } |
| 1218 | - $reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref']; |
|
| 1218 | + $reflabel .= $langs->trans("Bank") . ' ' . $val['bank_account_ref']; |
|
| 1219 | 1219 | if (!empty($val['soclib'])) { |
| 1220 | - $reflabel .= " - ".$val['soclib']; |
|
| 1220 | + $reflabel .= " - " . $val['soclib']; |
|
| 1221 | 1221 | } |
| 1222 | 1222 | |
| 1223 | 1223 | //var_dump($tabpay[$key]); |
| 1224 | - print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->'; |
|
| 1224 | + print '<!-- Bank bank.rowid=' . $key . ' type=' . $tabpay[$key]['type'] . ' ref=' . $tabpay[$key]['ref'] . '-->'; |
|
| 1225 | 1225 | print '<tr class="oddeven">'; |
| 1226 | 1226 | |
| 1227 | 1227 | // Date |
| 1228 | - print "<td>".$date."</td>"; |
|
| 1228 | + print "<td>" . $date . "</td>"; |
|
| 1229 | 1229 | |
| 1230 | 1230 | // Ref |
| 1231 | - print "<td>".dol_escape_htmltag($ref)."</td>"; |
|
| 1231 | + print "<td>" . dol_escape_htmltag($ref) . "</td>"; |
|
| 1232 | 1232 | |
| 1233 | 1233 | // Ledger account |
| 1234 | 1234 | $accounttoshow = length_accountg($k); |
| 1235 | 1235 | if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { |
| 1236 | - $accounttoshow = '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>'; |
|
| 1236 | + $accounttoshow = '<span class="error">' . $langs->trans("BankAccountNotDefined") . '</span>'; |
|
| 1237 | 1237 | } |
| 1238 | - print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">'; |
|
| 1238 | + print '<td class="maxwidth300" title="' . dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)) . '">'; |
|
| 1239 | 1239 | print $accounttoshow; |
| 1240 | 1240 | print "</td>"; |
| 1241 | 1241 | |
@@ -1251,12 +1251,12 @@ discard block |
||
| 1251 | 1251 | |
| 1252 | 1252 | // Label operation |
| 1253 | 1253 | print '<td>'; |
| 1254 | - print $reflabel; // This is already html escaped content |
|
| 1254 | + print $reflabel; // This is already html escaped content |
|
| 1255 | 1255 | print "</td>"; |
| 1256 | 1256 | |
| 1257 | - print '<td class="center">'.$val["type_payment"]."</td>"; |
|
| 1258 | - print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; |
|
| 1259 | - print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; |
|
| 1257 | + print '<td class="center">' . $val["type_payment"] . "</td>"; |
|
| 1258 | + print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>"; |
|
| 1259 | + print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>"; |
|
| 1260 | 1260 | print "</tr>"; |
| 1261 | 1261 | |
| 1262 | 1262 | $i++; |
@@ -1269,22 +1269,22 @@ discard block |
||
| 1269 | 1269 | if ($mt) { |
| 1270 | 1270 | $reflabel = ''; |
| 1271 | 1271 | if (!empty($val['lib'])) { |
| 1272 | - $reflabel .= $val['lib'].($val['soclib'] ? " - " : ""); |
|
| 1272 | + $reflabel .= $val['lib'] . ($val['soclib'] ? " - " : ""); |
|
| 1273 | 1273 | } |
| 1274 | 1274 | if ($tabtype[$key] == 'banktransfert') { |
| 1275 | - $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; |
|
| 1275 | + $reflabel .= $langs->trans('TransitionalAccount') . ' ' . $account_transfer; |
|
| 1276 | 1276 | } else { |
| 1277 | 1277 | $reflabel .= $val['soclib']; |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - print '<!-- Thirdparty bank.rowid='.$key.' -->'; |
|
| 1280 | + print '<!-- Thirdparty bank.rowid=' . $key . ' -->'; |
|
| 1281 | 1281 | print '<tr class="oddeven">'; |
| 1282 | 1282 | |
| 1283 | 1283 | // Date |
| 1284 | - print "<td>".$date."</td>"; |
|
| 1284 | + print "<td>" . $date . "</td>"; |
|
| 1285 | 1285 | |
| 1286 | 1286 | // Ref |
| 1287 | - print "<td>".dol_escape_htmltag($ref)."</td>"; |
|
| 1287 | + print "<td>" . dol_escape_htmltag($ref) . "</td>"; |
|
| 1288 | 1288 | |
| 1289 | 1289 | // Ledger account |
| 1290 | 1290 | $account_ledger = $k; |
@@ -1315,9 +1315,9 @@ discard block |
||
| 1315 | 1315 | if ($tabtype[$key] == 'unknown') { |
| 1316 | 1316 | // We will accept writing, but into a waiting account |
| 1317 | 1317 | if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE') || getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE') == '-1') { |
| 1318 | - $accounttoshow = '<span class="error small">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>'; |
|
| 1318 | + $accounttoshow = '<span class="error small">' . $langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking') . '</span>'; |
|
| 1319 | 1319 | } else { |
| 1320 | - $accounttoshow = '<span class="warning small">'.$langs->trans('UnknownAccountForThirdparty', length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'))).'</span>'; // We will use a waiting account |
|
| 1320 | + $accounttoshow = '<span class="warning small">' . $langs->trans('UnknownAccountForThirdparty', length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'))) . '</span>'; // We will use a waiting account |
|
| 1321 | 1321 | } |
| 1322 | 1322 | } else { |
| 1323 | 1323 | // We will refuse writing |
@@ -1340,11 +1340,11 @@ discard block |
||
| 1340 | 1340 | if ($tabtype[$key] == 'member') { |
| 1341 | 1341 | $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; |
| 1342 | 1342 | } |
| 1343 | - $accounttoshow = '<span class="error small">'.$langs->trans($errorstring).'</span>'; |
|
| 1343 | + $accounttoshow = '<span class="error small">' . $langs->trans($errorstring) . '</span>'; |
|
| 1344 | 1344 | } |
| 1345 | 1345 | } |
| 1346 | - print '<td class="maxwidth300" title="'.dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)).'">'; |
|
| 1347 | - print $accounttoshow; // This is a HTML string |
|
| 1346 | + print '<td class="maxwidth300" title="' . dol_escape_htmltag(dol_string_nohtmltag($accounttoshow)) . '">'; |
|
| 1347 | + print $accounttoshow; // This is a HTML string |
|
| 1348 | 1348 | print "</td>"; |
| 1349 | 1349 | |
| 1350 | 1350 | // Subledger account |
@@ -1360,12 +1360,12 @@ discard block |
||
| 1360 | 1360 | if (!empty($tabcompany[$key]['code_compta'])) { |
| 1361 | 1361 | if (in_array($tabtype[$key], array('payment_various', 'payment_salary'))) { |
| 1362 | 1362 | // For such case, if subledger is not defined, we won't use subledger accounts. |
| 1363 | - $accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>'; |
|
| 1363 | + $accounttoshowsubledger = '<span class="warning small">' . $langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored") . '</span>'; |
|
| 1364 | 1364 | } else { |
| 1365 | - $accounttoshowsubledger = '<span class="warning small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>'; |
|
| 1365 | + $accounttoshowsubledger = '<span class="warning small">' . $langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']) . '</span>'; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | } else { |
| 1368 | - $accounttoshowsubledger = '<span class="error small">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>'; |
|
| 1368 | + $accounttoshowsubledger = '<span class="error small">' . $langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking") . '</span>'; |
|
| 1369 | 1369 | } |
| 1370 | 1370 | } |
| 1371 | 1371 | } else { |
@@ -1373,16 +1373,16 @@ discard block |
||
| 1373 | 1373 | } |
| 1374 | 1374 | } |
| 1375 | 1375 | print '<td class="maxwidth300">'; |
| 1376 | - print $accounttoshowsubledger; // This is a html string |
|
| 1376 | + print $accounttoshowsubledger; // This is a html string |
|
| 1377 | 1377 | print "</td>"; |
| 1378 | 1378 | |
| 1379 | - print "<td>".$reflabel."</td>"; |
|
| 1379 | + print "<td>" . $reflabel . "</td>"; |
|
| 1380 | 1380 | |
| 1381 | - print '<td class="center">'.$val["type_payment"]."</td>"; |
|
| 1381 | + print '<td class="center">' . $val["type_payment"] . "</td>"; |
|
| 1382 | 1382 | |
| 1383 | - print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; |
|
| 1383 | + print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>"; |
|
| 1384 | 1384 | |
| 1385 | - print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; |
|
| 1385 | + print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>"; |
|
| 1386 | 1386 | |
| 1387 | 1387 | print "</tr>"; |
| 1388 | 1388 | |
@@ -1394,14 +1394,14 @@ discard block |
||
| 1394 | 1394 | if ($mt) { |
| 1395 | 1395 | $reflabel = ''; |
| 1396 | 1396 | if (!empty($val['lib'])) { |
| 1397 | - $reflabel .= $val['lib']." - "; |
|
| 1397 | + $reflabel .= $val['lib'] . " - "; |
|
| 1398 | 1398 | } |
| 1399 | 1399 | $reflabel .= 'WaitingAccount'; |
| 1400 | 1400 | |
| 1401 | - print '<!-- Wait bank.rowid='.$key.' -->'; |
|
| 1401 | + print '<!-- Wait bank.rowid=' . $key . ' -->'; |
|
| 1402 | 1402 | print '<tr class="oddeven">'; |
| 1403 | - print "<td>".$date."</td>"; |
|
| 1404 | - print "<td>".$ref."</td>"; |
|
| 1403 | + print "<td>" . $date . "</td>"; |
|
| 1404 | + print "<td>" . $ref . "</td>"; |
|
| 1405 | 1405 | // Ledger account |
| 1406 | 1406 | print "<td>"; |
| 1407 | 1407 | /*if (empty($accounttoshow) || $accounttoshow == 'NotDefined') |
@@ -1414,10 +1414,10 @@ discard block |
||
| 1414 | 1414 | // Subledger account |
| 1415 | 1415 | print "<td>"; |
| 1416 | 1416 | print "</td>"; |
| 1417 | - print "<td>".dol_escape_htmltag($reflabel)."</td>"; |
|
| 1418 | - print '<td class="center">'.$val["type_payment"]."</td>"; |
|
| 1419 | - print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; |
|
| 1420 | - print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; |
|
| 1417 | + print "<td>" . dol_escape_htmltag($reflabel) . "</td>"; |
|
| 1418 | + print '<td class="center">' . $val["type_payment"] . "</td>"; |
|
| 1419 | + print '<td class="right nowraponall amount">' . ($mt < 0 ? price(-$mt) : '') . "</td>"; |
|
| 1420 | + print '<td class="right nowraponall amount">' . ($mt >= 0 ? price($mt) : '') . "</td>"; |
|
| 1421 | 1421 | print "</tr>"; |
| 1422 | 1422 | |
| 1423 | 1423 | $i++; |
@@ -1428,7 +1428,7 @@ discard block |
||
| 1428 | 1428 | |
| 1429 | 1429 | if (!$i) { |
| 1430 | 1430 | $colspan = 8; |
| 1431 | - print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>'; |
|
| 1431 | + print '<tr class="oddeven"><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>'; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | print "</table>"; |
@@ -1483,77 +1483,77 @@ discard block |
||
| 1483 | 1483 | $sqlmid = ''; |
| 1484 | 1484 | if ($typerecord == 'payment') { |
| 1485 | 1485 | if (getDolGlobalInt('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { |
| 1486 | - $sqlmid = "SELECT payfac.fk_facture as id, ".$db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref')." as ref"; |
|
| 1487 | - $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; |
|
| 1488 | - $sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; |
|
| 1489 | - $sqlmid .= " LEFT JOIN ".$db->prefix()."societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture"; |
|
| 1490 | - $sqlmid .= " LEFT JOIN ".$db->prefix()."facture as f1 ON f1.rowid = sre.fk_facture"; |
|
| 1491 | - $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); |
|
| 1486 | + $sqlmid = "SELECT payfac.fk_facture as id, " . $db->ifsql('f1.rowid IS NULL', 'f.ref', 'f1.ref') . " as ref"; |
|
| 1487 | + $sqlmid .= " FROM " . $db->prefix() . "paiement_facture as payfac"; |
|
| 1488 | + $sqlmid .= " LEFT JOIN " . $db->prefix() . "facture as f ON f.rowid = payfac.fk_facture"; |
|
| 1489 | + $sqlmid .= " LEFT JOIN " . $db->prefix() . "societe_remise_except as sre ON sre.fk_facture_source = payfac.fk_facture"; |
|
| 1490 | + $sqlmid .= " LEFT JOIN " . $db->prefix() . "facture as f1 ON f1.rowid = sre.fk_facture"; |
|
| 1491 | + $sqlmid .= " WHERE payfac.fk_paiement=" . ((int) $val['paymentid']); |
|
| 1492 | 1492 | } else { |
| 1493 | 1493 | $sqlmid = "SELECT payfac.fk_facture as id, f.ref as ref"; |
| 1494 | - $sqlmid .= " FROM ".$db->prefix()."paiement_facture as payfac"; |
|
| 1495 | - $sqlmid .= " INNER JOIN ".$db->prefix()."facture as f ON f.rowid = payfac.fk_facture"; |
|
| 1496 | - $sqlmid .= " WHERE payfac.fk_paiement=".((int) $val['paymentid']); |
|
| 1494 | + $sqlmid .= " FROM " . $db->prefix() . "paiement_facture as payfac"; |
|
| 1495 | + $sqlmid .= " INNER JOIN " . $db->prefix() . "facture as f ON f.rowid = payfac.fk_facture"; |
|
| 1496 | + $sqlmid .= " WHERE payfac.fk_paiement=" . ((int) $val['paymentid']); |
|
| 1497 | 1497 | } |
| 1498 | 1498 | $ref = $langs->transnoentitiesnoconv("Invoice"); |
| 1499 | 1499 | } elseif ($typerecord == 'payment_supplier') { |
| 1500 | 1500 | $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; |
| 1501 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f"; |
|
| 1502 | - $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".((int) $val["paymentsupplierid"]); |
|
| 1501 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, " . MAIN_DB_PREFIX . "facture_fourn as f"; |
|
| 1502 | + $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . ((int) $val["paymentsupplierid"]); |
|
| 1503 | 1503 | $ref = $langs->transnoentitiesnoconv("SupplierInvoice"); |
| 1504 | 1504 | } elseif ($typerecord == 'payment_expensereport') { |
| 1505 | 1505 | $sqlmid = 'SELECT e.rowid as id, e.ref'; |
| 1506 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e"; |
|
| 1507 | - $sqlmid .= " WHERE pe.rowid=".((int) $val["paymentexpensereport"])." AND pe.fk_expensereport = e.rowid"; |
|
| 1506 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e"; |
|
| 1507 | + $sqlmid .= " WHERE pe.rowid=" . ((int) $val["paymentexpensereport"]) . " AND pe.fk_expensereport = e.rowid"; |
|
| 1508 | 1508 | $ref = $langs->transnoentitiesnoconv("ExpenseReport"); |
| 1509 | 1509 | } elseif ($typerecord == 'payment_salary') { |
| 1510 | 1510 | $sqlmid = 'SELECT s.rowid as ref'; |
| 1511 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; |
|
| 1512 | - $sqlmid .= " WHERE s.rowid=".((int) $val["paymentsalid"]); |
|
| 1511 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s"; |
|
| 1512 | + $sqlmid .= " WHERE s.rowid=" . ((int) $val["paymentsalid"]); |
|
| 1513 | 1513 | $ref = $langs->transnoentitiesnoconv("SalaryPayment"); |
| 1514 | 1514 | } elseif ($typerecord == 'sc') { |
| 1515 | 1515 | $sqlmid = 'SELECT sc.rowid as ref'; |
| 1516 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc"; |
|
| 1517 | - $sqlmid .= " WHERE sc.rowid=".((int) $val["paymentscid"]); |
|
| 1516 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc"; |
|
| 1517 | + $sqlmid .= " WHERE sc.rowid=" . ((int) $val["paymentscid"]); |
|
| 1518 | 1518 | $ref = $langs->transnoentitiesnoconv("SocialContribution"); |
| 1519 | 1519 | } elseif ($typerecord == 'payment_vat') { |
| 1520 | 1520 | $sqlmid = 'SELECT v.rowid as ref'; |
| 1521 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v"; |
|
| 1522 | - $sqlmid .= " WHERE v.rowid=".((int) $val["paymentvatid"]); |
|
| 1521 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v"; |
|
| 1522 | + $sqlmid .= " WHERE v.rowid=" . ((int) $val["paymentvatid"]); |
|
| 1523 | 1523 | $ref = $langs->transnoentitiesnoconv("PaymentVat"); |
| 1524 | 1524 | } elseif ($typerecord == 'payment_donation') { |
| 1525 | 1525 | $sqlmid = 'SELECT payd.fk_donation as ref'; |
| 1526 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd"; |
|
| 1527 | - $sqlmid .= " WHERE payd.fk_donation=".((int) $val["paymentdonationid"]); |
|
| 1526 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd"; |
|
| 1527 | + $sqlmid .= " WHERE payd.fk_donation=" . ((int) $val["paymentdonationid"]); |
|
| 1528 | 1528 | $ref = $langs->transnoentitiesnoconv("Donation"); |
| 1529 | 1529 | } elseif ($typerecord == 'payment_loan') { |
| 1530 | 1530 | $sqlmid = 'SELECT l.rowid as ref'; |
| 1531 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l"; |
|
| 1532 | - $sqlmid .= " WHERE l.rowid=".((int) $val["paymentloanid"]); |
|
| 1531 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_loan as l"; |
|
| 1532 | + $sqlmid .= " WHERE l.rowid=" . ((int) $val["paymentloanid"]); |
|
| 1533 | 1533 | $ref = $langs->transnoentitiesnoconv("LoanPayment"); |
| 1534 | 1534 | } elseif ($typerecord == 'payment_various') { |
| 1535 | 1535 | $sqlmid = 'SELECT v.rowid as ref'; |
| 1536 | - $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v"; |
|
| 1537 | - $sqlmid .= " WHERE v.rowid=".((int) $val["paymentvariousid"]); |
|
| 1536 | + $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v"; |
|
| 1537 | + $sqlmid .= " WHERE v.rowid=" . ((int) $val["paymentvariousid"]); |
|
| 1538 | 1538 | $ref = $langs->transnoentitiesnoconv("VariousPayment"); |
| 1539 | 1539 | } |
| 1540 | 1540 | // Add warning |
| 1541 | 1541 | if (empty($sqlmid)) { |
| 1542 | - dol_syslog("Found a typerecord=".$typerecord." not supported", LOG_WARNING); |
|
| 1542 | + dol_syslog("Found a typerecord=" . $typerecord . " not supported", LOG_WARNING); |
|
| 1543 | 1543 | } |
| 1544 | 1544 | |
| 1545 | 1545 | if ($sqlmid) { |
| 1546 | - dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG); |
|
| 1546 | + dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); |
|
| 1547 | 1547 | $resultmid = $db->query($sqlmid); |
| 1548 | 1548 | if ($resultmid) { |
| 1549 | 1549 | while ($objmid = $db->fetch_object($resultmid)) { |
| 1550 | - $ref .= ' '.$objmid->ref; |
|
| 1550 | + $ref .= ' ' . $objmid->ref; |
|
| 1551 | 1551 | } |
| 1552 | 1552 | } else { |
| 1553 | 1553 | dol_print_error($db); |
| 1554 | 1554 | } |
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | - $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300 |
|
| 1557 | + $ref = dol_trunc($langs->transnoentitiesnoconv("BankId") . ' ' . $val['fk_bank'] . ' - ' . $ref, 295); // 295 + 3 dots (...) is < than max size of 300 |
|
| 1558 | 1558 | return $ref; |
| 1559 | 1559 | } |
@@ -381,7 +381,7 @@ |
||
| 381 | 381 | |
| 382 | 382 | foreach ($arrayofvat[$key] as $k => $mt) { |
| 383 | 383 | if ($mt) { |
| 384 | - $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label |
|
| 384 | + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label |
|
| 385 | 385 | $account_label = $accountingaccount->label; |
| 386 | 386 | |
| 387 | 387 | // get compte id and label |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $hookmanager->initHooks(array('accountancyBindingCalculation')); |
| 748 | 748 | |
| 749 | 749 | // Execute hook accountancyBindingCalculation |
| 750 | - $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet ,'accountingAccount' => $accountingAccount, 0 => $type); |
|
| 750 | + $parameters = array('buyer' => $buyer, 'seller' => $seller, 'product' => $product, 'facture' => $facture, 'factureDet' => $factureDet, 'accountingAccount' => $accountingAccount, 0 => $type); |
|
| 751 | 751 | $reshook = $hookmanager->executeHooks('accountancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks |
| 752 | 752 | |
| 753 | 753 | if (empty($reshook)) { |
@@ -761,9 +761,9 @@ discard block |
||
| 761 | 761 | require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
| 762 | 762 | $isBuyerInEEC = isInEEC($buyer); |
| 763 | 763 | $isSellerInEEC = isInEEC($seller); |
| 764 | - $code_l = ''; // Default value for generic product/service |
|
| 765 | - $code_p = ''; // Value for the product/service in parameter ($product) |
|
| 766 | - $code_t = ''; // Default value of product account for the thirdparty |
|
| 764 | + $code_l = ''; // Default value for generic product/service |
|
| 765 | + $code_p = ''; // Value for the product/service in parameter ($product) |
|
| 766 | + $code_t = ''; // Default value of product account for the thirdparty |
|
| 767 | 767 | $suggestedid = ''; |
| 768 | 768 | |
| 769 | 769 | // Level 1 (define $code_l): Search suggested default account for product/service |
@@ -613,12 +613,12 @@ discard block |
||
| 613 | 613 | } |
| 614 | 614 | } else { // $type == 'csv' |
| 615 | 615 | $blocks[] = array( |
| 616 | - $depreciation_date, // Date |
|
| 617 | - $element_static->ref, // Piece |
|
| 618 | - $account_infos['code_formatted_1'], // AccountAccounting |
|
| 619 | - $element_name_formatted_0 . ' - ' . $depreciation_ref, // LabelOperation |
|
| 620 | - $mt < 0 ? price(-$mt) : '', // Debit |
|
| 621 | - $mt >= 0 ? price($mt) : '', // Credit |
|
| 616 | + $depreciation_date, // Date |
|
| 617 | + $element_static->ref, // Piece |
|
| 618 | + $account_infos['code_formatted_1'], // AccountAccounting |
|
| 619 | + $element_name_formatted_0 . ' - ' . $depreciation_ref, // LabelOperation |
|
| 620 | + $mt < 0 ? price(-$mt) : '', // Debit |
|
| 621 | + $mt >= 0 ? price($mt) : '', // Credit |
|
| 622 | 622 | ); |
| 623 | 623 | } |
| 624 | 624 | } |
@@ -734,12 +734,12 @@ discard block |
||
| 734 | 734 | } |
| 735 | 735 | } else { // $type == 'csv' |
| 736 | 736 | $blocks[] = array( |
| 737 | - $disposal_date, // Date |
|
| 738 | - $element_static->ref, // Piece |
|
| 739 | - $account_infos['code_formatted_1'], // AccountAccounting |
|
| 737 | + $disposal_date, // Date |
|
| 738 | + $element_static->ref, // Piece |
|
| 739 | + $account_infos['code_formatted_1'], // AccountAccounting |
|
| 740 | 740 | $element_name_formatted_0 . ' - ' . $disposal_ref, // LabelOperation |
| 741 | - $mt < 0 ? price(-$mt) : '', // Debit |
|
| 742 | - $mt >= 0 ? price($mt) : '', // Credit |
|
| 741 | + $mt < 0 ? price(-$mt) : '', // Debit |
|
| 742 | + $mt >= 0 ? price($mt) : '', // Credit |
|
| 743 | 743 | ); |
| 744 | 744 | } |
| 745 | 745 | } |
@@ -1731,7 +1731,7 @@ |
||
| 1731 | 1731 | $sql = "DELETE"; |
| 1732 | 1732 | $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element . $mode; |
| 1733 | 1733 | $sql .= " WHERE piece_num = " . (int) $piecenum; |
| 1734 | - $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
| 1734 | + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
| 1735 | 1735 | $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
| 1736 | 1736 | $sql .= $sql_filter; |
| 1737 | 1737 | |
@@ -639,7 +639,7 @@ |
||
| 639 | 639 | if (is_array($cpt)) { |
| 640 | 640 | $listofaccount = ''; |
| 641 | 641 | foreach ($cpt as $cptcursor) { |
| 642 | - if (! is_null($cptcursor)) { |
|
| 642 | + if (!is_null($cptcursor)) { |
|
| 643 | 643 | if ($listofaccount) { |
| 644 | 644 | $listofaccount .= ","; |
| 645 | 645 | } |
@@ -335,8 +335,8 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function export(&$TData, $formatexportset, $withAttachment = 0, $downloadMode = 0, $outputMode = 0, $noouput = 0) |
| 337 | 337 | { |
| 338 | - global $db, $conf, $langs; // The tpl file use $db |
|
| 339 | - global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php |
|
| 338 | + global $db, $conf, $langs; // The tpl file use $db |
|
| 339 | + global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php |
|
| 340 | 340 | |
| 341 | 341 | // Define name of file to save |
| 342 | 342 | $filename = 'general_ledger-' . $this->getFormatCode($formatexportset); |
@@ -2001,7 +2001,7 @@ discard block |
||
| 2001 | 2001 | // MOPM |
| 2002 | 2002 | $tab[] = ""; |
| 2003 | 2003 | // BONP |
| 2004 | - $tab[] = ""; |
|
| 2004 | + $tab[] = ""; |
|
| 2005 | 2005 | // BQAF |
| 2006 | 2006 | $tab[] = ""; |
| 2007 | 2007 | // ECES |
@@ -2207,7 +2207,7 @@ discard block |
||
| 2207 | 2207 | } |
| 2208 | 2208 | } elseif ($line->doc_type == 'customer_invoice') { |
| 2209 | 2209 | if (($line->amount) < 0) { |
| 2210 | - $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. |
|
| 2210 | + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. |
|
| 2211 | 2211 | } else { |
| 2212 | 2212 | $nature_piece = 'FC'; |
| 2213 | 2213 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $search_date_endday = GETPOSTINT('search_date_endday'); |
| 72 | 72 | $search_date_endmonth = GETPOSTINT('search_date_endmonth'); |
| 73 | 73 | $search_date_endyear = GETPOSTINT('search_date_endyear'); |
| 74 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 74 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 75 | 75 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 76 | 76 | $search_country = GETPOST('search_country', 'alpha'); |
| 77 | 77 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -566,14 +566,14 @@ discard block |
||
| 566 | 566 | $thirdpartystatic->client = $objp->client; |
| 567 | 567 | $thirdpartystatic->fournisseur = $objp->fournisseur; |
| 568 | 568 | $thirdpartystatic->code_client = $objp->code_client; |
| 569 | - $thirdpartystatic->code_compta = $objp->code_compta_client; // For backward compatibility |
|
| 569 | + $thirdpartystatic->code_compta = $objp->code_compta_client; // For backward compatibility |
|
| 570 | 570 | $thirdpartystatic->code_compta_client = $objp->code_compta_client; |
| 571 | 571 | $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; |
| 572 | 572 | $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; |
| 573 | 573 | $thirdpartystatic->email = $objp->email; |
| 574 | 574 | $thirdpartystatic->country_code = $objp->country_code; |
| 575 | 575 | $thirdpartystatic->tva_intra = $objp->tva_intra; |
| 576 | - $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 576 | + $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 577 | 577 | |
| 578 | 578 | $product_static->ref = $objp->product_ref; |
| 579 | 579 | $product_static->id = $objp->product_id; |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $sql .= " co.code as country_code, co.label as country_label,"; |
| 142 | 142 | $sql .= " s.tva_intra,"; |
| 143 | 143 | if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 144 | - $sql .= " spe.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty |
|
| 144 | + $sql .= " spe.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty |
|
| 145 | 145 | } else { |
| 146 | - $sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty |
|
| 146 | + $sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty |
|
| 147 | 147 | } |
| 148 | 148 | $sql .= " FROM " . $db->prefix() . "facture as f"; |
| 149 | 149 | $sql .= " INNER JOIN " . $db->prefix() . "societe as s ON s.rowid = f.fk_soc"; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
| 152 | 152 | } |
| 153 | 153 | $sql .= " LEFT JOIN " . $db->prefix() . "c_country as co ON co.rowid = s.fk_pays "; |
| 154 | - $sql .= " INNER JOIN " . $db->prefix() . "facturedet as l ON f.rowid = l.fk_facture"; // the main table |
|
| 154 | + $sql .= " INNER JOIN " . $db->prefix() . "facturedet as l ON f.rowid = l.fk_facture"; // the main table |
|
| 155 | 155 | $sql .= " LEFT JOIN " . $db->prefix() . "product as p ON p.rowid = l.fk_product"; |
| 156 | 156 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 157 | 157 | $sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $thirdpartystatic->email = !empty($objp->email) ? $objp->email : ""; |
| 206 | 206 | $thirdpartystatic->country_code = !empty($objp->country_code) ? $objp->country_code : ""; |
| 207 | 207 | $thirdpartystatic->tva_intra = !empty($objp->tva_intra) ? $objp->tva_intra : ""; |
| 208 | - $thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 208 | + $thirdpartystatic->code_compta_product = !empty($objp->company_code_sell) ? $objp->company_code_sell : ""; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 209 | 209 | |
| 210 | 210 | $product_static->ref = $objp->product_ref; |
| 211 | 211 | $product_static->id = $objp->product_id; |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | "MONTH(f.datef) = " . ((int) $j), |
| 673 | 673 | " (" . $db->ifsql( |
| 674 | 674 | "fd.total_ht < 0", |
| 675 | - " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! |
|
| 675 | + " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! |
|
| 676 | 676 | " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))" |
| 677 | 677 | ) . ")", |
| 678 | 678 | 0 |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | $sql .= " SUM(" . $db->ifsql( |
| 682 | 682 | "fd.total_ht < 0", |
| 683 | - " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! |
|
| 683 | + " (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))", // TODO This is bugged, we must use the percent for the invoice and fd.situation_percent is cumulated percent ! |
|
| 684 | 684 | " (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))" |
| 685 | 685 | ) . ") as total"; |
| 686 | 686 | } else { |