dolibarr 24.0.0-beta
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 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 * or see https://www.gnu.org/
19 */
20
27require_once DOL_DOCUMENT_ROOT.'/core/modules/payment/modules_payment.php';
28
29
34{
39 public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
40
44 public $error = '';
45
51 public $nom = 'Ant';
52
56 public $name = 'Ant';
57
61 public $position = 50;
62
63
70 public function info($langs)
71 {
72 global $db, $langs;
73
74 $langs->load("bills");
75
76 $form = new Form($db);
77
78 $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
79 $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
80 $texte .= '<input type="hidden" name="token" value="'.newToken().'">';
81 $texte .= '<input type="hidden" name="action" value="updateMask">';
82 $texte .= '<input type="hidden" name="maskconstpayment" value="PAYMENT_ANT_MASK">';
83 $texte .= '<input type="hidden" name="page_y" value="">';
84
85 $texte .= '<table class="nobordernopadding centpercent">';
86
87 $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
88 $tooltip .= $langs->trans("GenericMaskCodes1");
89 $tooltip .= '<br>';
90 $tooltip .= $langs->trans("GenericMaskCodes2");
91 $tooltip .= '<br>';
92 $tooltip .= $langs->trans("GenericMaskCodes3");
93 $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Order"), $langs->transnoentities("Order"));
94 $tooltip .= $langs->trans("GenericMaskCodes5");
95 //$tooltip .= '<br>'.$langs->trans("GenericMaskCodes5b");
96
97 // Setting of prefix
98 $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
99 $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>';
100
101 $texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit reposition smallpaddingimp" name="Button" value="'.$langs->trans("Save").'"></td>';
102
103 $texte .= '</tr>';
104
105 $texte .= '</table>';
106 $texte .= '</form>';
107
108 return $texte;
109 }
110
116 public function getExample()
117 {
118 global $mysoc;
119
120 $old_code_client = $mysoc->code_client;
121 $mysoc->code_client = 'CCCCCCCCCC';
122 $numExample = $this->getNextValue($mysoc, null);
123 $mysoc->code_client = $old_code_client;
124
125 if (!$numExample) {
126 $numExample = 'NotConfigured';
127 }
128 return $numExample;
129 }
130
138 public function getNextValue($objsoc, $object)
139 {
140 global $db;
141
142 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
143
144 // We get cursor rule
145 $mask = getDolGlobalString('PAYMENT_ANT_MASK');
146
147 if (!$mask) {
148 $this->error = 'NotConfigured';
149 return 0;
150 }
151
152 $numFinal = get_next_value($db, $mask, 'paiement', 'ref', '', $objsoc, $object->datepaye);
153
154 return $numFinal;
155 }
156
157
158 // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
166 public function commande_get_num($objsoc, $objforref)
167 {
168 // phpcs:enable
169 return $this->getNextValue($objsoc, $objforref);
170 }
171}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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:133