@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $confirm = GETPOST('confirm', 'alpha'); |
| 52 | 52 | $cancel = GETPOST('cancel', 'aZ09'); |
| 53 | 53 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'projecttasklist'; |
| 54 | -$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used |
|
| 54 | +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used |
|
| 55 | 55 | //$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used |
| 56 | 56 | //$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); |
| 57 | 57 | $optioncss = GETPOST('optioncss', 'aZ'); |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | $search_date_start_startmonth = GETPOSTINT('search_date_start_startmonth'); |
| 94 | 94 | $search_date_start_startyear = GETPOSTINT('search_date_start_startyear'); |
| 95 | 95 | $search_date_start_startday = GETPOSTINT('search_date_start_startday'); |
| 96 | -$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver |
|
| 96 | +$search_date_start_start = dol_mktime(0, 0, 0, $search_date_start_startmonth, $search_date_start_startday, $search_date_start_startyear); // Use tzserver |
|
| 97 | 97 | $search_date_start_endmonth = GETPOSTINT('search_date_start_endmonth'); |
| 98 | 98 | $search_date_start_endyear = GETPOSTINT('search_date_start_endyear'); |
| 99 | 99 | $search_date_start_endday = GETPOSTINT('search_date_start_endday'); |
| 100 | -$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver |
|
| 100 | +$search_date_start_end = dol_mktime(23, 59, 59, $search_date_start_endmonth, $search_date_start_endday, $search_date_start_endyear); // Use tzserver |
|
| 101 | 101 | |
| 102 | 102 | $search_date_end_startmonth = GETPOSTINT('search_date_end_startmonth'); |
| 103 | 103 | $search_date_end_startyear = GETPOSTINT('search_date_end_startyear'); |
| 104 | 104 | $search_date_end_startday = GETPOSTINT('search_date_end_startday'); |
| 105 | -$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver |
|
| 105 | +$search_date_end_start = dol_mktime(0, 0, 0, $search_date_end_startmonth, $search_date_end_startday, $search_date_end_startyear); // Use tzserver |
|
| 106 | 106 | $search_date_end_endmonth = GETPOSTINT('search_date_end_endmonth'); |
| 107 | 107 | $search_date_end_endyear = GETPOSTINT('search_date_end_endyear'); |
| 108 | 108 | $search_date_end_endday = GETPOSTINT('search_date_end_endday'); |
| 109 | -$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver |
|
| 109 | +$search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver |
|
| 110 | 110 | |
| 111 | 111 | //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects |
| 112 | 112 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; |
| 185 | 185 | |
| 186 | 186 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
| 187 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 187 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 188 | 188 | |
| 189 | 189 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
| 190 | 190 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $param .= '&search_date_end_endday='.urlencode((string) ($search_date_end_endday)); |
| 541 | 541 | } |
| 542 | 542 | if ($search_date_end_end) { |
| 543 | - $param .= '&search_date_end_end=' . urlencode($search_date_end_end); |
|
| 543 | + $param .= '&search_date_end_end='.urlencode($search_date_end_end); |
|
| 544 | 544 | } |
| 545 | 545 | if ($search_planedworkload) { |
| 546 | 546 | $param .= '&search_planedworkload='.urlencode($search_planedworkload); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { |
| 581 | 581 | $tmpurl = $_SESSION['pageforbacktolist']['project']; |
| 582 | 582 | $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); |
| 583 | - $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 583 | + $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 584 | 584 | } else { |
| 585 | 585 | $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
| 586 | 586 | } |
@@ -745,8 +745,8 @@ discard block |
||
| 745 | 745 | |
| 746 | 746 | $defaultref = ''; |
| 747 | 747 | $obj = getDolGlobalString('PROJECT_TASK_ADDON', 'mod_task_simple'); |
| 748 | - if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { |
|
| 749 | - require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php'; |
|
| 748 | + if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) { |
|
| 749 | + require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php'; |
|
| 750 | 750 | $modTask = new $obj(); |
| 751 | 751 | $defaultref = $modTask->getNextValue($object->thirdparty, null); |
| 752 | 752 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $permissiontoadd = $user->hasRight('projet', 'creer'); |
| 113 | 113 | $permissiontodelete = $user->hasRight('projet', 'supprimer'); |
| 114 | -$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php |
|
| 114 | +$permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include of actions_dellink.inc.php |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | /* |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $action = ''; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 165 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' |
|
| 166 | 166 | |
| 167 | 167 | // Action setdraft object |
| 168 | 168 | if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $object->date_end_event = (!GETPOST('date_end_event')) ? '' : $date_end_event; |
| 323 | 323 | $object->location = $location; |
| 324 | 324 | if (GETPOSTISSET('opp_amount')) { |
| 325 | - $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); |
|
| 325 | + $object->opp_amount = price2num(GETPOST('opp_amount', 'alpha')); |
|
| 326 | 326 | } |
| 327 | 327 | if (GETPOSTISSET('budget_amount')) { |
| 328 | 328 | $object->budget_amount = price2num(GETPOST('budget_amount', 'alpha')); |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { |
| 511 | 511 | $tmpurl = $_SESSION['pageforbacktolist']['project']; |
| 512 | 512 | $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); |
| 513 | - $urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1'; |
|
| 513 | + $urlback = $tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1'; |
|
| 514 | 514 | } else { |
| 515 | 515 | $urlback = DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1'; |
| 516 | 516 | } |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | print '<br>'; |
| 1072 | 1072 | } |
| 1073 | 1073 | if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { |
| 1074 | - print '<input type="checkbox" id="usage_task" name="usage_task"' . (GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')) . '> '; |
|
| 1074 | + print '<input type="checkbox" id="usage_task" name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'> '; |
|
| 1075 | 1075 | $htmltext = $langs->trans("ProjectFollowTasks"); |
| 1076 | 1076 | print '<label for="usage_task">'.$form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext).'</label>'; |
| 1077 | 1077 | print '<script>'; |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | print '<br>'; |
| 1098 | 1098 | } |
| 1099 | 1099 | if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { |
| 1100 | - print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"' . (GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')) . '> '; |
|
| 1100 | + print '<input type="checkbox" id="usage_bill_time" name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'> '; |
|
| 1101 | 1101 | $htmltext = $langs->trans("ProjectBillTimeDescription"); |
| 1102 | 1102 | print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans("BillTime"), $htmltext).'</label>'; |
| 1103 | 1103 | print '<script>'; |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | print '<br>'; |
| 1124 | 1124 | } |
| 1125 | 1125 | if (isModEnabled('eventorganization')) { |
| 1126 | - print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'. (GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')) . '> '; |
|
| 1126 | + print '<input type="checkbox" id="usage_organize_event" name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'> '; |
|
| 1127 | 1127 | $htmltext = $langs->trans("EventOrganizationDescriptionLong"); |
| 1128 | 1128 | print '<label for="usage_organize_event">'.$form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext).'</label>'; |
| 1129 | 1129 | print '<script>'; |
@@ -1302,7 +1302,7 @@ discard block |
||
| 1302 | 1302 | if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { |
| 1303 | 1303 | $tmpurl = $_SESSION['pageforbacktolist']['project']; |
| 1304 | 1304 | $tmpurl = preg_replace('/__SOCID__/', (string) $object->socid, $tmpurl); |
| 1305 | - $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1305 | + $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
| 1306 | 1306 | } else { |
| 1307 | 1307 | $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
| 1308 | 1308 | } |
@@ -1390,8 +1390,8 @@ discard block |
||
| 1390 | 1390 | print '<a class="editfielda paddingtop" href="'.$_SERVER["PHP_SELF"].'?action=edit_opp_status&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>'; |
| 1391 | 1391 | } |
| 1392 | 1392 | print '</td><td>'; |
| 1393 | - $html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none'; |
|
| 1394 | - $html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none'; |
|
| 1393 | + $html_name_status = ($action == 'edit_opp_status') ? 'opp_status' : 'none'; |
|
| 1394 | + $html_name_percent = ($action == 'edit_opp_status') ? 'opp_percent' : 'none'; |
|
| 1395 | 1395 | $percent_value = (GETPOSTISSET('opp_percent') ? GETPOST('opp_percent') : (strcmp($object->opp_percent, '') ? vatrate($object->opp_percent) : '')); |
| 1396 | 1396 | $formproject->formOpportunityStatus($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->opp_status, $percent_value, $html_name_status, $html_name_percent); |
| 1397 | 1397 | print '</td></tr>'; |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | if ($userWrite > 0) { |
| 1603 | 1603 | print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?action=confirm_setdraft&confirm=yes&token='.newToken().'&id='.$object->id, ''); |
| 1604 | 1604 | } else { |
| 1605 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1605 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('SetToDraft'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1606 | 1606 | } |
| 1607 | 1607 | } |
| 1608 | 1608 | } |
@@ -1612,7 +1612,7 @@ discard block |
||
| 1612 | 1612 | if ($userWrite > 0) { |
| 1613 | 1613 | print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, ''); |
| 1614 | 1614 | } else { |
| 1615 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1615 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1616 | 1616 | } |
| 1617 | 1617 | } |
| 1618 | 1618 | |
@@ -1621,7 +1621,7 @@ discard block |
||
| 1621 | 1621 | if ($userWrite > 0) { |
| 1622 | 1622 | print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, ''); |
| 1623 | 1623 | } else { |
| 1624 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1624 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1625 | 1625 | } |
| 1626 | 1626 | } |
| 1627 | 1627 | |
@@ -1630,7 +1630,7 @@ discard block |
||
| 1630 | 1630 | if ($userWrite > 0) { |
| 1631 | 1631 | print dolGetButtonAction('', $langs->trans('Close'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&id='.$object->id, ''); |
| 1632 | 1632 | } else { |
| 1633 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1633 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Close'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1634 | 1634 | } |
| 1635 | 1635 | } |
| 1636 | 1636 | |
@@ -1639,7 +1639,7 @@ discard block |
||
| 1639 | 1639 | if ($userWrite > 0) { |
| 1640 | 1640 | print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); |
| 1641 | 1641 | } else { |
| 1642 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ReOpen'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1642 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ReOpen'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1643 | 1643 | } |
| 1644 | 1644 | } |
| 1645 | 1645 | |
@@ -1668,7 +1668,7 @@ discard block |
||
| 1668 | 1668 | if ($userWrite > 0) { |
| 1669 | 1669 | print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.((int) $object->id), ''); |
| 1670 | 1670 | } else { |
| 1671 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1671 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1672 | 1672 | } |
| 1673 | 1673 | } |
| 1674 | 1674 | |
@@ -1677,7 +1677,7 @@ discard block |
||
| 1677 | 1677 | if ($userDelete > 0 || ($object->status == Project::STATUS_DRAFT && $user->hasRight('projet', 'creer'))) { |
| 1678 | 1678 | print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, ''); |
| 1679 | 1679 | } else { |
| 1680 | - print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false); |
|
| 1680 | + print dolGetButtonAction($langs->trans('NotOwnerOfProject'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false); |
|
| 1681 | 1681 | } |
| 1682 | 1682 | } |
| 1683 | 1683 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | |
| 173 | 173 | $parameters = array(); |
| 174 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 174 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 175 | 175 | if ($reshook < 0) { |
| 176 | 176 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 177 | 177 | } |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | $bankaccount = GETPOSTINT('accountid'); |
| 187 | 187 | } else { |
| 188 | 188 | if ($pay == 'LIQ') { |
| 189 | - $bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 189 | + $bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 190 | 190 | } elseif ($pay == "CHQ") { |
| 191 | - $bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 191 | + $bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility |
|
| 192 | 192 | } else { |
| 193 | 193 | $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; |
| 194 | 194 | $bankaccount = getDolGlobalInt($accountname); |
@@ -253,10 +253,10 @@ discard block |
||
| 253 | 253 | $savconst = getDolGlobalString('STOCK_CALCULATE_ON_BILL'); |
| 254 | 254 | |
| 255 | 255 | if (isModEnabled('productbatch') && !getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) { |
| 256 | - $conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (this will be done later) |
|
| 256 | + $conf->global->STOCK_CALCULATE_ON_BILL = 0; // To not change the stock (this will be done later) |
|
| 257 | 257 | } else { |
| 258 | 258 | // Deprecated: CASHDESK_FORCE_DECREASE_STOCK is now always false. No more required/used. |
| 259 | - $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock |
|
| 259 | + $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | // Update stock for batch products |
| 333 | 333 | if (!$error && $res >= 0) { |
| 334 | 334 | if (isModEnabled('stock') && isModEnabled('productbatch')) { // The case !isModEnabled('productbatch') was processed few lines before. |
| 335 | - require_once DOL_DOCUMENT_ROOT . "/product/stock/class/mouvementstock.class.php"; |
|
| 335 | + require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; |
|
| 336 | 336 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
| 337 | 337 | $inventorycode = dol_print_date(dol_now(), 'dayhourlog'); |
| 338 | 338 | $labeltakeposmovement = 'TakePOS - '.$langs->trans("Invoice").' '.$invoice->ref; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $creditnote->socid = $invoice->socid; |
| 378 | 378 | $creditnote->date = dol_now(); |
| 379 | 379 | $creditnote->module_source = 'takepos'; |
| 380 | - $creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; |
|
| 380 | + $creditnote->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; |
|
| 381 | 381 | $creditnote->type = Facture::TYPE_CREDIT_NOTE; |
| 382 | 382 | $creditnote->fk_facture_source = $placeid; |
| 383 | 383 | //$creditnote->remise_absolue = $invoice->remise_absolue; |
@@ -536,10 +536,10 @@ discard block |
||
| 536 | 536 | $invoice->socid = getDolGlobalInt($constforcompanyid); |
| 537 | 537 | |
| 538 | 538 | include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
| 539 | - $invoice->date = dol_get_first_hour(dol_now('tzuserrel')); // Invoice::create() needs a date with no hours |
|
| 539 | + $invoice->date = dol_get_first_hour(dol_now('tzuserrel')); // Invoice::create() needs a date with no hours |
|
| 540 | 540 | |
| 541 | 541 | $invoice->module_source = 'takepos'; |
| 542 | - $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ; |
|
| 542 | + $invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; |
|
| 543 | 543 | $invoice->entity = !empty($_SESSION["takeposinvoiceentity"]) ? $_SESSION["takeposinvoiceentity"] : $conf->entity; |
| 544 | 544 | |
| 545 | 545 | if ($invoice->socid <= 0) { |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | // complete line by hook |
| 751 | 751 | $parameters = array('prod' => $prod, 'line' => $line); |
| 752 | - $reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
| 752 | + $reshook = $hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action); // Note that $action and $line may have been modified by some hooks |
|
| 753 | 753 | if ($reshook < 0) { |
| 754 | 754 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 755 | 755 | } |
@@ -944,7 +944,7 @@ discard block |
||
| 944 | 944 | } |
| 945 | 945 | if (!$permissiontoupdateline) { |
| 946 | 946 | dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos").' - No permission to updateprice', null, 1); |
| 947 | - } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { |
|
| 947 | + } elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) { |
|
| 948 | 948 | $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
| 949 | 949 | } else { |
| 950 | 950 | $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | |
| 1009 | 1009 | if ($action == "setbatch" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { |
| 1010 | 1010 | $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; |
| 1011 | - $warehouseid = getDolGlobalInt($constantforkey); // TODO Get the wrehouse id from GETPOSTINT('warehouseid'); |
|
| 1011 | + $warehouseid = getDolGlobalInt($constantforkey); // TODO Get the wrehouse id from GETPOSTINT('warehouseid'); |
|
| 1012 | 1012 | $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET batch = '".$db->escape($batch)."', fk_warehouse = ".((int) $warehouseid); |
| 1013 | 1013 | $sql .= " WHERE rowid=".((int) $idoflineadded); |
| 1014 | 1014 | $db->query($sql); |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | |
| 1157 | 1157 | $sectionwithinvoicelink .= '</span><br>'; |
| 1158 | 1158 | if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { |
| 1159 | - $sectionwithinvoicelink .= ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>'; |
|
| 1159 | + $sectionwithinvoicelink .= ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>'; |
|
| 1160 | 1160 | } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { |
| 1161 | 1161 | if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { |
| 1162 | 1162 | $sectionwithinvoicelink .= ' <button id="buttonprint" type="button" onclick="TakeposConnector('.$placeid.')">'.$langs->trans('PrintTicket').'</button>'; |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { |
| 1196 | 1196 | $title = 'TakePOS - Dolibarr '.DOL_VERSION; |
| 1197 | 1197 | if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { |
| 1198 | - $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
| 1198 | + $title = 'TakePOS - '.getDolGlobalString('MAIN_APPLICATION_TITLE'); |
|
| 1199 | 1199 | } |
| 1200 | 1200 | $head = '<meta name="apple-mobile-web-app-title" content="TakePOS"/> |
| 1201 | 1201 | <meta name="apple-mobile-web-app-capable" content="yes"> |
@@ -1420,7 +1420,7 @@ discard block |
||
| 1420 | 1420 | if ($contactid > 0) { |
| 1421 | 1421 | $contact = new Contact($db); |
| 1422 | 1422 | $contact->fetch($contactid); |
| 1423 | - $s .= " - " . $contact->getFullName($langs); |
|
| 1423 | + $s .= " - ".$contact->getFullName($langs); |
|
| 1424 | 1424 | } |
| 1425 | 1425 | } |
| 1426 | 1426 | } |
@@ -1481,10 +1481,10 @@ discard block |
||
| 1481 | 1481 | $s = ''; |
| 1482 | 1482 | |
| 1483 | 1483 | $idwarehouse = 0; |
| 1484 | - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1484 | + $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1485 | 1485 | if (isModEnabled('stock')) { |
| 1486 | 1486 | if (getDolGlobalString($constantforkey) != "1") { |
| 1487 | - $constantforkey = 'CASHDESK_ID_WAREHOUSE'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1487 | + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); |
|
| 1488 | 1488 | $idwarehouse = getDolGlobalString($constantforkey); |
| 1489 | 1489 | if ($idwarehouse > 0) { |
| 1490 | 1490 | $s = '<span class="small">'; |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | |
| 1633 | 1633 | // Complete header by hook |
| 1634 | 1634 | $parameters = array(); |
| 1635 | -$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1635 | +$reshook = $hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1636 | 1636 | if ($reshook < 0) { |
| 1637 | 1637 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 1638 | 1638 | } |
@@ -1646,16 +1646,16 @@ discard block |
||
| 1646 | 1646 | print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>'; |
| 1647 | 1647 | if (getDolGlobalString('TAKEPOS_SHOW_HT')) { |
| 1648 | 1648 | print '<td class="linecolht right nowraponall">'; |
| 1649 | - print '<span class="opacitymedium small">' . $langs->trans('TotalHTShort') . '</span><br>'; |
|
| 1649 | + print '<span class="opacitymedium small">'.$langs->trans('TotalHTShort').'</span><br>'; |
|
| 1650 | 1650 | // In phone version only show when it is invoice page |
| 1651 | 1651 | if (empty($mobilepage) || $mobilepage == "invoice") { |
| 1652 | - print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">' . price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency) . '</span>'; |
|
| 1652 | + print '<span id="linecolht-span-total" style="font-size:1.3em; font-weight: bold;">'.price($invoice->total_ht, 1, '', 1, -1, -1, $conf->currency).'</span>'; |
|
| 1653 | 1653 | if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) { |
| 1654 | 1654 | //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency |
| 1655 | - include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php'; |
|
| 1655 | + include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; |
|
| 1656 | 1656 | $multicurrency = new MultiCurrency($db); |
| 1657 | 1657 | $multicurrency->fetch(0, $_SESSION["takeposcustomercurrency"]); |
| 1658 | - print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">(' . price($invoice->total_ht * $multicurrency->rate->rate) . ' ' . $_SESSION["takeposcustomercurrency"] . ')</span>'; |
|
| 1658 | + print '<br><span id="linecolht-span-total" style="font-size:0.9em; font-style:italic;">('.price($invoice->total_ht * $multicurrency->rate->rate).' '.$_SESSION["takeposcustomercurrency"].')</span>'; |
|
| 1659 | 1659 | } |
| 1660 | 1660 | } |
| 1661 | 1661 | print '</td>'; |
@@ -1799,7 +1799,7 @@ discard block |
||
| 1799 | 1799 | |
| 1800 | 1800 | // complete line by hook |
| 1801 | 1801 | $parameters = array('line' => $line); |
| 1802 | - $reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1802 | + $reshook = $hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1803 | 1803 | if ($reshook < 0) { |
| 1804 | 1804 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 1805 | 1805 | } |
@@ -1854,7 +1854,7 @@ discard block |
||
| 1854 | 1854 | } |
| 1855 | 1855 | } |
| 1856 | 1856 | if (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 1) { |
| 1857 | - $htmlforlines .= $form->textwithpicto($line->product_label ? '<b>' . $line->product_ref . '</b> - ' . $line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
|
| 1857 | + $htmlforlines .= $form->textwithpicto($line->product_label ? '<b>'.$line->product_ref.'</b> - '.$line->product_label : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
|
| 1858 | 1858 | } elseif (getDolGlobalInt('TAKEPOS_SHOW_PRODUCT_REFERENCE') == 2) { |
| 1859 | 1859 | $htmlforlines .= $form->textwithpicto($line->product_ref ? '<b>'.$line->product_ref.'<b>' : dolGetFirstLineOfText($line->desc, 1), $tooltiptext); |
| 1860 | 1860 | } else { |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | |
| 1913 | 1913 | // complete line by hook |
| 1914 | 1914 | $parameters = array('line' => $line); |
| 1915 | - $reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1915 | + $reshook = $hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1916 | 1916 | if ($reshook < 0) { |
| 1917 | 1917 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 1918 | 1918 | } |
@@ -2018,7 +2018,7 @@ discard block |
||
| 2018 | 2018 | if (($action == "valid" || $action == "history") && $invoice->type != Facture::TYPE_CREDIT_NOTE && !getDolGlobalString('TAKEPOS_NO_CREDITNOTE')) { |
| 2019 | 2019 | print '<button id="buttonprint" type="button" onclick="ModalBox(\'ModalCreditNote\')">'.$langs->trans('CreateCreditNote').'</button>'; |
| 2020 | 2020 | if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { |
| 2021 | - print ' <a target="_blank" class="button" href="' . DOL_URL_ROOT . '/document.php?token=' . newToken() . '&modulepart=facture&file=' . $invoice->ref . '/' . $invoice->ref . '.pdf">Invoice</a>'; |
|
| 2021 | + print ' <a target="_blank" class="button" href="'.DOL_URL_ROOT.'/document.php?token='.newToken().'&modulepart=facture&file='.$invoice->ref.'/'.$invoice->ref.'.pdf">Invoice</a>'; |
|
| 2022 | 2022 | } |
| 2023 | 2023 | } |
| 2024 | 2024 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | if (getDolGlobalString('PROJECT_IMAGE_PUBLIC_NEWLEAD')) { |
| 137 | 137 | print '<div class="backimagepublicnewlead">'; |
| 138 | - print '<img id="idPROJECT_IMAGE_PUBLIC_NEWLEAD" src="' . getDolGlobalString('PROJECT_IMAGE_PUBLIC_NEWLEAD').'">'; |
|
| 138 | + print '<img id="idPROJECT_IMAGE_PUBLIC_NEWLEAD" src="'.getDolGlobalString('PROJECT_IMAGE_PUBLIC_NEWLEAD').'">'; |
|
| 139 | 139 | print '</div>'; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | } else { |
| 222 | 222 | // Create the prospect |
| 223 | 223 | if (GETPOST('societe')) { |
| 224 | - $thirdparty->name = GETPOST('societe'); |
|
| 224 | + $thirdparty->name = GETPOST('societe'); |
|
| 225 | 225 | $thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); |
| 226 | 226 | } else { |
| 227 | 227 | $thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | // Other attributes |
| 551 | -$parameters['tpl_context'] = 'public'; // define template context to public |
|
| 551 | +$parameters['tpl_context'] = 'public'; // define template context to public |
|
| 552 | 552 | include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
| 553 | 553 | // Comments |
| 554 | 554 | print '<tr>'; |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public $picto = 'asset'; |
| 53 | 53 | |
| 54 | - const STATUS_DRAFT = 0; // In progress |
|
| 55 | - const STATUS_DISPOSED = 9; // Disposed |
|
| 54 | + const STATUS_DRAFT = 0; // In progress |
|
| 55 | + const STATUS_DISPOSED = 9; // Disposed |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') |
@@ -518,11 +518,11 @@ discard block |
||
| 518 | 518 | // Check parameters |
| 519 | 519 | $error = 0; |
| 520 | 520 | if (empty($this->id)) { |
| 521 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 521 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 522 | 522 | $error++; |
| 523 | 523 | } |
| 524 | 524 | if (empty($this->fk_asset_model)) { |
| 525 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 525 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 526 | 526 | $error++; |
| 527 | 527 | } |
| 528 | 528 | if ($error) { |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | // Get depreciation options |
| 535 | 535 | //--------------------------- |
| 536 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; |
|
| 536 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php'; |
|
| 537 | 537 | $options_model = new AssetDepreciationOptions($this->db); |
| 538 | 538 | $result = $options_model->fetchDeprecationOptions(0, $this->fk_asset_model); |
| 539 | 539 | if ($result < 0) { |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | // Get accountancy codes |
| 569 | 569 | //--------------------------- |
| 570 | 570 | if (!$error) { |
| 571 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; |
|
| 571 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php'; |
|
| 572 | 572 | $accountancy_codes_model = new AssetAccountancyCodes($this->db); |
| 573 | 573 | $result = $accountancy_codes_model->fetchAccountancyCodes(0, $this->fk_asset_model); |
| 574 | 574 | if ($result < 0) { |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | // Check parameters |
| 628 | 628 | $error = 0; |
| 629 | 629 | if (empty($this->id)) { |
| 630 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 630 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 631 | 631 | $error++; |
| 632 | 632 | } |
| 633 | 633 | if ($error) { |
@@ -650,15 +650,15 @@ discard block |
||
| 650 | 650 | */ |
| 651 | 651 | |
| 652 | 652 | $sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht"; |
| 653 | - $sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping"; |
|
| 654 | - $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; |
|
| 655 | - $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; |
|
| 656 | - $sql .= " WHERE ad.fk_asset = " . (int) $this->id; |
|
| 653 | + $sql .= ", ".$this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0)." AS bookkeeping"; |
|
| 654 | + $sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad"; |
|
| 655 | + $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; |
|
| 656 | + $sql .= " WHERE ad.fk_asset = ".(int) $this->id; |
|
| 657 | 657 | $sql .= " ORDER BY ad.depreciation_date ASC"; |
| 658 | 658 | |
| 659 | 659 | $resql = $this->db->query($sql); |
| 660 | 660 | if (!$resql) { |
| 661 | - $this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror(); |
|
| 661 | + $this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror(); |
|
| 662 | 662 | return -1; |
| 663 | 663 | } |
| 664 | 664 | |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | // Check parameters |
| 696 | 696 | $error = 0; |
| 697 | 697 | if (empty($this->id)) { |
| 698 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 698 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 699 | 699 | $error++; |
| 700 | 700 | } |
| 701 | 701 | if ($error) { |
@@ -717,14 +717,14 @@ discard block |
||
| 717 | 717 | */ |
| 718 | 718 | |
| 719 | 719 | $sql = "SELECT COUNT(*) AS has_bookkeeping"; |
| 720 | - $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; |
|
| 721 | - $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; |
|
| 722 | - $sql .= " WHERE ad.fk_asset = " . (int) $this->id; |
|
| 720 | + $sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad"; |
|
| 721 | + $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; |
|
| 722 | + $sql .= " WHERE ad.fk_asset = ".(int) $this->id; |
|
| 723 | 723 | $sql .= " AND iab.fk_docdet IS NOT NULL"; |
| 724 | 724 | |
| 725 | 725 | $resql = $this->db->query($sql); |
| 726 | 726 | if (!$resql) { |
| 727 | - $this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror(); |
|
| 727 | + $this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror(); |
|
| 728 | 728 | return -1; |
| 729 | 729 | } |
| 730 | 730 | |
@@ -762,28 +762,28 @@ discard block |
||
| 762 | 762 | // Check parameters |
| 763 | 763 | $error = 0; |
| 764 | 764 | if (empty($this->id)) { |
| 765 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 765 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 766 | 766 | $error++; |
| 767 | 767 | } |
| 768 | 768 | if ($error) { |
| 769 | 769 | return -1; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)"; |
|
| 772 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)"; |
|
| 773 | 773 | $sql .= " VALUES ( "; |
| 774 | - $sql .= " " . (int) $this->id; |
|
| 775 | - $sql .= ", '" . $this->db->escape($mode) . "'"; |
|
| 776 | - $sql .= ", '" . $this->db->escape($ref) . "'"; |
|
| 777 | - $sql .= ", '" . $this->db->idate($depreciation_date) . "'"; |
|
| 778 | - $sql .= ", " . (float) $depreciation_ht; |
|
| 779 | - $sql .= ", " . (float) $cumulative_depreciation_ht; |
|
| 780 | - $sql .= ", '" . $this->db->escape($accountancy_code_debit) . "'"; |
|
| 781 | - $sql .= ", '" . $this->db->escape($accountancy_code_credit) . "'"; |
|
| 774 | + $sql .= " ".(int) $this->id; |
|
| 775 | + $sql .= ", '".$this->db->escape($mode)."'"; |
|
| 776 | + $sql .= ", '".$this->db->escape($ref)."'"; |
|
| 777 | + $sql .= ", '".$this->db->idate($depreciation_date)."'"; |
|
| 778 | + $sql .= ", ".(float) $depreciation_ht; |
|
| 779 | + $sql .= ", ".(float) $cumulative_depreciation_ht; |
|
| 780 | + $sql .= ", '".$this->db->escape($accountancy_code_debit)."'"; |
|
| 781 | + $sql .= ", '".$this->db->escape($accountancy_code_credit)."'"; |
|
| 782 | 782 | $sql .= ")"; |
| 783 | 783 | |
| 784 | 784 | $resql = $this->db->query($sql); |
| 785 | 785 | if (!$resql) { |
| 786 | - $this->errors[] = $langs->trans('AssetErrorAddDepreciationLine') . ': ' . $this->db->lasterror(); |
|
| 786 | + $this->errors[] = $langs->trans('AssetErrorAddDepreciationLine').': '.$this->db->lasterror(); |
|
| 787 | 787 | return -1; |
| 788 | 788 | } |
| 789 | 789 | |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | // Check parameters |
| 807 | 807 | $error = 0; |
| 808 | 808 | if (empty($this->id)) { |
| 809 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 809 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 810 | 810 | $error++; |
| 811 | 811 | } |
| 812 | 812 | if ($error) { |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | |
| 816 | 816 | // Get depreciation options |
| 817 | 817 | //--------------------------- |
| 818 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; |
|
| 818 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php'; |
|
| 819 | 819 | $options = new AssetDepreciationOptions($this->db); |
| 820 | 820 | $result = $options->fetchDeprecationOptions($this->id); |
| 821 | 821 | if ($result < 0) { |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | |
| 827 | 827 | // Get accountancy codes |
| 828 | 828 | //--------------------------- |
| 829 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php'; |
|
| 829 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php'; |
|
| 830 | 830 | $accountancy_codes = new AssetAccountancyCodes($this->db); |
| 831 | 831 | $result = $accountancy_codes->fetchAccountancyCodes($this->id); |
| 832 | 832 | if ($result < 0) { |
@@ -842,20 +842,20 @@ discard block |
||
| 842 | 842 | foreach ($options->deprecation_options as $mode_key => $fields) { |
| 843 | 843 | $modes[$mode_key] = $this->db->escape($mode_key); |
| 844 | 844 | } |
| 845 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation"; |
|
| 846 | - $sql .= " WHERE fk_asset = " . (int) $this->id; |
|
| 847 | - $sql .= " AND depreciation_mode NOT IN ('" . $this->db->sanitize(implode("', '", $modes)) . "')"; |
|
| 845 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation"; |
|
| 846 | + $sql .= " WHERE fk_asset = ".(int) $this->id; |
|
| 847 | + $sql .= " AND depreciation_mode NOT IN ('".$this->db->sanitize(implode("', '", $modes))."')"; |
|
| 848 | 848 | |
| 849 | 849 | $resql = $this->db->query($sql); |
| 850 | 850 | if (!$resql) { |
| 851 | - $this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror(); |
|
| 851 | + $this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror(); |
|
| 852 | 852 | $error++; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | if (!$error) { |
| 856 | 856 | // Get fiscal period |
| 857 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 858 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
| 857 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 858 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
| 859 | 859 | $dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition); |
| 860 | 860 | $init_fiscal_period_start = $dates['date_start']; |
| 861 | 861 | $init_fiscal_period_end = $dates['date_end']; |
@@ -888,17 +888,17 @@ discard block |
||
| 888 | 888 | */ |
| 889 | 889 | |
| 890 | 890 | $sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht"; |
| 891 | - $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad"; |
|
| 892 | - $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; |
|
| 893 | - $sql .= " WHERE ad.fk_asset = " . (int) $this->id; |
|
| 894 | - $sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'"; |
|
| 891 | + $sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad"; |
|
| 892 | + $sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid"; |
|
| 893 | + $sql .= " WHERE ad.fk_asset = ".(int) $this->id; |
|
| 894 | + $sql .= " AND ad.depreciation_mode = '".$this->db->escape($mode_key)."'"; |
|
| 895 | 895 | $sql .= " AND iab.fk_docdet IS NOT NULL"; |
| 896 | 896 | $sql .= " ORDER BY ad.depreciation_date DESC"; |
| 897 | 897 | $sql .= " LIMIT 1"; |
| 898 | 898 | |
| 899 | 899 | $resql = $this->db->query($sql); |
| 900 | 900 | if (!$resql) { |
| 901 | - $this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror(); |
|
| 901 | + $this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key).': '.$this->db->lasterror(); |
|
| 902 | 902 | $error++; |
| 903 | 903 | break; |
| 904 | 904 | } |
@@ -910,28 +910,28 @@ discard block |
||
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | // Set last cumulative depreciation |
| 913 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table']; |
|
| 914 | - $sql .= " SET total_amount_last_depreciation_ht = " . (empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht); |
|
| 915 | - $sql .= " WHERE fk_asset = " . (int) $this->id; |
|
| 913 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table']; |
|
| 914 | + $sql .= " SET total_amount_last_depreciation_ht = ".(empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht); |
|
| 915 | + $sql .= " WHERE fk_asset = ".(int) $this->id; |
|
| 916 | 916 | $resql = $this->db->query($sql); |
| 917 | 917 | if (!$resql) { |
| 918 | - $this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror(); |
|
| 918 | + $this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror(); |
|
| 919 | 919 | $error++; |
| 920 | 920 | break; |
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | // Delete old lines |
| 924 | - $sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation"; |
|
| 925 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid"; |
|
| 926 | - $sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id; |
|
| 927 | - $sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'"; |
|
| 924 | + $sql = "DELETE ".MAIN_DB_PREFIX."asset_depreciation FROM ".MAIN_DB_PREFIX."asset_depreciation"; |
|
| 925 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = ".MAIN_DB_PREFIX."asset_depreciation.rowid"; |
|
| 926 | + $sql .= " WHERE ".MAIN_DB_PREFIX."asset_depreciation.fk_asset = ".(int) $this->id; |
|
| 927 | + $sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.depreciation_mode = '".$this->db->escape($mode_key)."'"; |
|
| 928 | 928 | $sql .= " AND ab.fk_docdet IS NULL"; |
| 929 | 929 | if ($last_depreciation_date !== "") { |
| 930 | - $sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''"; |
|
| 930 | + $sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.ref != ''"; |
|
| 931 | 931 | } |
| 932 | 932 | $resql = $this->db->query($sql); |
| 933 | 933 | if (!$resql) { |
| 934 | - $this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror(); |
|
| 934 | + $this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror(); |
|
| 935 | 935 | $error++; |
| 936 | 936 | break; |
| 937 | 937 | } |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | // TODO fix declaration of $begin_period |
| 1000 | 1000 | $first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start; |
| 1001 | 1001 | |
| 1002 | - $ref_date_format = "%Y" . ($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '') . ($fields['duration_type'] == 2 ? '-%d' : ''); |
|
| 1002 | + $ref_date_format = "%Y".($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '').($fields['duration_type'] == 2 ? '-%d' : ''); |
|
| 1003 | 1003 | |
| 1004 | 1004 | // Loop security |
| 1005 | 1005 | $idx_loop = 0; |
@@ -1021,9 +1021,9 @@ discard block |
||
| 1021 | 1021 | |
| 1022 | 1022 | $period_begin = dol_print_date($fiscal_period_start, $ref_date_format); |
| 1023 | 1023 | $period_end = dol_print_date($fiscal_period_end, $ref_date_format); |
| 1024 | - $ref = $period_begin . ($period_begin != $period_end ? ' - ' . $period_end : ''); |
|
| 1024 | + $ref = $period_begin.($period_begin != $period_end ? ' - '.$period_end : ''); |
|
| 1025 | 1025 | if ($fiscal_period_start <= $disposal_date && $disposal_date <= $fiscal_period_end) { |
| 1026 | - $ref .= ' - ' . $langs->transnoentitiesnoconv('AssetDisposal'); |
|
| 1026 | + $ref .= ' - '.$langs->transnoentitiesnoconv('AssetDisposal'); |
|
| 1027 | 1027 | } |
| 1028 | 1028 | |
| 1029 | 1029 | $begin_date = $fiscal_period_start < $start_date && $start_date <= $fiscal_period_end ? $start_date : $fiscal_period_start; |
@@ -1102,7 +1102,7 @@ discard block |
||
| 1102 | 1102 | // Check parameters |
| 1103 | 1103 | $error = 0; |
| 1104 | 1104 | if (empty($asset_depreciation_id)) { |
| 1105 | - $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')'); |
|
| 1105 | + $this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation").' ('.$langs->transnoentitiesnoconv("TechnicalID").')'); |
|
| 1106 | 1106 | $error++; |
| 1107 | 1107 | } |
| 1108 | 1108 | if ($error) { |
@@ -1111,28 +1111,28 @@ discard block |
||
| 1111 | 1111 | |
| 1112 | 1112 | $this->db->begin(); |
| 1113 | 1113 | |
| 1114 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php'; |
|
| 1114 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php'; |
|
| 1115 | 1115 | $options = new AssetDepreciationOptions($this->db); |
| 1116 | 1116 | |
| 1117 | 1117 | // Get last depreciation lines save in bookkeeping |
| 1118 | 1118 | //----------------------------------------------------- |
| 1119 | 1119 | $sql = "SELECT fk_asset, depreciation_mode, cumulative_depreciation_ht"; |
| 1120 | - $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation"; |
|
| 1121 | - $sql .= " WHERE rowid = " . (int) $asset_depreciation_id; |
|
| 1120 | + $sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation"; |
|
| 1121 | + $sql .= " WHERE rowid = ".(int) $asset_depreciation_id; |
|
| 1122 | 1122 | $resql = $this->db->query($sql); |
| 1123 | 1123 | if (!$resql) { |
| 1124 | - $this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation') . ': ' . $this->db->lasterror(); |
|
| 1124 | + $this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation').': '.$this->db->lasterror(); |
|
| 1125 | 1125 | $error++; |
| 1126 | 1126 | } else { |
| 1127 | 1127 | if ($obj = $this->db->fetch_object($resql)) { |
| 1128 | 1128 | $mode_key = $obj->depreciation_mode; |
| 1129 | 1129 | if (!empty($options->deprecation_options_fields[$mode_key])) { |
| 1130 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table']; |
|
| 1131 | - $sql .= " SET total_amount_last_depreciation_ht = " . $obj->cumulative_depreciation_ht; |
|
| 1132 | - $sql .= " WHERE fk_asset = " . (int) $obj->fk_asset; |
|
| 1130 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table']; |
|
| 1131 | + $sql .= " SET total_amount_last_depreciation_ht = ".$obj->cumulative_depreciation_ht; |
|
| 1132 | + $sql .= " WHERE fk_asset = ".(int) $obj->fk_asset; |
|
| 1133 | 1133 | $resql = $this->db->query($sql); |
| 1134 | 1134 | if (!$resql) { |
| 1135 | - $this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror(); |
|
| 1135 | + $this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror(); |
|
| 1136 | 1136 | $error++; |
| 1137 | 1137 | } |
| 1138 | 1138 | } |
@@ -1385,7 +1385,7 @@ discard block |
||
| 1385 | 1385 | if ($option == 'label') { |
| 1386 | 1386 | $name = $this->label; |
| 1387 | 1387 | } elseif ($option == 'with_label') { |
| 1388 | - $name .= ' - ' . $this->label; |
|
| 1388 | + $name .= ' - '.$this->label; |
|
| 1389 | 1389 | } |
| 1390 | 1390 | $result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name); |
| 1391 | 1391 | } |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
| 1395 | 1395 | |
| 1396 | 1396 | global $action; |
| 1397 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1397 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1398 | 1398 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 1399 | 1399 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 1400 | 1400 | if ($reshook > 0) { |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | if (getDolGlobalString('ASSET_ASSET_ADDON')) { |
| 1531 | 1531 | $mybool = false; |
| 1532 | 1532 | |
| 1533 | - $file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php"; |
|
| 1533 | + $file = getDolGlobalString('ASSET_ASSET_ADDON').".php"; |
|
| 1534 | 1534 | $classname = getDolGlobalString('ASSET_ASSET_ADDON'); |
| 1535 | 1535 | |
| 1536 | 1536 | // Include file with class |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | * \brief File of withdrawal receipts class |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
| 38 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php'; |
|
| 39 | -require_once DOL_DOCUMENT_ROOT . '/salaries/class/salary.class.php'; |
|
| 40 | -require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php'; |
|
| 41 | -require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 42 | -require_once DOL_DOCUMENT_ROOT . '/user/class/userbankaccount.class.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 38 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; |
|
| 39 | +require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; |
|
| 40 | +require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; |
|
| 41 | +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 42 | +require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | const STATUS_DRAFT = 0; |
| 106 | 106 | const STATUS_TRANSFERED = 1; |
| 107 | - const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
| 108 | - const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
| 107 | + const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
| 108 | + const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | if ($result == 0) { |
| 260 | 260 | if ($line_id > 0) { |
| 261 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement ("; |
|
| 261 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement ("; |
|
| 262 | 262 | if ($type != 'bank-transfer') { |
| 263 | 263 | $sql .= "fk_facture"; |
| 264 | 264 | } else { |
@@ -271,24 +271,24 @@ discard block |
||
| 271 | 271 | $sql .= ",fk_prelevement_lignes"; |
| 272 | 272 | $sql .= ") VALUES ("; |
| 273 | 273 | $sql .= ((int) $invoice_id); |
| 274 | - $sql .= ", " . ((int) $line_id); |
|
| 274 | + $sql .= ", ".((int) $line_id); |
|
| 275 | 275 | $sql .= ")"; |
| 276 | 276 | |
| 277 | 277 | if ($this->db->query($sql)) { |
| 278 | 278 | $result = 0; |
| 279 | 279 | } else { |
| 280 | 280 | $result = -1; |
| 281 | - $this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror; |
|
| 282 | - dol_syslog(get_class($this) . "::AddFacture Error $result"); |
|
| 281 | + $this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror; |
|
| 282 | + dol_syslog(get_class($this)."::AddFacture Error $result"); |
|
| 283 | 283 | } |
| 284 | 284 | } else { |
| 285 | 285 | $result = -2; |
| 286 | - $this->errors[] = get_class($this) . "::AddFacture linedid Empty"; |
|
| 287 | - dol_syslog(get_class($this) . "::AddFacture Error $result"); |
|
| 286 | + $this->errors[] = get_class($this)."::AddFacture linedid Empty"; |
|
| 287 | + dol_syslog(get_class($this)."::AddFacture Error $result"); |
|
| 288 | 288 | } |
| 289 | 289 | } else { |
| 290 | 290 | $result = -3; |
| 291 | - dol_syslog(get_class($this) . "::AddFacture Error $result"); |
|
| 291 | + dol_syslog(get_class($this)."::AddFacture Error $result"); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | return $result; |
@@ -311,23 +311,23 @@ discard block |
||
| 311 | 311 | public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '') |
| 312 | 312 | { |
| 313 | 313 | $result = -1; |
| 314 | - $concat = 0; // ??? what is this for. Seems not used. |
|
| 314 | + $concat = 0; // ??? what is this for. Seems not used. |
|
| 315 | 315 | |
| 316 | 316 | if ($concat == 1) { |
| 317 | 317 | /* |
| 318 | 318 | * We aggregate the lines |
| 319 | 319 | */ |
| 320 | 320 | $sql = "SELECT rowid"; |
| 321 | - $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_lignes"; |
|
| 322 | - $sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id); |
|
| 321 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes"; |
|
| 322 | + $sql .= " WHERE fk_prelevement_bons = ".((int) $this->id); |
|
| 323 | 323 | if ($sourcetype == 'salary') { |
| 324 | - $sql .= " AND fk_soc = " . ((int) $client_id); |
|
| 324 | + $sql .= " AND fk_soc = ".((int) $client_id); |
|
| 325 | 325 | } else { |
| 326 | - $sql .= " AND fk_user = " . ((int) $client_id); |
|
| 326 | + $sql .= " AND fk_user = ".((int) $client_id); |
|
| 327 | 327 | } |
| 328 | - $sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'"; |
|
| 329 | - $sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'"; |
|
| 330 | - $sql .= " AND number = '" . $this->db->escape($number) . "'"; |
|
| 328 | + $sql .= " AND code_banque = '".$this->db->escape($code_banque)."'"; |
|
| 329 | + $sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'"; |
|
| 330 | + $sql .= " AND number = '".$this->db->escape($number)."'"; |
|
| 331 | 331 | |
| 332 | 332 | $resql = $this->db->query($sql); |
| 333 | 333 | if ($resql) { |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | /* |
| 340 | 340 | * No aggregate |
| 341 | 341 | */ |
| 342 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes ("; |
|
| 342 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes ("; |
|
| 343 | 343 | $sql .= "fk_prelevement_bons"; |
| 344 | 344 | $sql .= ", fk_soc"; |
| 345 | 345 | $sql .= ", client_nom"; |
@@ -351,21 +351,21 @@ discard block |
||
| 351 | 351 | $sql .= ($sourcetype == 'salary' ? ", fk_user" : ""); |
| 352 | 352 | $sql .= ") VALUES ("; |
| 353 | 353 | $sql .= $this->id; |
| 354 | - $sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null |
|
| 355 | - $sql .= ", '" . $this->db->escape($client_nom) . "'"; |
|
| 356 | - $sql .= ", " . ((float) price2num($amount)); |
|
| 357 | - $sql .= ", '" . $this->db->escape($code_banque) . "'"; |
|
| 358 | - $sql .= ", '" . $this->db->escape($code_guichet) . "'"; |
|
| 359 | - $sql .= ", '" . $this->db->escape($number) . "'"; |
|
| 360 | - $sql .= ", '" . $this->db->escape($number_key) . "'"; |
|
| 361 | - $sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : ''); |
|
| 354 | + $sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null |
|
| 355 | + $sql .= ", '".$this->db->escape($client_nom)."'"; |
|
| 356 | + $sql .= ", ".((float) price2num($amount)); |
|
| 357 | + $sql .= ", '".$this->db->escape($code_banque)."'"; |
|
| 358 | + $sql .= ", '".$this->db->escape($code_guichet)."'"; |
|
| 359 | + $sql .= ", '".$this->db->escape($number)."'"; |
|
| 360 | + $sql .= ", '".$this->db->escape($number_key)."'"; |
|
| 361 | + $sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : ''); |
|
| 362 | 362 | $sql .= ")"; |
| 363 | 363 | if ($this->db->query($sql)) { |
| 364 | - $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes"); |
|
| 364 | + $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); |
|
| 365 | 365 | $result = 0; |
| 366 | 366 | } else { |
| 367 | - $this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror; |
|
| 368 | - dol_syslog(get_class($this) . "::addline Error -2"); |
|
| 367 | + $this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror; |
|
| 368 | + dol_syslog(get_class($this)."::addline Error -2"); |
|
| 369 | 369 | $result = -2; |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | $sql .= ", p.type"; |
| 409 | 409 | $sql .= ", p.fk_bank_account"; |
| 410 | 410 | $sql .= ", p.statut as status"; |
| 411 | - $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p"; |
|
| 412 | - $sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")"; |
|
| 411 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; |
|
| 412 | + $sql .= " WHERE p.entity IN (".getEntity('invoice').")"; |
|
| 413 | 413 | if ($rowid > 0) { |
| 414 | - $sql .= " AND p.rowid = " . ((int) $rowid); |
|
| 414 | + $sql .= " AND p.rowid = ".((int) $rowid); |
|
| 415 | 415 | } else { |
| 416 | - $sql .= " AND p.ref = '" . $this->db->escape($ref) . "'"; |
|
| 416 | + $sql .= " AND p.ref = '".$this->db->escape($ref)."'"; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - dol_syslog(get_class($this) . "::fetch", LOG_DEBUG); |
|
| 419 | + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); |
|
| 420 | 420 | $result = $this->db->query($sql); |
| 421 | 421 | if ($result) { |
| 422 | 422 | if ($this->db->num_rows($result)) { |
@@ -442,13 +442,13 @@ discard block |
||
| 442 | 442 | if (empty($this->status)) { // Value is sometimes null in database |
| 443 | 443 | $this->status = 0; |
| 444 | 444 | } |
| 445 | - $this->statut = $this->status; // For backward compatibility |
|
| 445 | + $this->statut = $this->status; // For backward compatibility |
|
| 446 | 446 | |
| 447 | 447 | $this->fetched = 1; |
| 448 | 448 | |
| 449 | 449 | return 1; |
| 450 | 450 | } else { |
| 451 | - dol_syslog(get_class($this) . "::Fetch no record found"); |
|
| 451 | + dol_syslog(get_class($this)."::Fetch no record found"); |
|
| 452 | 452 | return 0; |
| 453 | 453 | } |
| 454 | 454 | } else { |
@@ -489,19 +489,19 @@ discard block |
||
| 489 | 489 | if ($date < $this->date_trans) { |
| 490 | 490 | $langs->load("errors"); |
| 491 | 491 | $this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission'); |
| 492 | - dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error); |
|
| 492 | + dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error); |
|
| 493 | 493 | return -1027; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | $this->db->begin(); |
| 497 | 497 | |
| 498 | - $sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons"; |
|
| 499 | - $sql .= " SET fk_user_credit = " . ((int) $user->id); |
|
| 500 | - $sql .= ", statut = " . self::STATUS_CREDITED; |
|
| 501 | - $sql .= ", date_credit = '" . $this->db->idate($date) . "'"; |
|
| 502 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 503 | - $sql .= " AND entity = " . ((int) $conf->entity); |
|
| 504 | - $sql .= " AND statut = " . self::STATUS_TRANSFERED; |
|
| 498 | + $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; |
|
| 499 | + $sql .= " SET fk_user_credit = ".((int) $user->id); |
|
| 500 | + $sql .= ", statut = ".self::STATUS_CREDITED; |
|
| 501 | + $sql .= ", date_credit = '".$this->db->idate($date)."'"; |
|
| 502 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 503 | + $sql .= " AND entity = ".((int) $conf->entity); |
|
| 504 | + $sql .= " AND statut = ".self::STATUS_TRANSFERED; |
|
| 505 | 505 | |
| 506 | 506 | $resql = $this->db->query($sql); |
| 507 | 507 | if ($resql) { |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $error++; |
| 617 | 617 | $this->error = $paiement->error; |
| 618 | 618 | $this->errors = $paiement->errors; |
| 619 | - dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error); |
|
| 619 | + dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error); |
|
| 620 | 620 | } else { |
| 621 | 621 | if ($this->type == 'bank-transfer') { |
| 622 | 622 | if ($type == 'salary') { |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | } else { |
| 632 | 632 | $modeforaddpayment = 'payment'; |
| 633 | 633 | $labelforaddpayment = '(CustomerInvoicePayment)'; |
| 634 | - $addbankurl = 'direct-debit'; // = 'directdebit' |
|
| 634 | + $addbankurl = 'direct-debit'; // = 'directdebit' |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl); |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | $error++; |
| 641 | 641 | $this->error = $paiement->error; |
| 642 | 642 | $this->errors = $paiement->errors; |
| 643 | - dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error); |
|
| 643 | + dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error); |
|
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | } |
@@ -648,24 +648,24 @@ discard block |
||
| 648 | 648 | // Update withdrawal line |
| 649 | 649 | // TODO: Translate to ligneprelevement.class.php |
| 650 | 650 | if (!$error) { |
| 651 | - $sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes"; |
|
| 651 | + $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes"; |
|
| 652 | 652 | $sql .= " SET statut = 2"; |
| 653 | - $sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id); |
|
| 653 | + $sql .= " WHERE fk_prelevement_bons = ".((int) $this->id); |
|
| 654 | 654 | |
| 655 | 655 | if (!$this->db->query($sql)) { |
| 656 | - dol_syslog(get_class($this) . "::set_infocredit Update lines Error"); |
|
| 656 | + dol_syslog(get_class($this)."::set_infocredit Update lines Error"); |
|
| 657 | 657 | $error++; |
| 658 | 658 | } |
| 659 | 659 | } |
| 660 | 660 | } else { |
| 661 | 661 | $this->error = $this->db->lasterror(); |
| 662 | - dol_syslog(get_class($this) . "::set_infocredit Update Bons Error"); |
|
| 662 | + dol_syslog(get_class($this)."::set_infocredit Update Bons Error"); |
|
| 663 | 663 | $error++; |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | // End of procedure |
| 667 | 667 | if ($error == 0) { |
| 668 | - $this->date_credit = $date; // date credit or debit |
|
| 668 | + $this->date_credit = $date; // date credit or debit |
|
| 669 | 669 | $this->statut = self::STATUS_CREDITED; |
| 670 | 670 | $this->status = self::STATUS_CREDITED; |
| 671 | 671 | |
@@ -696,17 +696,17 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | $error = 0; |
| 698 | 698 | |
| 699 | - dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO); |
|
| 699 | + dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO); |
|
| 700 | 700 | |
| 701 | 701 | if ($this->db->begin()) { |
| 702 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons "; |
|
| 703 | - $sql .= " SET fk_user_trans = " . $user->id; |
|
| 704 | - $sql .= " , date_trans = '" . $this->db->idate($date) . "'"; |
|
| 705 | - $sql .= " , method_trans = " . ((int) $method); |
|
| 706 | - $sql .= " , statut = " . self::STATUS_TRANSFERED; |
|
| 707 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 708 | - $sql .= " AND entity = " . ((int) $conf->entity); |
|
| 709 | - $sql .= " AND statut = " . self::STATUS_DRAFT; |
|
| 702 | + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons "; |
|
| 703 | + $sql .= " SET fk_user_trans = ".$user->id; |
|
| 704 | + $sql .= " , date_trans = '".$this->db->idate($date)."'"; |
|
| 705 | + $sql .= " , method_trans = ".((int) $method); |
|
| 706 | + $sql .= " , statut = ".self::STATUS_TRANSFERED; |
|
| 707 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 708 | + $sql .= " AND entity = ".((int) $conf->entity); |
|
| 709 | + $sql .= " AND statut = ".self::STATUS_DRAFT; |
|
| 710 | 710 | |
| 711 | 711 | if ($this->db->query($sql)) { |
| 712 | 712 | $this->method_trans = $method; |
@@ -731,12 +731,12 @@ discard block |
||
| 731 | 731 | return 0; |
| 732 | 732 | } else { |
| 733 | 733 | $this->db->rollback(); |
| 734 | - dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR); |
|
| 734 | + dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR); |
|
| 735 | 735 | |
| 736 | 736 | return -1; |
| 737 | 737 | } |
| 738 | 738 | } else { |
| 739 | - dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT); |
|
| 739 | + dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT); |
|
| 740 | 740 | return -2; |
| 741 | 741 | } |
| 742 | 742 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | $arr = array(); |
| 756 | 756 | |
| 757 | - dol_syslog(get_class($this) . "::getListInvoices"); |
|
| 757 | + dol_syslog(get_class($this)."::getListInvoices"); |
|
| 758 | 758 | |
| 759 | 759 | // Returns all invoices presented within same order |
| 760 | 760 | $sql = "SELECT "; |
@@ -770,13 +770,13 @@ discard block |
||
| 770 | 770 | if ($amounts) { |
| 771 | 771 | $sql .= ", SUM(pl.amount)"; |
| 772 | 772 | } |
| 773 | - $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,"; |
|
| 774 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; |
|
| 775 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement as p"; |
|
| 773 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,"; |
|
| 774 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; |
|
| 775 | + $sql .= " ".MAIN_DB_PREFIX."prelevement as p"; |
|
| 776 | 776 | $sql .= " WHERE p.fk_prelevement_lignes = pl.rowid"; |
| 777 | 777 | $sql .= " AND pl.fk_prelevement_bons = pb.rowid"; |
| 778 | - $sql .= " AND pb.rowid = " . ((int) $this->id); |
|
| 779 | - $sql .= " AND pb.entity = " . ((int) $conf->entity); |
|
| 778 | + $sql .= " AND pb.rowid = ".((int) $this->id); |
|
| 779 | + $sql .= " AND pb.entity = ".((int) $conf->entity); |
|
| 780 | 780 | if ($amounts) { |
| 781 | 781 | if ($this->type == 'bank-transfer') { |
| 782 | 782 | if ($type == 'salary') { |
@@ -830,17 +830,17 @@ discard block |
||
| 830 | 830 | $sql = "SELECT sum(pd.amount) as nb"; |
| 831 | 831 | if ($type !== 'salary') { |
| 832 | 832 | if ($mode != 'bank-transfer') { |
| 833 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,"; |
|
| 833 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; |
|
| 834 | 834 | } else { |
| 835 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,"; |
|
| 835 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; |
|
| 836 | 836 | } |
| 837 | 837 | } else { |
| 838 | - $sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,"; |
|
| 838 | + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s,"; |
|
| 839 | 839 | } |
| 840 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd"; |
|
| 841 | - $sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")"); |
|
| 840 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd"; |
|
| 841 | + $sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")"); |
|
| 842 | 842 | if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) { |
| 843 | - $sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID); |
|
| 843 | + $sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID); |
|
| 844 | 844 | } |
| 845 | 845 | if ($type !== 'salary') { |
| 846 | 846 | if ($mode != 'bank-transfer') { |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | return $obj->nb; |
| 866 | 866 | } else { |
| 867 | 867 | $error = 1; |
| 868 | - dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1"); |
|
| 868 | + dol_syslog(get_class($this)."::SommeAPrelever Erreur -1"); |
|
| 869 | 869 | dol_syslog($this->db->error()); |
| 870 | 870 | |
| 871 | 871 | return -1; |
@@ -901,26 +901,26 @@ discard block |
||
| 901 | 901 | // phpcs:enable |
| 902 | 902 | if ($forsalary == 1) { |
| 903 | 903 | $sql = "SELECT count(s.rowid) as nb"; |
| 904 | - $sql .= " FROM " . MAIN_DB_PREFIX . "salary as s"; |
|
| 904 | + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; |
|
| 905 | 905 | } else { |
| 906 | 906 | $sql = "SELECT count(f.rowid) as nb"; |
| 907 | 907 | |
| 908 | 908 | if ($type == 'bank-transfer') { |
| 909 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; |
|
| 909 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
|
| 910 | 910 | } else { |
| 911 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; |
|
| 911 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; |
|
| 912 | 912 | } |
| 913 | 913 | } |
| 914 | - $sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd"; |
|
| 914 | + $sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd"; |
|
| 915 | 915 | if ($forsalary == 1) { |
| 916 | - $sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")"; |
|
| 916 | + $sql .= " WHERE s.entity IN (".getEntity('invoice').")"; |
|
| 917 | 917 | if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) { |
| 918 | 918 | $sql .= " AND s.paye = 0"; |
| 919 | 919 | } |
| 920 | 920 | } else { |
| 921 | - $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; |
|
| 921 | + $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; |
|
| 922 | 922 | if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) { |
| 923 | - $sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED; |
|
| 923 | + $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; |
|
| 924 | 924 | } |
| 925 | 925 | } |
| 926 | 926 | if ($forsalary == 1) { |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | $sql .= " AND s.paye = 0"; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | - dol_syslog(get_class($this) . "::NbFactureAPrelever"); |
|
| 943 | + dol_syslog(get_class($this)."::NbFactureAPrelever"); |
|
| 944 | 944 | $resql = $this->db->query($sql); |
| 945 | 945 | |
| 946 | 946 | if ($resql) { |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | |
| 950 | 950 | return $obj->nb; |
| 951 | 951 | } else { |
| 952 | - $this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error(); |
|
| 952 | + $this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error(); |
|
| 953 | 953 | return -1; |
| 954 | 954 | } |
| 955 | 955 | } |
@@ -981,10 +981,10 @@ discard block |
||
| 981 | 981 | // phpcs:enable |
| 982 | 982 | global $conf, $langs, $user; |
| 983 | 983 | |
| 984 | - dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG); |
|
| 984 | + dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG); |
|
| 985 | 985 | |
| 986 | - require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; |
|
| 987 | - require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; |
|
| 986 | + require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; |
|
| 987 | + require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; |
|
| 988 | 988 | |
| 989 | 989 | // Check params |
| 990 | 990 | if ($type != 'bank-transfer') { |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | $factures_prev_id = array(); |
| 1021 | 1021 | $factures_errors = array(); |
| 1022 | 1022 | if (!$error) { |
| 1023 | - dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG); |
|
| 1023 | + dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG); |
|
| 1024 | 1024 | |
| 1025 | 1025 | $sql = "SELECT f.rowid, pd.rowid as pfdrowid"; |
| 1026 | 1026 | if ($sourcetype != 'salary') { |
@@ -1039,28 +1039,28 @@ discard block |
||
| 1039 | 1039 | } |
| 1040 | 1040 | if ($sourcetype != 'salary') { |
| 1041 | 1041 | if ($type != 'bank-transfer') { |
| 1042 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f"; |
|
| 1043 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture"; |
|
| 1042 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; |
|
| 1043 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture"; |
|
| 1044 | 1044 | } else { |
| 1045 | - $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; |
|
| 1046 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn"; |
|
| 1045 | + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
|
| 1046 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn"; |
|
| 1047 | 1047 | } |
| 1048 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; |
|
| 1049 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1"; |
|
| 1048 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
|
| 1049 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1"; |
|
| 1050 | 1050 | } else { |
| 1051 | - $sql .= " FROM " . MAIN_DB_PREFIX . "salary as f"; |
|
| 1052 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_salary"; |
|
| 1053 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as s ON s.rowid = f.fk_user"; |
|
| 1054 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here |
|
| 1051 | + $sql .= " FROM ".MAIN_DB_PREFIX."salary as f"; |
|
| 1052 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary"; |
|
| 1053 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user"; |
|
| 1054 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here |
|
| 1055 | 1055 | } |
| 1056 | 1056 | if ($sourcetype != 'salary') { |
| 1057 | 1057 | if ($type != 'bank-transfer') { |
| 1058 | - $sql .= " WHERE f.entity IN (" . getEntity('invoice') . ')'; |
|
| 1058 | + $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; |
|
| 1059 | 1059 | } else { |
| 1060 | - $sql .= " WHERE f.entity IN (" . getEntity('supplier_invoice') . ')'; |
|
| 1060 | + $sql .= " WHERE f.entity IN (".getEntity('supplier_invoice').')'; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | } else { |
| 1063 | - $sql .= " WHERE f.entity IN (" . getEntity('salary') . ')'; |
|
| 1063 | + $sql .= " WHERE f.entity IN (".getEntity('salary').')'; |
|
| 1064 | 1064 | } |
| 1065 | 1065 | if ($sourcetype != 'salary') { |
| 1066 | 1066 | $sql .= " AND f.fk_statut = 1"; // Invoice validated |
@@ -1074,10 +1074,10 @@ discard block |
||
| 1074 | 1074 | $sql .= " AND pd.traite = 0"; |
| 1075 | 1075 | $sql .= " AND pd.ext_payment_id IS NULL"; |
| 1076 | 1076 | if ($sourcetype != 'salary') { |
| 1077 | - $sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too |
|
| 1077 | + $sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too |
|
| 1078 | 1078 | } |
| 1079 | 1079 | if ($did > 0) { |
| 1080 | - $sql .= " AND pd.rowid = " . ((int) $did); |
|
| 1080 | + $sql .= " AND pd.rowid = ".((int) $did); |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | $resql = $this->db->query($sql); |
@@ -1086,41 +1086,41 @@ discard block |
||
| 1086 | 1086 | $i = 0; |
| 1087 | 1087 | |
| 1088 | 1088 | while ($i < $num) { |
| 1089 | - $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() |
|
| 1089 | + $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() |
|
| 1090 | 1090 | $factures[$i] = $row; // All fields |
| 1091 | 1091 | |
| 1092 | 1092 | if ($row[7] == 0) { |
| 1093 | 1093 | $error++; |
| 1094 | - dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR); |
|
| 1095 | - $this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount"; |
|
| 1094 | + dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR); |
|
| 1095 | + $this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount"; |
|
| 1096 | 1096 | break; |
| 1097 | 1097 | } |
| 1098 | 1098 | $i++; |
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | $this->db->free($resql); |
| 1102 | - dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG); |
|
| 1102 | + dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG); |
|
| 1103 | 1103 | } else { |
| 1104 | 1104 | $error++; |
| 1105 | 1105 | $this->error = $this->db->lasterror(); |
| 1106 | - dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR); |
|
| 1106 | + dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR); |
|
| 1107 | 1107 | return -1; |
| 1108 | 1108 | } |
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | if (!$error) { |
| 1112 | 1112 | // Make some checks |
| 1113 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
|
| 1114 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; |
|
| 1115 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; |
|
| 1116 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; |
|
| 1113 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; |
|
| 1114 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; |
|
| 1115 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; |
|
| 1116 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; |
|
| 1117 | 1117 | |
| 1118 | 1118 | $tmpsoc = new Societe($this->db); |
| 1119 | 1119 | $tmpuser = new User($this->db); |
| 1120 | 1120 | |
| 1121 | 1121 | // Check BAN |
| 1122 | 1122 | $i = 0; |
| 1123 | - dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG); |
|
| 1123 | + dol_syslog(__METHOD__." Check BAN", LOG_DEBUG); |
|
| 1124 | 1124 | |
| 1125 | 1125 | if (count($factures) > 0) { |
| 1126 | 1126 | foreach ($factures as $key => $fac) { |
@@ -1160,31 +1160,31 @@ discard block |
||
| 1160 | 1160 | if ($type != 'bank-transfer') { |
| 1161 | 1161 | $tmpsoc->id = $fac[2]; |
| 1162 | 1162 | $tmpsoc->name = $fac[8]; |
| 1163 | - $invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>"; |
|
| 1164 | - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
| 1165 | - $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
| 1163 | + $invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>"; |
|
| 1164 | + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
| 1165 | + $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
| 1166 | 1166 | $error++; |
| 1167 | 1167 | } |
| 1168 | 1168 | if ($type == 'bank-transfer' && $sourcetype != 'salary') { |
| 1169 | 1169 | $tmpsoc->id = $fac[2]; |
| 1170 | 1170 | $tmpsoc->name = $fac[8]; |
| 1171 | - $invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>"; |
|
| 1172 | - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
| 1173 | - $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0); |
|
| 1171 | + $invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>"; |
|
| 1172 | + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
| 1173 | + $this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0); |
|
| 1174 | 1174 | $error++; |
| 1175 | 1175 | } |
| 1176 | 1176 | if ($type == 'bank-transfer' && $sourcetype == 'salary') { |
| 1177 | 1177 | $tmpuser->id = $fac[2]; |
| 1178 | 1178 | $tmpuser->firstname = $fac[8]; |
| 1179 | - $salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>"; |
|
| 1180 | - $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); |
|
| 1181 | - $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0); |
|
| 1179 | + $salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>"; |
|
| 1180 | + $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0); |
|
| 1181 | + $this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0); |
|
| 1182 | 1182 | $error++; |
| 1183 | 1183 | } |
| 1184 | - dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING); |
|
| 1184 | + dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | } else { |
| 1187 | - dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING); |
|
| 1187 | + dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING); |
|
| 1188 | 1188 | } |
| 1189 | 1189 | /* |
| 1190 | 1190 | } else { |
@@ -1193,14 +1193,14 @@ discard block |
||
| 1193 | 1193 | */ |
| 1194 | 1194 | } |
| 1195 | 1195 | } else { |
| 1196 | - dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING); |
|
| 1196 | + dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING); |
|
| 1197 | 1197 | } |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | $ok = 0; |
| 1201 | 1201 | |
| 1202 | 1202 | // Withdraw invoices in factures_prev array |
| 1203 | - $out = count($factures_prev) . " invoices will be included."; |
|
| 1203 | + $out = count($factures_prev)." invoices will be included."; |
|
| 1204 | 1204 | //print $out."\n"; |
| 1205 | 1205 | dol_syslog($out); |
| 1206 | 1206 | |
@@ -1234,32 +1234,32 @@ discard block |
||
| 1234 | 1234 | * Process order generation |
| 1235 | 1235 | */ |
| 1236 | 1236 | if (!$error) { |
| 1237 | - $ref = substr($year, -2) . $month; |
|
| 1237 | + $ref = substr($year, -2).$month; |
|
| 1238 | 1238 | |
| 1239 | 1239 | // Get next free number for the ref of bon prelevement |
| 1240 | - $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" |
|
| 1241 | - $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons"; |
|
| 1242 | - $sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'"; |
|
| 1243 | - $sql .= " AND entity = " . ((int) $conf->entity); |
|
| 1240 | + $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" |
|
| 1241 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; |
|
| 1242 | + $sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'"; |
|
| 1243 | + $sql .= " AND entity = ".((int) $conf->entity); |
|
| 1244 | 1244 | $sql .= " ORDER BY ref DESC LIMIT 1"; |
| 1245 | 1245 | |
| 1246 | - dol_syslog(get_class($this) . " get next free number", LOG_DEBUG); |
|
| 1246 | + dol_syslog(get_class($this)." get next free number", LOG_DEBUG); |
|
| 1247 | 1247 | $resql = $this->db->query($sql); |
| 1248 | 1248 | |
| 1249 | 1249 | if ($resql) { |
| 1250 | 1250 | $row = $this->db->fetch_row($resql); |
| 1251 | 1251 | |
| 1252 | 1252 | // Build the new ref |
| 1253 | - $ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1)); |
|
| 1253 | + $ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1)); |
|
| 1254 | 1254 | |
| 1255 | 1255 | // $conf->abc->dir_output may be: |
| 1256 | 1256 | // /home/ldestailleur/git/dolibarr_15.0/documents/abc/ |
| 1257 | 1257 | // or |
| 1258 | 1258 | // /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany. |
| 1259 | 1259 | if ($type != 'bank-transfer') { |
| 1260 | - $dir = $conf->prelevement->dir_output . '/receipts'; |
|
| 1260 | + $dir = $conf->prelevement->dir_output.'/receipts'; |
|
| 1261 | 1261 | } else { |
| 1262 | - $dir = $conf->paymentbybanktransfer->dir_output . '/receipts'; |
|
| 1262 | + $dir = $conf->paymentbybanktransfer->dir_output.'/receipts'; |
|
| 1263 | 1263 | } |
| 1264 | 1264 | if (!is_dir($dir)) { |
| 1265 | 1265 | dol_mkdir($dir); |
@@ -1267,41 +1267,41 @@ discard block |
||
| 1267 | 1267 | |
| 1268 | 1268 | if (isModEnabled('multicompany')) { |
| 1269 | 1269 | $labelentity = $conf->entity; |
| 1270 | - $this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml'; |
|
| 1270 | + $this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml'; |
|
| 1271 | 1271 | } else { |
| 1272 | - $this->filename = $dir . '/' . $ref . '.xml'; |
|
| 1272 | + $this->filename = $dir.'/'.$ref.'.xml'; |
|
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | // Create withdraw order in database |
| 1276 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons ("; |
|
| 1276 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; |
|
| 1277 | 1277 | $sql .= "ref, entity, datec, type, fk_bank_account"; |
| 1278 | 1278 | $sql .= ") VALUES ("; |
| 1279 | - $sql .= "'" . $this->db->escape($ref) . "'"; |
|
| 1280 | - $sql .= ", " . ((int) $conf->entity); |
|
| 1281 | - $sql .= ", '" . $this->db->idate($now) . "'"; |
|
| 1282 | - $sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'"; |
|
| 1283 | - $sql .= ", " . ((int) $fk_bank_account); |
|
| 1279 | + $sql .= "'".$this->db->escape($ref)."'"; |
|
| 1280 | + $sql .= ", ".((int) $conf->entity); |
|
| 1281 | + $sql .= ", '".$this->db->idate($now)."'"; |
|
| 1282 | + $sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'"; |
|
| 1283 | + $sql .= ", ".((int) $fk_bank_account); |
|
| 1284 | 1284 | $sql .= ")"; |
| 1285 | 1285 | |
| 1286 | 1286 | $resql = $this->db->query($sql); |
| 1287 | 1287 | |
| 1288 | 1288 | |
| 1289 | 1289 | if ($resql) { |
| 1290 | - $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons"); |
|
| 1290 | + $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); |
|
| 1291 | 1291 | $this->id = $prev_id; |
| 1292 | 1292 | $this->ref = $ref; |
| 1293 | 1293 | } else { |
| 1294 | 1294 | $error++; |
| 1295 | - dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR); |
|
| 1295 | + dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR); |
|
| 1296 | 1296 | } |
| 1297 | 1297 | } else { |
| 1298 | 1298 | $error++; |
| 1299 | - dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR); |
|
| 1299 | + dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR); |
|
| 1300 | 1300 | } |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | if (!$error) { |
| 1304 | - dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande"); |
|
| 1304 | + dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande"); |
|
| 1305 | 1305 | |
| 1306 | 1306 | // Add lines for the bon |
| 1307 | 1307 | if (count($factures_prev) > 0) { |
@@ -1330,17 +1330,17 @@ discard block |
||
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | // Update invoice requests as done |
| 1333 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande"; |
|
| 1333 | + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande"; |
|
| 1334 | 1334 | $sql .= " SET traite = 1"; |
| 1335 | - $sql .= ", date_traite = '" . $this->db->idate($now) . "'"; |
|
| 1336 | - $sql .= ", fk_prelevement_bons = " . ((int) $this->id); |
|
| 1337 | - $sql .= " WHERE rowid = " . ((int) $fac[1]); |
|
| 1335 | + $sql .= ", date_traite = '".$this->db->idate($now)."'"; |
|
| 1336 | + $sql .= ", fk_prelevement_bons = ".((int) $this->id); |
|
| 1337 | + $sql .= " WHERE rowid = ".((int) $fac[1]); |
|
| 1338 | 1338 | |
| 1339 | 1339 | $resql = $this->db->query($sql); |
| 1340 | 1340 | if (!$resql) { |
| 1341 | 1341 | $error++; |
| 1342 | 1342 | $this->errors[] = $this->db->lasterror(); |
| 1343 | - dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR); |
|
| 1343 | + dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR); |
|
| 1344 | 1344 | } |
| 1345 | 1345 | } |
| 1346 | 1346 | } |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file |
| 1352 | 1352 | */ |
| 1353 | 1353 | |
| 1354 | - dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG); |
|
| 1354 | + dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG); |
|
| 1355 | 1355 | |
| 1356 | 1356 | if (count($factures_prev) > 0) { |
| 1357 | 1357 | $this->date_echeance = $datetimeprev; |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | $this->emetteur_iban = $account->iban; |
| 1368 | 1368 | $this->emetteur_bic = $account->bic; |
| 1369 | 1369 | |
| 1370 | - $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456" |
|
| 1370 | + $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456" |
|
| 1371 | 1371 | |
| 1372 | 1372 | $this->raison_sociale = $account->proprio; |
| 1373 | 1373 | } |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | $error++; |
| 1387 | 1387 | } |
| 1388 | 1388 | } |
| 1389 | - dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG); |
|
| 1389 | + dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | 1392 | |
@@ -1394,15 +1394,15 @@ discard block |
||
| 1394 | 1394 | * Update total defined after generation of file |
| 1395 | 1395 | */ |
| 1396 | 1396 | if (!$error) { |
| 1397 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons"; |
|
| 1398 | - $sql .= " SET amount = " . price2num($this->total); |
|
| 1399 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 1400 | - $sql .= " AND entity = " . ((int) $conf->entity); |
|
| 1397 | + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; |
|
| 1398 | + $sql .= " SET amount = ".price2num($this->total); |
|
| 1399 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 1400 | + $sql .= " AND entity = ".((int) $conf->entity); |
|
| 1401 | 1401 | $resql = $this->db->query($sql); |
| 1402 | 1402 | |
| 1403 | 1403 | if (!$resql) { |
| 1404 | 1404 | $error++; |
| 1405 | - dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR); |
|
| 1405 | + dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR); |
|
| 1406 | 1406 | } |
| 1407 | 1407 | } |
| 1408 | 1408 | |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | |
| 1423 | 1423 | if (!$error) { |
| 1424 | 1424 | $this->db->commit(); |
| 1425 | - return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error |
|
| 1425 | + return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error |
|
| 1426 | 1426 | } else { |
| 1427 | 1427 | $this->db->rollback(); |
| 1428 | 1428 | return -1; |
@@ -1461,7 +1461,7 @@ discard block |
||
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | 1463 | if (!$error) { |
| 1464 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id) . ")"; |
|
| 1464 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")"; |
|
| 1465 | 1465 | $resql1 = $this->db->query($sql); |
| 1466 | 1466 | if (!$resql1) { |
| 1467 | 1467 | dol_print_error($this->db); |
@@ -1469,7 +1469,7 @@ discard block |
||
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | 1471 | if (!$error) { |
| 1472 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id); |
|
| 1472 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id); |
|
| 1473 | 1473 | $resql2 = $this->db->query($sql); |
| 1474 | 1474 | if (!$resql2) { |
| 1475 | 1475 | dol_print_error($this->db); |
@@ -1477,7 +1477,7 @@ discard block |
||
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | 1479 | if (!$error) { |
| 1480 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id); |
|
| 1480 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id); |
|
| 1481 | 1481 | $resql3 = $this->db->query($sql); |
| 1482 | 1482 | if (!$resql3) { |
| 1483 | 1483 | dol_print_error($this->db); |
@@ -1485,7 +1485,7 @@ discard block |
||
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | if (!$error) { |
| 1488 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id); |
|
| 1488 | + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id); |
|
| 1489 | 1489 | $resql4 = $this->db->query($sql); |
| 1490 | 1490 | if (!$resql4) { |
| 1491 | 1491 | dol_print_error($this->db); |
@@ -1527,22 +1527,22 @@ discard block |
||
| 1527 | 1527 | $labeltoshow = 'PaymentByBankTransfer'; |
| 1528 | 1528 | } |
| 1529 | 1529 | |
| 1530 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5); |
|
| 1530 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5); |
|
| 1531 | 1531 | $label .= '<br>'; |
| 1532 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1532 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 1533 | 1533 | if (isset($this->amount)) { |
| 1534 | - $label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount); |
|
| 1534 | + $label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount); |
|
| 1535 | 1535 | } |
| 1536 | 1536 | if (isset($this->date_trans)) { |
| 1537 | - $label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel'); |
|
| 1537 | + $label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel'); |
|
| 1538 | 1538 | } |
| 1539 | 1539 | /*if (isset($this->date_credit)) { |
| 1540 | 1540 | $label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel'); |
| 1541 | 1541 | }*/ |
| 1542 | 1542 | |
| 1543 | - $url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id; |
|
| 1543 | + $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; |
|
| 1544 | 1544 | if (!empty($this->type) && $this->type == 'bank-transfer') { |
| 1545 | - $url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id; |
|
| 1545 | + $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; |
|
| 1546 | 1546 | } |
| 1547 | 1547 | |
| 1548 | 1548 | if ($option != 'nolink') { |
@@ -1560,21 +1560,21 @@ discard block |
||
| 1560 | 1560 | if (empty($notooltip)) { |
| 1561 | 1561 | if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
| 1562 | 1562 | $label = $langs->trans("ShowMyObject"); |
| 1563 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 1563 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1564 | 1564 | } |
| 1565 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 1566 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
| 1565 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1566 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 1567 | 1567 | } else { |
| 1568 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
| 1568 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | - $linkstart = '<a href="' . $url . '"'; |
|
| 1572 | - $linkstart .= $linkclose . '>'; |
|
| 1571 | + $linkstart = '<a href="'.$url.'"'; |
|
| 1572 | + $linkstart .= $linkclose.'>'; |
|
| 1573 | 1573 | $linkend = '</a>'; |
| 1574 | 1574 | |
| 1575 | 1575 | $result .= $linkstart; |
| 1576 | 1576 | if ($withpicto) { |
| 1577 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1577 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1578 | 1578 | } |
| 1579 | 1579 | if ($withpicto != 2) { |
| 1580 | 1580 | $result .= $this->ref; |
@@ -1603,8 +1603,8 @@ discard block |
||
| 1603 | 1603 | */ |
| 1604 | 1604 | public function deleteNotificationById($rowid) |
| 1605 | 1605 | { |
| 1606 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def"; |
|
| 1607 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
| 1606 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; |
|
| 1607 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
| 1608 | 1608 | |
| 1609 | 1609 | if ($this->db->query($sql)) { |
| 1610 | 1610 | return 0; |
@@ -1628,8 +1628,8 @@ discard block |
||
| 1628 | 1628 | $userid = $user; |
| 1629 | 1629 | } |
| 1630 | 1630 | |
| 1631 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def"; |
|
| 1632 | - $sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'"; |
|
| 1631 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; |
|
| 1632 | + $sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'"; |
|
| 1633 | 1633 | |
| 1634 | 1634 | if ($this->db->query($sql)) { |
| 1635 | 1635 | return 0; |
@@ -1661,15 +1661,15 @@ discard block |
||
| 1661 | 1661 | if ($this->deleteNotification($user, $action) == 0) { |
| 1662 | 1662 | $now = dol_now(); |
| 1663 | 1663 | |
| 1664 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)"; |
|
| 1665 | - $sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')"; |
|
| 1664 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)"; |
|
| 1665 | + $sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')"; |
|
| 1666 | 1666 | |
| 1667 | - dol_syslog("adnotiff: " . $sql); |
|
| 1667 | + dol_syslog("adnotiff: ".$sql); |
|
| 1668 | 1668 | if ($this->db->query($sql)) { |
| 1669 | 1669 | $result = 0; |
| 1670 | 1670 | } else { |
| 1671 | 1671 | $result = -1; |
| 1672 | - dol_syslog(get_class($this) . "::addNotification Error $result"); |
|
| 1672 | + dol_syslog(get_class($this)."::addNotification Error $result"); |
|
| 1673 | 1673 | } |
| 1674 | 1674 | } |
| 1675 | 1675 | |
@@ -1704,7 +1704,7 @@ discard block |
||
| 1704 | 1704 | |
| 1705 | 1705 | $result = 0; |
| 1706 | 1706 | |
| 1707 | - dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type); |
|
| 1707 | + dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type); |
|
| 1708 | 1708 | |
| 1709 | 1709 | $this->file = fopen($this->filename, "w"); |
| 1710 | 1710 | if ($this->file == false) { |
@@ -1750,13 +1750,13 @@ discard block |
||
| 1750 | 1750 | $sql .= " f.ref as reffac, p.fk_facture as idfac,"; |
| 1751 | 1751 | $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; |
| 1752 | 1752 | $sql .= " FROM"; |
| 1753 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; |
|
| 1754 | - $sql .= " " . MAIN_DB_PREFIX . "facture as f,"; |
|
| 1755 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement as p,"; |
|
| 1756 | - $sql .= " " . MAIN_DB_PREFIX . "societe as soc,"; |
|
| 1757 | - $sql .= " " . MAIN_DB_PREFIX . "c_country as c,"; |
|
| 1758 | - $sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib"; |
|
| 1759 | - $sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id); |
|
| 1753 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; |
|
| 1754 | + $sql .= " ".MAIN_DB_PREFIX."facture as f,"; |
|
| 1755 | + $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; |
|
| 1756 | + $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; |
|
| 1757 | + $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; |
|
| 1758 | + $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; |
|
| 1759 | + $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); |
|
| 1760 | 1760 | $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; |
| 1761 | 1761 | $sql .= " AND p.fk_facture = f.rowid"; |
| 1762 | 1762 | $sql .= " AND f.fk_soc = soc.rowid"; |
@@ -1792,7 +1792,7 @@ discard block |
||
| 1792 | 1792 | $nbtotalDrctDbtTxInf = $i; |
| 1793 | 1793 | } else { |
| 1794 | 1794 | $this->error = $this->db->lasterror(); |
| 1795 | - fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers |
|
| 1795 | + fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers |
|
| 1796 | 1796 | $result = -2; |
| 1797 | 1797 | } |
| 1798 | 1798 | |
@@ -1809,26 +1809,26 @@ discard block |
||
| 1809 | 1809 | * SECTION CREATION SEPA FILE - ISO200022 |
| 1810 | 1810 | */ |
| 1811 | 1811 | // SEPA File Header |
| 1812 | - fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf); |
|
| 1813 | - fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf); |
|
| 1814 | - fwrite($this->file, ' <CstmrDrctDbtInitn>' . $CrLf); |
|
| 1812 | + fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); |
|
| 1813 | + fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf); |
|
| 1814 | + fwrite($this->file, ' <CstmrDrctDbtInitn>'.$CrLf); |
|
| 1815 | 1815 | // SEPA Group header |
| 1816 | - fwrite($this->file, ' <GrpHdr>' . $CrLf); |
|
| 1817 | - fwrite($this->file, ' <MsgId>' . ('DD/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf); |
|
| 1818 | - fwrite($this->file, ' <CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf); |
|
| 1819 | - fwrite($this->file, ' <NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf); |
|
| 1820 | - fwrite($this->file, ' <CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf); |
|
| 1821 | - fwrite($this->file, ' <InitgPty>' . $CrLf); |
|
| 1822 | - fwrite($this->file, ' <Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf); |
|
| 1823 | - fwrite($this->file, ' <Id>' . $CrLf); |
|
| 1824 | - fwrite($this->file, ' <PrvtId>' . $CrLf); |
|
| 1825 | - fwrite($this->file, ' <Othr>' . $CrLf); |
|
| 1826 | - fwrite($this->file, ' <Id>' . $this->emetteur_ics . '</Id>' . $CrLf); |
|
| 1827 | - fwrite($this->file, ' </Othr>' . $CrLf); |
|
| 1828 | - fwrite($this->file, ' </PrvtId>' . $CrLf); |
|
| 1829 | - fwrite($this->file, ' </Id>' . $CrLf); |
|
| 1830 | - fwrite($this->file, ' </InitgPty>' . $CrLf); |
|
| 1831 | - fwrite($this->file, ' </GrpHdr>' . $CrLf); |
|
| 1816 | + fwrite($this->file, ' <GrpHdr>'.$CrLf); |
|
| 1817 | + fwrite($this->file, ' <MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf); |
|
| 1818 | + fwrite($this->file, ' <CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf); |
|
| 1819 | + fwrite($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf); |
|
| 1820 | + fwrite($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf); |
|
| 1821 | + fwrite($this->file, ' <InitgPty>'.$CrLf); |
|
| 1822 | + fwrite($this->file, ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf); |
|
| 1823 | + fwrite($this->file, ' <Id>'.$CrLf); |
|
| 1824 | + fwrite($this->file, ' <PrvtId>'.$CrLf); |
|
| 1825 | + fwrite($this->file, ' <Othr>'.$CrLf); |
|
| 1826 | + fwrite($this->file, ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf); |
|
| 1827 | + fwrite($this->file, ' </Othr>'.$CrLf); |
|
| 1828 | + fwrite($this->file, ' </PrvtId>'.$CrLf); |
|
| 1829 | + fwrite($this->file, ' </Id>'.$CrLf); |
|
| 1830 | + fwrite($this->file, ' </InitgPty>'.$CrLf); |
|
| 1831 | + fwrite($this->file, ' </GrpHdr>'.$CrLf); |
|
| 1832 | 1832 | // SEPA File Emetteur |
| 1833 | 1833 | if ($result != -2) { |
| 1834 | 1834 | fwrite($this->file, $fileEmetteurSection); |
@@ -1838,9 +1838,9 @@ discard block |
||
| 1838 | 1838 | fwrite($this->file, $fileDebiteurSection); |
| 1839 | 1839 | } |
| 1840 | 1840 | // SEPA FILE FOOTER |
| 1841 | - fwrite($this->file, ' </PmtInf>' . $CrLf); |
|
| 1842 | - fwrite($this->file, ' </CstmrDrctDbtInitn>' . $CrLf); |
|
| 1843 | - fwrite($this->file, '</Document>' . $CrLf); |
|
| 1841 | + fwrite($this->file, ' </PmtInf>'.$CrLf); |
|
| 1842 | + fwrite($this->file, ' </CstmrDrctDbtInitn>'.$CrLf); |
|
| 1843 | + fwrite($this->file, '</Document>'.$CrLf); |
|
| 1844 | 1844 | } else { |
| 1845 | 1845 | /** |
| 1846 | 1846 | * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER |
@@ -1872,13 +1872,13 @@ discard block |
||
| 1872 | 1872 | $sql .= " s.ref as reffac, p.fk_salary as idfac,"; |
| 1873 | 1873 | $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum"; |
| 1874 | 1874 | $sql .= " FROM"; |
| 1875 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; |
|
| 1876 | - $sql .= " " . MAIN_DB_PREFIX . "salary as s,"; |
|
| 1877 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement as p,"; |
|
| 1878 | - $sql .= " " . MAIN_DB_PREFIX . "user as u"; |
|
| 1879 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,"; |
|
| 1880 | - $sql .= " " . MAIN_DB_PREFIX . "user_rib as rib"; |
|
| 1881 | - $sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id); |
|
| 1875 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; |
|
| 1876 | + $sql .= " ".MAIN_DB_PREFIX."salary as s,"; |
|
| 1877 | + $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; |
|
| 1878 | + $sql .= " ".MAIN_DB_PREFIX."user as u"; |
|
| 1879 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,"; |
|
| 1880 | + $sql .= " ".MAIN_DB_PREFIX."user_rib as rib"; |
|
| 1881 | + $sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id); |
|
| 1882 | 1882 | $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; |
| 1883 | 1883 | $sql .= " AND p.fk_salary = s.rowid"; |
| 1884 | 1884 | $sql .= " AND s.fk_user = u.rowid"; |
@@ -1889,13 +1889,13 @@ discard block |
||
| 1889 | 1889 | $sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,"; |
| 1890 | 1890 | $sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; |
| 1891 | 1891 | $sql .= " FROM"; |
| 1892 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; |
|
| 1893 | - $sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,"; |
|
| 1894 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement as p,"; |
|
| 1895 | - $sql .= " " . MAIN_DB_PREFIX . "societe as soc"; |
|
| 1896 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,"; |
|
| 1897 | - $sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib"; |
|
| 1898 | - $sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id); |
|
| 1892 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; |
|
| 1893 | + $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; |
|
| 1894 | + $sql .= " ".MAIN_DB_PREFIX."prelevement as p,"; |
|
| 1895 | + $sql .= " ".MAIN_DB_PREFIX."societe as soc"; |
|
| 1896 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,"; |
|
| 1897 | + $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; |
|
| 1898 | + $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); |
|
| 1899 | 1899 | $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; |
| 1900 | 1900 | $sql .= " AND p.fk_facture_fourn = f.rowid"; |
| 1901 | 1901 | $sql .= " AND f.fk_soc = soc.rowid"; |
@@ -1922,7 +1922,7 @@ discard block |
||
| 1922 | 1922 | $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); |
| 1923 | 1923 | $refobj = $obj->reffac; |
| 1924 | 1924 | if (empty($refobj) && !empty($forsalary)) { // If ref of salary not defined, we force a value |
| 1925 | - $refobj = "SAL" . $obj->idfac; |
|
| 1925 | + $refobj = "SAL".$obj->idfac; |
|
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | 1928 | $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); |
@@ -1933,7 +1933,7 @@ discard block |
||
| 1933 | 1933 | $nbtotalDrctDbtTxInf = $i; |
| 1934 | 1934 | } else { |
| 1935 | 1935 | $this->error = $this->db->lasterror(); |
| 1936 | - fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers |
|
| 1936 | + fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers |
|
| 1937 | 1937 | $result = -2; |
| 1938 | 1938 | } |
| 1939 | 1939 | // Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf |
@@ -1949,26 +1949,26 @@ discard block |
||
| 1949 | 1949 | * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022 |
| 1950 | 1950 | */ |
| 1951 | 1951 | // SEPA File Header |
| 1952 | - fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf); |
|
| 1953 | - fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf); |
|
| 1954 | - fwrite($this->file, ' <CstmrCdtTrfInitn>' . $CrLf); |
|
| 1952 | + fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); |
|
| 1953 | + fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf); |
|
| 1954 | + fwrite($this->file, ' <CstmrCdtTrfInitn>'.$CrLf); |
|
| 1955 | 1955 | // SEPA Group header |
| 1956 | - fwrite($this->file, ' <GrpHdr>' . $CrLf); |
|
| 1957 | - fwrite($this->file, ' <MsgId>' . ('TRF/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf); |
|
| 1958 | - fwrite($this->file, ' <CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf); |
|
| 1959 | - fwrite($this->file, ' <NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf); |
|
| 1960 | - fwrite($this->file, ' <CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf); |
|
| 1961 | - fwrite($this->file, ' <InitgPty>' . $CrLf); |
|
| 1962 | - fwrite($this->file, ' <Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf); |
|
| 1963 | - fwrite($this->file, ' <Id>' . $CrLf); |
|
| 1964 | - fwrite($this->file, ' <PrvtId>' . $CrLf); |
|
| 1965 | - fwrite($this->file, ' <Othr>' . $CrLf); |
|
| 1966 | - fwrite($this->file, ' <Id>' . $this->emetteur_ics . '</Id>' . $CrLf); |
|
| 1967 | - fwrite($this->file, ' </Othr>' . $CrLf); |
|
| 1968 | - fwrite($this->file, ' </PrvtId>' . $CrLf); |
|
| 1969 | - fwrite($this->file, ' </Id>' . $CrLf); |
|
| 1970 | - fwrite($this->file, ' </InitgPty>' . $CrLf); |
|
| 1971 | - fwrite($this->file, ' </GrpHdr>' . $CrLf); |
|
| 1956 | + fwrite($this->file, ' <GrpHdr>'.$CrLf); |
|
| 1957 | + fwrite($this->file, ' <MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf); |
|
| 1958 | + fwrite($this->file, ' <CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf); |
|
| 1959 | + fwrite($this->file, ' <NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf); |
|
| 1960 | + fwrite($this->file, ' <CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf); |
|
| 1961 | + fwrite($this->file, ' <InitgPty>'.$CrLf); |
|
| 1962 | + fwrite($this->file, ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf); |
|
| 1963 | + fwrite($this->file, ' <Id>'.$CrLf); |
|
| 1964 | + fwrite($this->file, ' <PrvtId>'.$CrLf); |
|
| 1965 | + fwrite($this->file, ' <Othr>'.$CrLf); |
|
| 1966 | + fwrite($this->file, ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf); |
|
| 1967 | + fwrite($this->file, ' </Othr>'.$CrLf); |
|
| 1968 | + fwrite($this->file, ' </PrvtId>'.$CrLf); |
|
| 1969 | + fwrite($this->file, ' </Id>'.$CrLf); |
|
| 1970 | + fwrite($this->file, ' </InitgPty>'.$CrLf); |
|
| 1971 | + fwrite($this->file, ' </GrpHdr>'.$CrLf); |
|
| 1972 | 1972 | // SEPA File Emetteur (mycompany) |
| 1973 | 1973 | if ($result != -2) { |
| 1974 | 1974 | fwrite($this->file, $fileEmetteurSection); |
@@ -1978,9 +1978,9 @@ discard block |
||
| 1978 | 1978 | fwrite($this->file, $fileCrediteurSection); |
| 1979 | 1979 | } |
| 1980 | 1980 | // SEPA FILE FOOTER |
| 1981 | - fwrite($this->file, ' </PmtInf>' . $CrLf); |
|
| 1982 | - fwrite($this->file, ' </CstmrCdtTrfInitn>' . $CrLf); |
|
| 1983 | - fwrite($this->file, '</Document>' . $CrLf); |
|
| 1981 | + fwrite($this->file, ' </PmtInf>'.$CrLf); |
|
| 1982 | + fwrite($this->file, ' </CstmrCdtTrfInitn>'.$CrLf); |
|
| 1983 | + fwrite($this->file, '</Document>'.$CrLf); |
|
| 1984 | 1984 | } |
| 1985 | 1985 | } |
| 1986 | 1986 | |
@@ -1989,10 +1989,10 @@ discard block |
||
| 1989 | 1989 | if ($type != 'bank-transfer') { |
| 1990 | 1990 | $sql = "SELECT pl.amount"; |
| 1991 | 1991 | $sql .= " FROM"; |
| 1992 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; |
|
| 1993 | - $sql .= " " . MAIN_DB_PREFIX . "facture as f,"; |
|
| 1994 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement as p"; |
|
| 1995 | - $sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id); |
|
| 1992 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; |
|
| 1993 | + $sql .= " ".MAIN_DB_PREFIX."facture as f,"; |
|
| 1994 | + $sql .= " ".MAIN_DB_PREFIX."prelevement as p"; |
|
| 1995 | + $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); |
|
| 1996 | 1996 | $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; |
| 1997 | 1997 | $sql .= " AND p.fk_facture = f.rowid"; |
| 1998 | 1998 | |
@@ -2015,10 +2015,10 @@ discard block |
||
| 2015 | 2015 | } else { |
| 2016 | 2016 | $sql = "SELECT pl.amount"; |
| 2017 | 2017 | $sql .= " FROM"; |
| 2018 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,"; |
|
| 2019 | - $sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,"; |
|
| 2020 | - $sql .= " " . MAIN_DB_PREFIX . "prelevement as p"; |
|
| 2021 | - $sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id); |
|
| 2018 | + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; |
|
| 2019 | + $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; |
|
| 2020 | + $sql .= " ".MAIN_DB_PREFIX."prelevement as p"; |
|
| 2021 | + $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); |
|
| 2022 | 2022 | $sql .= " AND pl.rowid = p.fk_prelevement_lignes"; |
| 2023 | 2023 | $sql .= " AND p.fk_facture_fourn = f.rowid"; |
| 2024 | 2024 | // Lines |
@@ -2067,7 +2067,7 @@ discard block |
||
| 2067 | 2067 | $pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation) |
| 2068 | 2068 | |
| 2069 | 2069 | // 3 char + '-' + 12 + '-' + id + '-' + code Must be lower than 32. |
| 2070 | - return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1); |
|
| 2070 | + return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1); |
|
| 2071 | 2071 | } |
| 2072 | 2072 | |
| 2073 | 2073 | |
@@ -2106,11 +2106,11 @@ discard block |
||
| 2106 | 2106 | |
| 2107 | 2107 | // Raison Sociale Destinataire C2 |
| 2108 | 2108 | |
| 2109 | - fwrite($this->file, substr(strtoupper($client_nom) . " ", 0, 24)); |
|
| 2109 | + fwrite($this->file, substr(strtoupper($client_nom)." ", 0, 24)); |
|
| 2110 | 2110 | |
| 2111 | 2111 | // Address optional D1 |
| 2112 | 2112 | $address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => "")); |
| 2113 | - fwrite($this->file, substr($address . " ", 0, 24)); |
|
| 2113 | + fwrite($this->file, substr($address." ", 0, 24)); |
|
| 2114 | 2114 | |
| 2115 | 2115 | // Zone Reservee D2 |
| 2116 | 2116 | |
@@ -2122,17 +2122,17 @@ discard block |
||
| 2122 | 2122 | |
| 2123 | 2123 | // Numero de compte D4 |
| 2124 | 2124 | |
| 2125 | - fwrite($this->file, substr("000000000000000" . $rib_number, -11)); |
|
| 2125 | + fwrite($this->file, substr("000000000000000".$rib_number, -11)); |
|
| 2126 | 2126 | |
| 2127 | 2127 | // Zone E Montant |
| 2128 | 2128 | |
| 2129 | 2129 | $montant = (round($amount, 2) * 100); |
| 2130 | 2130 | |
| 2131 | - fwrite($this->file, substr("000000000000000" . $montant, -16)); |
|
| 2131 | + fwrite($this->file, substr("000000000000000".$montant, -16)); |
|
| 2132 | 2132 | |
| 2133 | 2133 | // Label F |
| 2134 | 2134 | |
| 2135 | - fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . " ", 0, 31)); |
|
| 2135 | + fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid." ", 0, 31)); |
|
| 2136 | 2136 | |
| 2137 | 2137 | // Code etablissement G1 |
| 2138 | 2138 | |
@@ -2183,7 +2183,7 @@ discard block |
||
| 2183 | 2183 | $row_somme = round((float) $row_somme, 2); |
| 2184 | 2184 | } |
| 2185 | 2185 | |
| 2186 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 2186 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 2187 | 2187 | |
| 2188 | 2188 | $CrLf = "\n"; |
| 2189 | 2189 | $Rowing = sprintf("%010d", $row_idfac); |
@@ -2198,59 +2198,59 @@ discard block |
||
| 2198 | 2198 | if ($type != 'bank-transfer') { |
| 2199 | 2199 | // SEPA Paiement Information of buyer for Direct Debit |
| 2200 | 2200 | $XML_DEBITOR = ''; |
| 2201 | - $XML_DEBITOR .= ' <DrctDbtTxInf>' . $CrLf; |
|
| 2202 | - $XML_DEBITOR .= ' <PmtId>' . $CrLf; |
|
| 2201 | + $XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf; |
|
| 2202 | + $XML_DEBITOR .= ' <PmtId>'.$CrLf; |
|
| 2203 | 2203 | // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) |
| 2204 | - $XML_DEBITOR .= ' <EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters |
|
| 2205 | - $XML_DEBITOR .= ' </PmtId>' . $CrLf; |
|
| 2206 | - $XML_DEBITOR .= ' <InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf; |
|
| 2207 | - $XML_DEBITOR .= ' <DrctDbtTx>' . $CrLf; |
|
| 2208 | - $XML_DEBITOR .= ' <MndtRltdInf>' . $CrLf; |
|
| 2209 | - $XML_DEBITOR .= ' <MndtId>' . $Rum . '</MndtId>' . $CrLf; |
|
| 2210 | - $XML_DEBITOR .= ' <DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf; |
|
| 2211 | - $XML_DEBITOR .= ' <AmdmntInd>false</AmdmntInd>' . $CrLf; |
|
| 2212 | - $XML_DEBITOR .= ' </MndtRltdInf>' . $CrLf; |
|
| 2213 | - $XML_DEBITOR .= ' </DrctDbtTx>' . $CrLf; |
|
| 2214 | - $XML_DEBITOR .= ' <DbtrAgt>' . $CrLf; |
|
| 2215 | - $XML_DEBITOR .= ' <FinInstnId>' . $CrLf; |
|
| 2216 | - $XML_DEBITOR .= ' <BIC>' . $row_bic . '</BIC>' . $CrLf; |
|
| 2217 | - $XML_DEBITOR .= ' </FinInstnId>' . $CrLf; |
|
| 2218 | - $XML_DEBITOR .= ' </DbtrAgt>' . $CrLf; |
|
| 2219 | - $XML_DEBITOR .= ' <Dbtr>' . $CrLf; |
|
| 2220 | - $XML_DEBITOR .= ' <Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf; |
|
| 2221 | - $XML_DEBITOR .= ' <PstlAdr>' . $CrLf; |
|
| 2222 | - $XML_DEBITOR .= ' <Ctry>' . $row_country_code . '</Ctry>' . $CrLf; |
|
| 2204 | + $XML_DEBITOR .= ' <EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters |
|
| 2205 | + $XML_DEBITOR .= ' </PmtId>'.$CrLf; |
|
| 2206 | + $XML_DEBITOR .= ' <InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf; |
|
| 2207 | + $XML_DEBITOR .= ' <DrctDbtTx>'.$CrLf; |
|
| 2208 | + $XML_DEBITOR .= ' <MndtRltdInf>'.$CrLf; |
|
| 2209 | + $XML_DEBITOR .= ' <MndtId>'.$Rum.'</MndtId>'.$CrLf; |
|
| 2210 | + $XML_DEBITOR .= ' <DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf; |
|
| 2211 | + $XML_DEBITOR .= ' <AmdmntInd>false</AmdmntInd>'.$CrLf; |
|
| 2212 | + $XML_DEBITOR .= ' </MndtRltdInf>'.$CrLf; |
|
| 2213 | + $XML_DEBITOR .= ' </DrctDbtTx>'.$CrLf; |
|
| 2214 | + $XML_DEBITOR .= ' <DbtrAgt>'.$CrLf; |
|
| 2215 | + $XML_DEBITOR .= ' <FinInstnId>'.$CrLf; |
|
| 2216 | + $XML_DEBITOR .= ' <BIC>'.$row_bic.'</BIC>'.$CrLf; |
|
| 2217 | + $XML_DEBITOR .= ' </FinInstnId>'.$CrLf; |
|
| 2218 | + $XML_DEBITOR .= ' </DbtrAgt>'.$CrLf; |
|
| 2219 | + $XML_DEBITOR .= ' <Dbtr>'.$CrLf; |
|
| 2220 | + $XML_DEBITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf; |
|
| 2221 | + $XML_DEBITOR .= ' <PstlAdr>'.$CrLf; |
|
| 2222 | + $XML_DEBITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; |
|
| 2223 | 2223 | $addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => "")); |
| 2224 | - $addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => "")); |
|
| 2224 | + $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => "")); |
|
| 2225 | 2225 | if (trim($addressline1)) { |
| 2226 | - $XML_DEBITOR .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2226 | + $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2227 | 2227 | } |
| 2228 | 2228 | if (trim($addressline2)) { |
| 2229 | - $XML_DEBITOR .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2229 | + $XML_DEBITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2230 | 2230 | } |
| 2231 | - $XML_DEBITOR .= ' </PstlAdr>' . $CrLf; |
|
| 2232 | - $XML_DEBITOR .= ' </Dbtr>' . $CrLf; |
|
| 2233 | - $XML_DEBITOR .= ' <DbtrAcct>' . $CrLf; |
|
| 2234 | - $XML_DEBITOR .= ' <Id>' . $CrLf; |
|
| 2235 | - $XML_DEBITOR .= ' <IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf; |
|
| 2236 | - $XML_DEBITOR .= ' </Id>' . $CrLf; |
|
| 2237 | - $XML_DEBITOR .= ' </DbtrAcct>' . $CrLf; |
|
| 2238 | - $XML_DEBITOR .= ' <RmtInf>' . $CrLf; |
|
| 2231 | + $XML_DEBITOR .= ' </PstlAdr>'.$CrLf; |
|
| 2232 | + $XML_DEBITOR .= ' </Dbtr>'.$CrLf; |
|
| 2233 | + $XML_DEBITOR .= ' <DbtrAcct>'.$CrLf; |
|
| 2234 | + $XML_DEBITOR .= ' <Id>'.$CrLf; |
|
| 2235 | + $XML_DEBITOR .= ' <IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf; |
|
| 2236 | + $XML_DEBITOR .= ' </Id>'.$CrLf; |
|
| 2237 | + $XML_DEBITOR .= ' </DbtrAcct>'.$CrLf; |
|
| 2238 | + $XML_DEBITOR .= ' <RmtInf>'.$CrLf; |
|
| 2239 | 2239 | // A string with some information on payment - 140 max |
| 2240 | - $XML_DEBITOR .= ' <Ustrd>' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstuctured data - 140 max |
|
| 2241 | - $XML_DEBITOR .= ' </RmtInf>' . $CrLf; |
|
| 2242 | - $XML_DEBITOR .= ' </DrctDbtTxInf>' . $CrLf; |
|
| 2240 | + $XML_DEBITOR .= ' <Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max |
|
| 2241 | + $XML_DEBITOR .= ' </RmtInf>'.$CrLf; |
|
| 2242 | + $XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf; |
|
| 2243 | 2243 | return $XML_DEBITOR; |
| 2244 | 2244 | } else { |
| 2245 | 2245 | // SEPA Payment Information of seller for Credit Transfer |
| 2246 | 2246 | $XML_CREDITOR = ''; |
| 2247 | - $XML_CREDITOR .= ' <CdtTrfTxInf>' . $CrLf; |
|
| 2248 | - $XML_CREDITOR .= ' <PmtId>' . $CrLf; |
|
| 2247 | + $XML_CREDITOR .= ' <CdtTrfTxInf>'.$CrLf; |
|
| 2248 | + $XML_CREDITOR .= ' <PmtId>'.$CrLf; |
|
| 2249 | 2249 | // Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum) |
| 2250 | - $XML_CREDITOR .= ' <EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters |
|
| 2251 | - $XML_CREDITOR .= ' </PmtId>' . $CrLf; |
|
| 2250 | + $XML_CREDITOR .= ' <EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters |
|
| 2251 | + $XML_CREDITOR .= ' </PmtId>'.$CrLf; |
|
| 2252 | 2252 | if (!empty($this->sepa_xml_pti_in_ctti)) { |
| 2253 | - $XML_CREDITOR .= ' <PmtTpInf>' . $CrLf; |
|
| 2253 | + $XML_CREDITOR .= ' <PmtTpInf>'.$CrLf; |
|
| 2254 | 2254 | |
| 2255 | 2255 | // Can be 'NORM' for normal or 'HIGH' for high priority level |
| 2256 | 2256 | if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) { |
@@ -2258,18 +2258,18 @@ discard block |
||
| 2258 | 2258 | } else { |
| 2259 | 2259 | $instrprty = 'NORM'; |
| 2260 | 2260 | } |
| 2261 | - $XML_CREDITOR .= ' <InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf; |
|
| 2262 | - $XML_CREDITOR .= ' <SvcLvl>' . $CrLf; |
|
| 2263 | - $XML_CREDITOR .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
| 2264 | - $XML_CREDITOR .= ' </SvcLvl>' . $CrLf; |
|
| 2265 | - $XML_CREDITOR .= ' <CtgyPurp>' . $CrLf; |
|
| 2266 | - $XML_CREDITOR .= ' <Cd>CORE</Cd>' . $CrLf; |
|
| 2267 | - $XML_CREDITOR .= ' </CtgyPurp>' . $CrLf; |
|
| 2268 | - $XML_CREDITOR .= ' </PmtTpInf>' . $CrLf; |
|
| 2261 | + $XML_CREDITOR .= ' <InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf; |
|
| 2262 | + $XML_CREDITOR .= ' <SvcLvl>'.$CrLf; |
|
| 2263 | + $XML_CREDITOR .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
| 2264 | + $XML_CREDITOR .= ' </SvcLvl>'.$CrLf; |
|
| 2265 | + $XML_CREDITOR .= ' <CtgyPurp>'.$CrLf; |
|
| 2266 | + $XML_CREDITOR .= ' <Cd>CORE</Cd>'.$CrLf; |
|
| 2267 | + $XML_CREDITOR .= ' </CtgyPurp>'.$CrLf; |
|
| 2268 | + $XML_CREDITOR .= ' </PmtTpInf>'.$CrLf; |
|
| 2269 | 2269 | } |
| 2270 | - $XML_CREDITOR .= ' <Amt>' . $CrLf; |
|
| 2270 | + $XML_CREDITOR .= ' <Amt>'.$CrLf; |
|
| 2271 | 2271 | $XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf; |
| 2272 | - $XML_CREDITOR .= ' </Amt>' . $CrLf; |
|
| 2272 | + $XML_CREDITOR .= ' </Amt>'.$CrLf; |
|
| 2273 | 2273 | /* |
| 2274 | 2274 | $XML_CREDITOR .= ' <DrctDbtTx>'.$CrLf; |
| 2275 | 2275 | $XML_CREDITOR .= ' <MndtRltdInf>'.$CrLf; |
@@ -2280,35 +2280,35 @@ discard block |
||
| 2280 | 2280 | $XML_CREDITOR .= ' </DrctDbtTx>'.$CrLf; |
| 2281 | 2281 | */ |
| 2282 | 2282 | //$XML_CREDITOR .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; |
| 2283 | - $XML_CREDITOR .= ' <CdtrAgt>' . $CrLf; |
|
| 2284 | - $XML_CREDITOR .= ' <FinInstnId>' . $CrLf; |
|
| 2285 | - $XML_CREDITOR .= ' <BIC>' . $row_bic . '</BIC>' . $CrLf; |
|
| 2286 | - $XML_CREDITOR .= ' </FinInstnId>' . $CrLf; |
|
| 2287 | - $XML_CREDITOR .= ' </CdtrAgt>' . $CrLf; |
|
| 2288 | - $XML_CREDITOR .= ' <Cdtr>' . $CrLf; |
|
| 2289 | - $XML_CREDITOR .= ' <Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf; |
|
| 2290 | - $XML_CREDITOR .= ' <PstlAdr>' . $CrLf; |
|
| 2291 | - $XML_CREDITOR .= ' <Ctry>' . $row_country_code . '</Ctry>' . $CrLf; |
|
| 2283 | + $XML_CREDITOR .= ' <CdtrAgt>'.$CrLf; |
|
| 2284 | + $XML_CREDITOR .= ' <FinInstnId>'.$CrLf; |
|
| 2285 | + $XML_CREDITOR .= ' <BIC>'.$row_bic.'</BIC>'.$CrLf; |
|
| 2286 | + $XML_CREDITOR .= ' </FinInstnId>'.$CrLf; |
|
| 2287 | + $XML_CREDITOR .= ' </CdtrAgt>'.$CrLf; |
|
| 2288 | + $XML_CREDITOR .= ' <Cdtr>'.$CrLf; |
|
| 2289 | + $XML_CREDITOR .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf; |
|
| 2290 | + $XML_CREDITOR .= ' <PstlAdr>'.$CrLf; |
|
| 2291 | + $XML_CREDITOR .= ' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf; |
|
| 2292 | 2292 | $addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => "")); |
| 2293 | - $addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => "")); |
|
| 2293 | + $addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => "")); |
|
| 2294 | 2294 | if (trim($addressline1)) { |
| 2295 | - $XML_CREDITOR .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2295 | + $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2296 | 2296 | } |
| 2297 | 2297 | if (trim($addressline2)) { |
| 2298 | - $XML_CREDITOR .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2298 | + $XML_CREDITOR .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2299 | 2299 | } |
| 2300 | - $XML_CREDITOR .= ' </PstlAdr>' . $CrLf; |
|
| 2301 | - $XML_CREDITOR .= ' </Cdtr>' . $CrLf; |
|
| 2302 | - $XML_CREDITOR .= ' <CdtrAcct>' . $CrLf; |
|
| 2303 | - $XML_CREDITOR .= ' <Id>' . $CrLf; |
|
| 2304 | - $XML_CREDITOR .= ' <IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf; |
|
| 2305 | - $XML_CREDITOR .= ' </Id>' . $CrLf; |
|
| 2306 | - $XML_CREDITOR .= ' </CdtrAcct>' . $CrLf; |
|
| 2307 | - $XML_CREDITOR .= ' <RmtInf>' . $CrLf; |
|
| 2300 | + $XML_CREDITOR .= ' </PstlAdr>'.$CrLf; |
|
| 2301 | + $XML_CREDITOR .= ' </Cdtr>'.$CrLf; |
|
| 2302 | + $XML_CREDITOR .= ' <CdtrAcct>'.$CrLf; |
|
| 2303 | + $XML_CREDITOR .= ' <Id>'.$CrLf; |
|
| 2304 | + $XML_CREDITOR .= ' <IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf; |
|
| 2305 | + $XML_CREDITOR .= ' </Id>'.$CrLf; |
|
| 2306 | + $XML_CREDITOR .= ' </CdtrAcct>'.$CrLf; |
|
| 2307 | + $XML_CREDITOR .= ' <RmtInf>'.$CrLf; |
|
| 2308 | 2308 | // A string with some information on payment - 140 max |
| 2309 | - $XML_CREDITOR .= ' <Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max |
|
| 2310 | - $XML_CREDITOR .= ' </RmtInf>' . $CrLf; |
|
| 2311 | - $XML_CREDITOR .= ' </CdtTrfTxInf>' . $CrLf; |
|
| 2309 | + $XML_CREDITOR .= ' <Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max |
|
| 2310 | + $XML_CREDITOR .= ' </RmtInf>'.$CrLf; |
|
| 2311 | + $XML_CREDITOR .= ' </CdtTrfTxInf>'.$CrLf; |
|
| 2312 | 2312 | return $XML_CREDITOR; |
| 2313 | 2313 | } |
| 2314 | 2314 | } |
@@ -2340,11 +2340,11 @@ discard block |
||
| 2340 | 2340 | |
| 2341 | 2341 | // Raison Sociale C2 |
| 2342 | 2342 | |
| 2343 | - fwrite($this->file, substr($this->raison_sociale . " ", 0, 24)); |
|
| 2343 | + fwrite($this->file, substr($this->raison_sociale." ", 0, 24)); |
|
| 2344 | 2344 | |
| 2345 | 2345 | // Ref of thirdparty on 7 characters |
| 2346 | 2346 | |
| 2347 | - fwrite($this->file, substr($this->reference_remise . " ", 0, 7)); |
|
| 2347 | + fwrite($this->file, substr($this->reference_remise." ", 0, 7)); |
|
| 2348 | 2348 | |
| 2349 | 2349 | // Zone Reservee D1-2 |
| 2350 | 2350 | |
@@ -2362,7 +2362,7 @@ discard block |
||
| 2362 | 2362 | |
| 2363 | 2363 | // Numero de compte D4 |
| 2364 | 2364 | |
| 2365 | - fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11)); |
|
| 2365 | + fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11)); |
|
| 2366 | 2366 | |
| 2367 | 2367 | // Zone Reservee E |
| 2368 | 2368 | |
@@ -2425,15 +2425,15 @@ discard block |
||
| 2425 | 2425 | $this->emetteur_iban = $account->iban; |
| 2426 | 2426 | $this->emetteur_bic = $account->bic; |
| 2427 | 2427 | |
| 2428 | - $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; |
|
| 2428 | + $this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; |
|
| 2429 | 2429 | |
| 2430 | 2430 | $this->raison_sociale = $account->proprio; |
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | 2433 | // Get pending payments |
| 2434 | 2434 | $sql = "SELECT rowid, ref"; |
| 2435 | - $sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb"; |
|
| 2436 | - $sql .= " WHERE pb.rowid = " . ((int) $this->id); |
|
| 2435 | + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb"; |
|
| 2436 | + $sql .= " WHERE pb.rowid = ".((int) $this->id); |
|
| 2437 | 2437 | |
| 2438 | 2438 | $resql = $this->db->query($sql); |
| 2439 | 2439 | if ($resql) { |
@@ -2450,45 +2450,45 @@ discard block |
||
| 2450 | 2450 | if ($type != 'bank-transfer') { |
| 2451 | 2451 | // SEPA Paiement Information of my company for Direct Debit |
| 2452 | 2452 | $XML_SEPA_INFO = ''; |
| 2453 | - $XML_SEPA_INFO .= ' <PmtInf>' . $CrLf; |
|
| 2454 | - $XML_SEPA_INFO .= ' <PmtInfId>' . ('DD/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf; |
|
| 2455 | - $XML_SEPA_INFO .= ' <PmtMtd>DD</PmtMtd>' . $CrLf; |
|
| 2456 | - $XML_SEPA_INFO .= ' <NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf; |
|
| 2457 | - $XML_SEPA_INFO .= ' <CtrlSum>' . $total . '</CtrlSum>' . $CrLf; |
|
| 2458 | - $XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf; |
|
| 2459 | - $XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf; |
|
| 2460 | - $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
| 2461 | - $XML_SEPA_INFO .= ' </SvcLvl>' . $CrLf; |
|
| 2462 | - $XML_SEPA_INFO .= ' <LclInstrm>' . $CrLf; |
|
| 2463 | - $XML_SEPA_INFO .= ' <Cd>CORE</Cd>' . $CrLf; |
|
| 2464 | - $XML_SEPA_INFO .= ' </LclInstrm>' . $CrLf; |
|
| 2465 | - $XML_SEPA_INFO .= ' <SeqTp>' . $format . '</SeqTp>' . $CrLf; |
|
| 2466 | - $XML_SEPA_INFO .= ' </PmtTpInf>' . $CrLf; |
|
| 2467 | - $XML_SEPA_INFO .= ' <ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf; |
|
| 2468 | - $XML_SEPA_INFO .= ' <Cdtr>' . $CrLf; |
|
| 2469 | - $XML_SEPA_INFO .= ' <Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf; |
|
| 2470 | - $XML_SEPA_INFO .= ' <PstlAdr>' . $CrLf; |
|
| 2471 | - $XML_SEPA_INFO .= ' <Ctry>' . $country[1] . '</Ctry>' . $CrLf; |
|
| 2453 | + $XML_SEPA_INFO .= ' <PmtInf>'.$CrLf; |
|
| 2454 | + $XML_SEPA_INFO .= ' <PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf; |
|
| 2455 | + $XML_SEPA_INFO .= ' <PmtMtd>DD</PmtMtd>'.$CrLf; |
|
| 2456 | + $XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf; |
|
| 2457 | + $XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf; |
|
| 2458 | + $XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf; |
|
| 2459 | + $XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf; |
|
| 2460 | + $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
| 2461 | + $XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf; |
|
| 2462 | + $XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf; |
|
| 2463 | + $XML_SEPA_INFO .= ' <Cd>CORE</Cd>'.$CrLf; |
|
| 2464 | + $XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf; |
|
| 2465 | + $XML_SEPA_INFO .= ' <SeqTp>'.$format.'</SeqTp>'.$CrLf; |
|
| 2466 | + $XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf; |
|
| 2467 | + $XML_SEPA_INFO .= ' <ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf; |
|
| 2468 | + $XML_SEPA_INFO .= ' <Cdtr>'.$CrLf; |
|
| 2469 | + $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf; |
|
| 2470 | + $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; |
|
| 2471 | + $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; |
|
| 2472 | 2472 | $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => "")); |
| 2473 | - $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => "")); |
|
| 2473 | + $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => "")); |
|
| 2474 | 2474 | if ($addressline1) { |
| 2475 | - $XML_SEPA_INFO .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2475 | + $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2476 | 2476 | } |
| 2477 | 2477 | if ($addressline2) { |
| 2478 | - $XML_SEPA_INFO .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2478 | + $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2479 | 2479 | } |
| 2480 | - $XML_SEPA_INFO .= ' </PstlAdr>' . $CrLf; |
|
| 2481 | - $XML_SEPA_INFO .= ' </Cdtr>' . $CrLf; |
|
| 2482 | - $XML_SEPA_INFO .= ' <CdtrAcct>' . $CrLf; |
|
| 2483 | - $XML_SEPA_INFO .= ' <Id>' . $CrLf; |
|
| 2484 | - $XML_SEPA_INFO .= ' <IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf; |
|
| 2485 | - $XML_SEPA_INFO .= ' </Id>' . $CrLf; |
|
| 2486 | - $XML_SEPA_INFO .= ' </CdtrAcct>' . $CrLf; |
|
| 2487 | - $XML_SEPA_INFO .= ' <CdtrAgt>' . $CrLf; |
|
| 2488 | - $XML_SEPA_INFO .= ' <FinInstnId>' . $CrLf; |
|
| 2489 | - $XML_SEPA_INFO .= ' <BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf; |
|
| 2490 | - $XML_SEPA_INFO .= ' </FinInstnId>' . $CrLf; |
|
| 2491 | - $XML_SEPA_INFO .= ' </CdtrAgt>' . $CrLf; |
|
| 2480 | + $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; |
|
| 2481 | + $XML_SEPA_INFO .= ' </Cdtr>'.$CrLf; |
|
| 2482 | + $XML_SEPA_INFO .= ' <CdtrAcct>'.$CrLf; |
|
| 2483 | + $XML_SEPA_INFO .= ' <Id>'.$CrLf; |
|
| 2484 | + $XML_SEPA_INFO .= ' <IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf; |
|
| 2485 | + $XML_SEPA_INFO .= ' </Id>'.$CrLf; |
|
| 2486 | + $XML_SEPA_INFO .= ' </CdtrAcct>'.$CrLf; |
|
| 2487 | + $XML_SEPA_INFO .= ' <CdtrAgt>'.$CrLf; |
|
| 2488 | + $XML_SEPA_INFO .= ' <FinInstnId>'.$CrLf; |
|
| 2489 | + $XML_SEPA_INFO .= ' <BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf; |
|
| 2490 | + $XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf; |
|
| 2491 | + $XML_SEPA_INFO .= ' </CdtrAgt>'.$CrLf; |
|
| 2492 | 2492 | /* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf; |
| 2493 | 2493 | $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf; |
| 2494 | 2494 | $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; |
@@ -2497,64 +2497,64 @@ discard block |
||
| 2497 | 2497 | $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
| 2498 | 2498 | $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; |
| 2499 | 2499 | $XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/ |
| 2500 | - $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV |
|
| 2501 | - $XML_SEPA_INFO .= ' <CdtrSchmeId>' . $CrLf; |
|
| 2502 | - $XML_SEPA_INFO .= ' <Id>' . $CrLf; |
|
| 2503 | - $XML_SEPA_INFO .= ' <PrvtId>' . $CrLf; |
|
| 2504 | - $XML_SEPA_INFO .= ' <Othr>' . $CrLf; |
|
| 2505 | - $XML_SEPA_INFO .= ' <Id>' . $this->emetteur_ics . '</Id>' . $CrLf; |
|
| 2506 | - $XML_SEPA_INFO .= ' <SchmeNm>' . $CrLf; |
|
| 2507 | - $XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>' . $CrLf; |
|
| 2508 | - $XML_SEPA_INFO .= ' </SchmeNm>' . $CrLf; |
|
| 2509 | - $XML_SEPA_INFO .= ' </Othr>' . $CrLf; |
|
| 2510 | - $XML_SEPA_INFO .= ' </PrvtId>' . $CrLf; |
|
| 2511 | - $XML_SEPA_INFO .= ' </Id>' . $CrLf; |
|
| 2512 | - $XML_SEPA_INFO .= ' </CdtrSchmeId>' . $CrLf; |
|
| 2500 | + $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV |
|
| 2501 | + $XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf; |
|
| 2502 | + $XML_SEPA_INFO .= ' <Id>'.$CrLf; |
|
| 2503 | + $XML_SEPA_INFO .= ' <PrvtId>'.$CrLf; |
|
| 2504 | + $XML_SEPA_INFO .= ' <Othr>'.$CrLf; |
|
| 2505 | + $XML_SEPA_INFO .= ' <Id>'.$this->emetteur_ics.'</Id>'.$CrLf; |
|
| 2506 | + $XML_SEPA_INFO .= ' <SchmeNm>'.$CrLf; |
|
| 2507 | + $XML_SEPA_INFO .= ' <Prtry>SEPA</Prtry>'.$CrLf; |
|
| 2508 | + $XML_SEPA_INFO .= ' </SchmeNm>'.$CrLf; |
|
| 2509 | + $XML_SEPA_INFO .= ' </Othr>'.$CrLf; |
|
| 2510 | + $XML_SEPA_INFO .= ' </PrvtId>'.$CrLf; |
|
| 2511 | + $XML_SEPA_INFO .= ' </Id>'.$CrLf; |
|
| 2512 | + $XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf; |
|
| 2513 | 2513 | } else { |
| 2514 | 2514 | // SEPA Paiement Information of my company for Credit Transfer |
| 2515 | 2515 | $XML_SEPA_INFO = ''; |
| 2516 | - $XML_SEPA_INFO .= ' <PmtInf>' . $CrLf; |
|
| 2517 | - $XML_SEPA_INFO .= ' <PmtInfId>' . ('TRF/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf; |
|
| 2518 | - $XML_SEPA_INFO .= ' <PmtMtd>TRF</PmtMtd>' . $CrLf; |
|
| 2516 | + $XML_SEPA_INFO .= ' <PmtInf>'.$CrLf; |
|
| 2517 | + $XML_SEPA_INFO .= ' <PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf; |
|
| 2518 | + $XML_SEPA_INFO .= ' <PmtMtd>TRF</PmtMtd>'.$CrLf; |
|
| 2519 | 2519 | //$XML_SEPA_INFO .= ' <BtchBookg>False</BtchBookg>'.$CrLf; |
| 2520 | - $XML_SEPA_INFO .= ' <NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf; |
|
| 2521 | - $XML_SEPA_INFO .= ' <CtrlSum>' . $total . '</CtrlSum>' . $CrLf; |
|
| 2520 | + $XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf; |
|
| 2521 | + $XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf; |
|
| 2522 | 2522 | if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange. |
| 2523 | - $XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf; |
|
| 2524 | - $XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf; |
|
| 2525 | - $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
| 2526 | - $XML_SEPA_INFO .= ' </SvcLvl>' . $CrLf; |
|
| 2527 | - $XML_SEPA_INFO .= ' <LclInstrm>' . $CrLf; |
|
| 2528 | - $XML_SEPA_INFO .= ' <Cd>CORE</Cd>' . $CrLf; |
|
| 2529 | - $XML_SEPA_INFO .= ' </LclInstrm>' . $CrLf; |
|
| 2530 | - $XML_SEPA_INFO .= ' <SeqTp>' . $format . '</SeqTp>' . $CrLf; |
|
| 2531 | - $XML_SEPA_INFO .= ' </PmtTpInf>' . $CrLf; |
|
| 2523 | + $XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf; |
|
| 2524 | + $XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf; |
|
| 2525 | + $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
| 2526 | + $XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf; |
|
| 2527 | + $XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf; |
|
| 2528 | + $XML_SEPA_INFO .= ' <Cd>CORE</Cd>'.$CrLf; |
|
| 2529 | + $XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf; |
|
| 2530 | + $XML_SEPA_INFO .= ' <SeqTp>'.$format.'</SeqTp>'.$CrLf; |
|
| 2531 | + $XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf; |
|
| 2532 | 2532 | } |
| 2533 | - $XML_SEPA_INFO .= ' <ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf; |
|
| 2534 | - $XML_SEPA_INFO .= ' <Dbtr>' . $CrLf; |
|
| 2535 | - $XML_SEPA_INFO .= ' <Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf; |
|
| 2536 | - $XML_SEPA_INFO .= ' <PstlAdr>' . $CrLf; |
|
| 2537 | - $XML_SEPA_INFO .= ' <Ctry>' . $country[1] . '</Ctry>' . $CrLf; |
|
| 2533 | + $XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf; |
|
| 2534 | + $XML_SEPA_INFO .= ' <Dbtr>'.$CrLf; |
|
| 2535 | + $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf; |
|
| 2536 | + $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; |
|
| 2537 | + $XML_SEPA_INFO .= ' <Ctry>'.$country[1].'</Ctry>'.$CrLf; |
|
| 2538 | 2538 | $addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => "")); |
| 2539 | - $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => "")); |
|
| 2539 | + $addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => "")); |
|
| 2540 | 2540 | if ($addressline1) { |
| 2541 | - $XML_SEPA_INFO .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2541 | + $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2542 | 2542 | } |
| 2543 | 2543 | if ($addressline2) { |
| 2544 | - $XML_SEPA_INFO .= ' <AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf; |
|
| 2544 | + $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
|
| 2545 | 2545 | } |
| 2546 | - $XML_SEPA_INFO .= ' </PstlAdr>' . $CrLf; |
|
| 2547 | - $XML_SEPA_INFO .= ' </Dbtr>' . $CrLf; |
|
| 2548 | - $XML_SEPA_INFO .= ' <DbtrAcct>' . $CrLf; |
|
| 2549 | - $XML_SEPA_INFO .= ' <Id>' . $CrLf; |
|
| 2550 | - $XML_SEPA_INFO .= ' <IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf; |
|
| 2551 | - $XML_SEPA_INFO .= ' </Id>' . $CrLf; |
|
| 2552 | - $XML_SEPA_INFO .= ' </DbtrAcct>' . $CrLf; |
|
| 2553 | - $XML_SEPA_INFO .= ' <DbtrAgt>' . $CrLf; |
|
| 2554 | - $XML_SEPA_INFO .= ' <FinInstnId>' . $CrLf; |
|
| 2555 | - $XML_SEPA_INFO .= ' <BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf; |
|
| 2556 | - $XML_SEPA_INFO .= ' </FinInstnId>' . $CrLf; |
|
| 2557 | - $XML_SEPA_INFO .= ' </DbtrAgt>' . $CrLf; |
|
| 2546 | + $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; |
|
| 2547 | + $XML_SEPA_INFO .= ' </Dbtr>'.$CrLf; |
|
| 2548 | + $XML_SEPA_INFO .= ' <DbtrAcct>'.$CrLf; |
|
| 2549 | + $XML_SEPA_INFO .= ' <Id>'.$CrLf; |
|
| 2550 | + $XML_SEPA_INFO .= ' <IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf; |
|
| 2551 | + $XML_SEPA_INFO .= ' </Id>'.$CrLf; |
|
| 2552 | + $XML_SEPA_INFO .= ' </DbtrAcct>'.$CrLf; |
|
| 2553 | + $XML_SEPA_INFO .= ' <DbtrAgt>'.$CrLf; |
|
| 2554 | + $XML_SEPA_INFO .= ' <FinInstnId>'.$CrLf; |
|
| 2555 | + $XML_SEPA_INFO .= ' <BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf; |
|
| 2556 | + $XML_SEPA_INFO .= ' </FinInstnId>'.$CrLf; |
|
| 2557 | + $XML_SEPA_INFO .= ' </DbtrAgt>'.$CrLf; |
|
| 2558 | 2558 | /* $XML_SEPA_INFO .= ' <UltmtCdtr>'.$CrLf; |
| 2559 | 2559 | $XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf; |
| 2560 | 2560 | $XML_SEPA_INFO .= ' <PstlAdr>'.$CrLf; |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | $XML_SEPA_INFO .= ' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf; |
| 2564 | 2564 | $XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf; |
| 2565 | 2565 | $XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/ |
| 2566 | - $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV |
|
| 2566 | + $XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV |
|
| 2567 | 2567 | /*$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf; |
| 2568 | 2568 | $XML_SEPA_INFO .= ' <Id>'.$CrLf; |
| 2569 | 2569 | $XML_SEPA_INFO .= ' <PrvtId>'.$CrLf; |
@@ -2578,7 +2578,7 @@ discard block |
||
| 2578 | 2578 | $XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/ |
| 2579 | 2579 | } |
| 2580 | 2580 | } else { |
| 2581 | - fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf); |
|
| 2581 | + fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf); |
|
| 2582 | 2582 | $XML_SEPA_INFO = ''; |
| 2583 | 2583 | } |
| 2584 | 2584 | return $XML_SEPA_INFO; |
@@ -2630,7 +2630,7 @@ discard block |
||
| 2630 | 2630 | |
| 2631 | 2631 | $montant = ($total * 100); |
| 2632 | 2632 | |
| 2633 | - fwrite($this->file, substr("000000000000000" . $montant, -16)); |
|
| 2633 | + fwrite($this->file, substr("000000000000000".$montant, -16)); |
|
| 2634 | 2634 | |
| 2635 | 2635 | // Zone Reservee F |
| 2636 | 2636 | |
@@ -2787,18 +2787,18 @@ discard block |
||
| 2787 | 2787 | $return .= img_picto('', $this->picto); |
| 2788 | 2788 | $return .= '</span>'; |
| 2789 | 2789 | $return .= '<div class="info-box-content">'; |
| 2790 | - $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>'; |
|
| 2790 | + $return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>'; |
|
| 2791 | 2791 | if ($selected >= 0) { |
| 2792 | - $return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>'; |
|
| 2792 | + $return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>'; |
|
| 2793 | 2793 | } |
| 2794 | 2794 | if (property_exists($this, 'date_echeance')) { |
| 2795 | - $return .= '<br><span class="opacitymedium">' . $langs->trans("Date") . '</span> : <span class="info-box-label">' . dol_print_date($this->db->jdate($this->date_echeance), 'day') . '</span>'; |
|
| 2795 | + $return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>'; |
|
| 2796 | 2796 | } |
| 2797 | 2797 | if (property_exists($this, 'total')) { |
| 2798 | - $return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>'; |
|
| 2798 | + $return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>'; |
|
| 2799 | 2799 | } |
| 2800 | 2800 | if (method_exists($this, 'LibStatut')) { |
| 2801 | - $return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>'; |
|
| 2801 | + $return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>'; |
|
| 2802 | 2802 | } |
| 2803 | 2803 | $return .= '</div>'; |
| 2804 | 2804 | $return .= '</div>'; |
@@ -2819,9 +2819,9 @@ discard block |
||
| 2819 | 2819 | return 0; |
| 2820 | 2820 | } |
| 2821 | 2821 | if ($id) { |
| 2822 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes"; |
|
| 2823 | - $sql .= " WHERE fk_prelevement_bons = " . ((int) $id); |
|
| 2824 | - $sql .= " AND fk_soc = 0"; // fk_soc can't be NULL |
|
| 2822 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes"; |
|
| 2823 | + $sql .= " WHERE fk_prelevement_bons = ".((int) $id); |
|
| 2824 | + $sql .= " AND fk_soc = 0"; // fk_soc can't be NULL |
|
| 2825 | 2825 | $sql .= " AND fk_user IS NOT NULL"; |
| 2826 | 2826 | |
| 2827 | 2827 | $num = 0; |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Extra fields |
| 155 | -include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php'; |
|
| 155 | +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; |
|
| 156 | 156 | |
| 157 | 157 | $object->fields = dol_sort_array($object->fields, 'position'); |
| 158 | 158 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
| 159 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 159 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 160 | 160 | |
| 161 | 161 | // Init search fields |
| 162 | 162 | $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | if ($searchCategoryUserOperator == 0) { |
| 476 | 476 | $searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).")"; |
| 477 | 477 | } else { |
| 478 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryUser); |
|
| 478 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryUser); |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | } |
| 997 | 997 | |
| 998 | 998 | if (empty($obj->country_code)) { |
| 999 | - $obj->country_code = ''; // TODO Add join in select with country table to get country_code |
|
| 999 | + $obj->country_code = ''; // TODO Add join in select with country table to get country_code |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | // Store properties in $object |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | if ($api_key) { |
| 1203 | 1203 | if ($canreadsecretapi) { |
| 1204 | 1204 | print '<span class="opacitymedium">'; |
| 1205 | - print showValueWithClipboardCPButton($object->api_key, 1, dol_trunc($api_key, 3)); // TODO Add an option to also reveal the hash, not only copy paste |
|
| 1205 | + print showValueWithClipboardCPButton($object->api_key, 1, dol_trunc($api_key, 3)); // TODO Add an option to also reveal the hash, not only copy paste |
|
| 1206 | 1206 | print '</span>'; |
| 1207 | 1207 | } else { |
| 1208 | 1208 | print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>'; |