dolibarr 22.0.5
mod_payment_ant.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 * or see https://www.gnu.org/
18 */
19
26require_once DOL_DOCUMENT_ROOT.'/core/modules/payment/modules_payment.php';
27
28
33{
38 public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
39
43 public $error = '';
44
50 public $nom = 'Ant';
51
55 public $name = 'Ant';
56
60 public $position = 50;
61
62
69 public function info($langs)
70 {
71 global $db, $langs;
72
73 $langs->load("bills");
74
75 $form = new Form($db);
76
77 $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
78 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
79 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
80 $texte .= '<input type="hidden" name="action" value="updateMask">';
81 $texte .= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
82 $texte .= '<input type="hidden" name="page_y" value="">';
83
84 $texte .= '<table class="nobordernopadding centpercent">';
85
86 $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
87 $tooltip .= $langs->trans("GenericMaskCodes1");
88 $tooltip .= '<br>';
89 $tooltip .= $langs->trans("GenericMaskCodes2");
90 $tooltip .= '<br>';
91 $tooltip .= $langs->trans("GenericMaskCodes3");
92 $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
93 $tooltip .= $langs->trans("GenericMaskCodes5");
94 //$tooltip .= '<br>'.$langs->trans("GenericMaskCodes5b");
95
96 // Parametrage du prefix
97 $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
98 $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskpayment" value="'.getDolGlobalString('PAYMENT_ANT_MASK').'">', $tooltip, 1, 'help', 'valignmiddle', 0, 3, $this->name).'</td>';
99
100 $texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button" value="'.$langs->trans("Save").'"></td>';
101
102 $texte .= '</tr>';
103
104 $texte .= '</table>';
105 $texte .= '</form>';
106
107 return $texte;
108 }
109
115 public function getExample()
116 {
117 global $mysoc;
118
119 $old_code_client = $mysoc->code_client;
120 $mysoc->code_client = 'CCCCCCCCCC';
121 $numExample = $this->getNextValue($mysoc, null);
122 $mysoc->code_client = $old_code_client;
123
124 if (!$numExample) {
125 $numExample = 'NotConfigured';
126 }
127 return $numExample;
128 }
129
137 public function getNextValue($objsoc, $object)
138 {
139 global $db;
140
141 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
142
143 // We get cursor rule
144 $mask = getDolGlobalString('PAYMENT_ANT_MASK');
145
146 if (!$mask) {
147 $this->error = 'NotConfigured';
148 return 0;
149 }
150
151 $numFinal = get_next_value($db, $mask, 'paiement', 'ref', '', $objsoc, $object->datepaye);
152
153 return $numFinal;
154 }
155
156
157 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
165 public function commande_get_num($objsoc, $objforref)
166 {
167 // phpcs:enable
168 return $this->getNextValue($objsoc, $objforref);
169 }
170}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
Class to manage generation of HTML components Only common components must be here.
Payment numbering references mother class.
Class to manage customer payment numbering rules Ant.
info($langs)
Returns the description of the numbering model.
getNextValue($objsoc, $object)
Return next free value.
commande_get_num($objsoc, $objforref)
Return next free value.
getExample()
Return an example of numbering.
get_next_value($db, $mask, $table, $field, $where='', $objsoc='', $date='', $mode='next', $bentityon=true, $objuser=null, $forceentity=null, $objbookkeeping=null)
Return last or next value for a mask (according to area we should not reset)
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:161