29require_once DOL_DOCUMENT_ROOT.
'/core/class/commondocgenerator.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/commonnumrefgenerator.class.php';
52 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
71 abstract public function write_file(
$object, $outputlangs, $srctemplatepath =
'', $hidedetails = 0, $hidedesc = 0, $hideref = 0);
109 return $langs->trans(
"Function_getNextValue_InModuleNotWorking");
127 $resql = $dbs->query($sql);
129 $num = $dbs->num_rows($resql);
132 $row = $dbs->fetch_row($resql);
133 $list[$row[0]] = $row[1];
153 $langs->loadLangs(array(
"admin",
"companies"));
157 if (
getDolGlobalString(
'MAIN_COMPANY_CODE_ALWAYS_REQUIRED') && !empty($this->code_null)) {
158 $strikestart =
'<strike>';
159 $strikeend =
'</strike> '.yn(1, 1, 2).
' ('.$langs->trans(
"ForcedToByAModule", $langs->transnoentities(
"yes")).
')';
164 $s .= $langs->trans(
"Name").
': <b>'.$this->
getName($langs).
'</b><br>';
165 } elseif ($type == 0) {
166 $s .= $langs->trans(
"CustomerCodeDesc").
'<br>';
167 } elseif ($type == 1) {
168 $s .= $langs->trans(
"SupplierCodeDesc").
'<br>';
171 $s .= $langs->trans(
"ValidityControledByModule").
': <b>'.$this->
getName($langs).
'</b><br>';
174 $s .=
'<u>'.$langs->trans(
"ThisIsModuleRules").
':</u><br>';
176 $s .= $langs->trans(
"RequiredIfCustomer").
': '.$strikestart;
177 $s .=
yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
179 } elseif ($type == 1) {
180 $s .= $langs->trans(
"RequiredIfSupplier").
': '.$strikestart;
181 $s .=
yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
183 } elseif ($type == -1) {
184 $s .= $langs->trans(
"Required").
': '.$strikestart;
185 $s .=
yn($this->code_null ? 0 : 1, 1, 2).$strikeend;
188 $s .= $langs->trans(
"CanBeModifiedIfOk").
': ';
189 $s .=
yn($this->code_modifiable, 1, 2);
191 $s .= $langs->trans(
"CanBeModifiedIfKo").
': '.
yn($this->code_modifiable_invalide, 1, 2).
'<br>';
192 $s .= $langs->trans(
"AutomaticCode").
': '.
yn($this->code_auto, 1, 2).
'<br>';
194 if ($type == 0 || $type == -1) {
196 if (empty($nextval)) {
197 $nextval = $langs->trans(
"Undefined");
199 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Customer").
')' :
'').
': <b>'.$nextval.
'</b><br>';
201 if ($type == 1 || $type == -1) {
203 if (empty($nextval)) {
204 $nextval = $langs->trans(
"Undefined");
206 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Supplier").
')' :
'').
': <b>'.$nextval.
'</b>';
238 abstract public function verif($db, &$code, $soc, $type);
264 $langs->load(
"admin");
268 $s .= $langs->trans(
"Name").
': <b>'.$this->
name.
'</b><br>';
269 $s .= $langs->trans(
"Version").
': <b>'.$this->
getVersion().
'</b><br>';
274 if ($type == 0 || $type == -1) {
275 $result = $this->
get_code($db, $soc,
'customer');
276 $nextval = $this->code;
277 if (empty($nextval)) {
278 $nextval = $langs->trans(
"Undefined");
280 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Customer").
')' :
'').
': <b>'.$nextval.
'</b><br>';
282 if ($type == 1 || $type == -1) {
283 $result = $this->
get_code($db, $soc,
'supplier');
284 $nextval = $this->code;
285 if (empty($nextval)) {
286 $nextval = $langs->trans(
"Undefined");
288 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Supplier").
')' :
'').
': <b>'.$nextval.
'</b>';
302 public function get_code($db, $societe, $type =
'')
307 dol_syslog(get_class($this).
"::get_code".$langs->trans(
"NotAvailable"), LOG_ERR);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Parent class for documents (PDF, ODT, ...) generators.
Parent class for number ref generators.
getVersion()
Returns version of numbering module.
getName($langs)
Return model name.
Parent class for third parties accountancy code generators.
getToolTip($langs, $soc, $type)
Return description of module parameters.
get_code($db, $societe, $type='')
Set accountancy account code for a third party into this->code.
Parent class for third parties code generators.
verif_prefixIsUsed()
Check if mask/numbering use prefix.
verif($db, &$code, $soc, $type)
Check validity of code according to its rules.
__construct($db)
Constructor.
getNextValue($objsoc='', $type=-1)
Return an example of result returned by getNextValue.
static liste_modeles($dbs, $maxfilenamelength=0)
Return list of active generation modules.
getToolTip($langs, $soc, $type)
Return description of module parameters.
Parent class for third parties models of doc generators.
write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0)
Function to build a document on disk using the generic odt module.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db name
Only used if Module[ID]Name translation string is not found.