27 require_once DOL_DOCUMENT_ROOT.
'/core/class/commondocgenerator.class.php';
55 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
83 public function info($langs)
85 $langs->load(
"bills");
86 return $langs->trans(
"NoDescription");
107 $langs->load(
"bills");
108 return $langs->trans(
"NoExample");
132 return $langs->trans(
"Function_getNextValue_InModuleNotWorking");
144 $langs->load(
"admin");
146 if ($this->version ==
'development') {
147 return $langs->trans(
"VersionDevelopment");
148 } elseif ($this->version ==
'experimental') {
149 return $langs->trans(
"VersionExperimental");
150 } elseif ($this->version ==
'dolibarr') {
152 } elseif ($this->version) {
153 return $this->version;
155 return $langs->trans(
"NotAvailable");
173 $resql = $dbs->query($sql);
175 $num = $dbs->num_rows(
$resql);
178 $row = $dbs->fetch_row(
$resql);
179 $list[$row[0]] = $row[1];
200 $langs->loadLangs(array(
"admin",
"companies"));
204 if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {
205 $strikestart =
'<strike>';
206 $strikeend =
'</strike> '.yn(1, 1, 2).
' ('.$langs->trans(
"ForcedToByAModule", $langs->transnoentities(
"yes")).
')';
211 $s .= $langs->trans(
"Name").
': <b>'.$this->
getNom($langs).
'</b><br>';
212 } elseif ($type == -1) {
213 $s .= $langs->trans(
"Version").
': <b>'.$this->
getVersion().
'</b><br>';
214 } elseif ($type == 0) {
215 $s .= $langs->trans(
"CustomerCodeDesc").
'<br>';
216 } elseif ($type == 1) {
217 $s .= $langs->trans(
"SupplierCodeDesc").
'<br>';
220 $s .= $langs->trans(
"ValidityControledByModule").
': <b>'.$this->
getNom($langs).
'</b><br>';
223 $s .=
'<u>'.$langs->trans(
"ThisIsModuleRules").
':</u><br>';
225 $s .= $langs->trans(
"RequiredIfCustomer").
': '.$strikestart;
226 $s .=
yn(!$this->code_null, 1, 2).$strikeend;
228 } elseif ($type == 1) {
229 $s .= $langs->trans(
"RequiredIfSupplier").
': '.$strikestart;
230 $s .=
yn(!$this->code_null, 1, 2).$strikeend;
232 } elseif ($type == -1) {
233 $s .= $langs->trans(
"Required").
': '.$strikestart;
234 $s .=
yn(!$this->code_null, 1, 2).$strikeend;
237 $s .= $langs->trans(
"CanBeModifiedIfOk").
': ';
238 $s .=
yn($this->code_modifiable, 1, 2);
240 $s .= $langs->trans(
"CanBeModifiedIfKo").
': '.
yn($this->code_modifiable_invalide, 1, 2).
'<br>';
241 $s .= $langs->trans(
"AutomaticCode").
': '.
yn($this->code_auto, 1, 2).
'<br>';
243 if ($type == 0 || $type == -1) {
245 if (empty($nextval)) {
246 $nextval = $langs->trans(
"Undefined");
248 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Customer").
')' :
'').
': <b>'.$nextval.
'</b><br>';
250 if ($type == 1 || $type == -1) {
252 if (empty($nextval)) {
253 $nextval = $langs->trans(
"Undefined");
255 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Supplier").
')' :
'').
': <b>'.$nextval.
'</b>';
293 $langs->load(
"bills");
294 return $langs->trans(
"NoDescription");
307 $langs->load(
"bills");
308 return $langs->trans(
"NoExample");
330 $langs->load(
"admin");
332 if ($this->version ==
'development') {
333 return $langs->trans(
"VersionDevelopment");
334 } elseif ($this->version ==
'experimental') {
335 return $langs->trans(
"VersionExperimental");
336 } elseif ($this->version ==
'dolibarr') {
338 } elseif ($this->version) {
339 return $this->version;
341 return $langs->trans(
"NotAvailable");
357 $langs->load(
"admin");
361 $s .= $langs->trans(
"Name").
': <b>'.$this->
name.
'</b><br>';
362 $s .= $langs->trans(
"Version").
': <b>'.$this->
getVersion().
'</b><br>';
367 if ($type == 0 || $type == -1) {
368 $result = $this->
get_code($db, $soc,
'customer');
369 $nextval = $this->code;
370 if (empty($nextval)) {
371 $nextval = $langs->trans(
"Undefined");
373 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Customer").
')' :
'').
': <b>'.$nextval.
'</b><br>';
375 if ($type == 1 || $type == -1) {
376 $result = $this->
get_code($db, $soc,
'supplier');
377 $nextval = $this->code;
378 if (empty($nextval)) {
379 $nextval = $langs->trans(
"Undefined");
381 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Supplier").
')' :
'').
': <b>'.$nextval.
'</b>';
395 public function get_code($db, $societe, $type =
'')
400 return $langs->trans(
"NotAvailable");