dolibarr  17.0.4
chargesociales.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2016-2022 Frédéric France <frederic.france@netlogic.fr>
5  * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
6  * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
27 require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
28 
29 
35 {
39  public $element = 'chargesociales';
40 
41  public $table = 'chargesociales';
42 
46  public $table_element = 'chargesociales';
47 
51  public $picto = 'bill';
52 
56  protected $table_ref_field = 'ref';
57 
61  public $date_ech;
62 
63 
64  public $label;
65  public $type;
66  public $type_label;
67  public $amount;
68  public $paye;
69  public $periode;
70 
74  public $date_creation;
75 
79  public $date_modification;
80 
84  public $date_validation;
85 
89  public $lib;
90 
94  public $fk_account;
95 
99  public $accountid;
100 
104  public $paiementtype;
105 
109  public $fk_project;
110 
114  public $fk_user;
115 
119  public $total;
120 
121  public $totalpaid;
122 
123  const STATUS_UNPAID = 0;
124  const STATUS_PAID = 1;
125 
126 
132  public function __construct(DoliDB $db)
133  {
134  $this->db = $db;
135  }
136 
144  public function fetch($id, $ref = '')
145  {
146  $sql = "SELECT cs.rowid, cs.date_ech";
147  $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key";
148  $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user, note_public, note_private";
149  $sql .= ", c.libelle as type_label";
150  $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
151  $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs";
152  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id";
153  $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id';
154  $sql .= ' WHERE cs.entity IN ('.getEntity('tax').')';
155  if ($ref) {
156  $sql .= " AND cs.ref = '".$this->db->escape($ref)."'";
157  } else {
158  $sql .= " AND cs.rowid = ".((int) $id);
159  }
160 
161  dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
162  $resql = $this->db->query($sql);
163  if ($resql) {
164  if ($this->db->num_rows($resql)) {
165  $obj = $this->db->fetch_object($resql);
166 
167  $this->id = $obj->rowid;
168  $this->ref = $obj->rowid;
169  $this->date_ech = $this->db->jdate($obj->date_ech);
170  $this->lib = $obj->label;
171  $this->label = $obj->label;
172  $this->type = $obj->fk_type;
173  $this->type_label = $obj->type_label;
174  $this->fk_account = $obj->fk_account;
175  $this->mode_reglement_id = $obj->fk_mode_reglement;
176  $this->mode_reglement_code = $obj->mode_reglement_code;
177  $this->mode_reglement = $obj->mode_reglement_libelle;
178  $this->amount = $obj->amount;
179  $this->fk_project = $obj->fk_project;
180  $this->fk_user = $obj->fk_user;
181  $this->note_public = $obj->note_public;
182  $this->note_private = $obj->note_private;
183  $this->paye = $obj->paye;
184  $this->periode = $this->db->jdate($obj->periode);
185  $this->import_key = $this->import_key;
186 
187  $this->db->free($resql);
188 
189  return 1;
190  } else {
191  return 0;
192  }
193  } else {
194  $this->error = $this->db->lasterror();
195  return -1;
196  }
197  }
198 
204  public function check()
205  {
206  $newamount = price2num($this->amount, 'MT');
207 
208  // Validation of parameters
209  if ($newamount == 0 || empty($this->date_ech) || empty($this->periode)) {
210  return false;
211  }
212 
213  return true;
214  }
215 
222  public function create($user)
223  {
224  global $conf;
225  $error = 0;
226 
227  $now = dol_now();
228 
229  // Nettoyage parametres
230  $newamount = price2num($this->amount, 'MT');
231 
232  if (!$this->check()) {
233  $this->error = "ErrorBadParameter";
234  return -2;
235  }
236 
237  $this->db->begin();
238 
239  $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)";
240  $sql .= " VALUES (".((int) $this->type);
241  $sql .= ", ".($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL');
242  $sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "NULL");
243  $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'";
244  $sql .= ", '".$this->db->idate($this->date_ech)."'";
245  $sql .= ", '".$this->db->idate($this->periode)."'";
246  $sql .= ", '".price2num($newamount)."'";
247  $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 'NULL');
248  $sql .= ", ".((int) $conf->entity);
249  $sql .= ", ".((int) $user->id);
250  $sql .= ", ".($this->fk_user > 0 ? ((int) $this->fk_user) : 'NULL');
251  $sql .= ", '".$this->db->idate($now)."'";
252  $sql .= ")";
253 
254  dol_syslog(get_class($this)."::create", LOG_DEBUG);
255  $resql = $this->db->query($sql);
256  if ($resql) {
257  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales");
258 
259  //dol_syslog("ChargesSociales::create this->id=".$this->id);
260  $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user);
261  if ($result < 0) {
262  $error++;
263  }
264 
265  if (empty($error)) {
266  $this->db->commit();
267  return $this->id;
268  } else {
269  $this->db->rollback();
270  return -1 * $error;
271  }
272  } else {
273  $this->error = $this->db->error();
274  $this->db->rollback();
275  return -1;
276  }
277  }
278 
279 
286  public function delete($user)
287  {
288  $error = 0;
289 
290  $this->db->begin();
291 
292  // Get bank transaction lines for this social contributions
293  include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
294  $account = new Account($this->db);
295  $lines_url = $account->get_url('', $this->id, 'sc');
296 
297  // Delete bank urls
298  foreach ($lines_url as $line_url) {
299  if (!$error) {
300  $accountline = new AccountLine($this->db);
301  $accountline->fetch($line_url['fk_bank']);
302  $result = $accountline->delete_urls($user);
303  if ($result < 0) {
304  $error++;
305  }
306  }
307  }
308 
309  // Delete payments
310  if (!$error) {
311  $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".((int) $this->id);
312  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
313  $resql = $this->db->query($sql);
314  if (!$resql) {
315  $error++;
316  $this->error = $this->db->lasterror();
317  }
318  }
319 
320  if (!$error) {
321  $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".((int) $this->id);
322  dol_syslog(get_class($this)."::delete", LOG_DEBUG);
323  $resql = $this->db->query($sql);
324  if (!$resql) {
325  $error++;
326  $this->error = $this->db->lasterror();
327  }
328  }
329 
330  if (!$error) {
331  $this->db->commit();
332  return 1;
333  } else {
334  $this->db->rollback();
335  return -1;
336  }
337  }
338 
339 
347  public function update($user, $notrigger = 0)
348  {
349  $error = 0;
350  $this->db->begin();
351 
352  $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
353  $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'";
354  $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'";
355  $sql .= ", periode='".$this->db->idate($this->periode)."'";
356  $sql .= ", amount='".price2num($this->amount, 'MT')."'";
357  $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL");
358  $sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL");
359  $sql .= ", fk_user_modif=".$user->id;
360  $sql .= " WHERE rowid=".((int) $this->id);
361 
362  dol_syslog(get_class($this)."::update", LOG_DEBUG);
363  $resql = $this->db->query($sql);
364 
365  if (!$resql) {
366  $error++;
367  $this->errors[] = "Error ".$this->db->lasterror();
368  }
369 
370  if (!$error) {
371  if (!$notrigger) {
372  // Call trigger
373  $result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
374  if ($result < 0) {
375  $error++;
376  }
377  // End call triggers
378  }
379  }
380 
381  // Commit or rollback
382  if ($error) {
383  foreach ($this->errors as $errmsg) {
384  dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
385  $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
386  }
387  $this->db->rollback();
388  return -1 * $error;
389  } else {
390  $this->db->commit();
391  return 1;
392  }
393  }
394 
401  public function solde($year = 0)
402  {
403  global $conf;
404 
405  $sql = "SELECT SUM(f.amount) as amount";
406  $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
407  $sql .= " WHERE f.entity = ".$conf->entity;
408  $sql .= " AND paye = 0";
409 
410  if ($year) {
411  $sql .= " AND f.datev >= '".((int) $year)."-01-01' AND f.datev <= '".((int) $year)."-12-31' ";
412  }
413 
414  $result = $this->db->query($sql);
415  if ($result) {
416  if ($this->db->num_rows($result)) {
417  $obj = $this->db->fetch_object($result);
418  $this->db->free($result);
419  return $obj->amount;
420  } else {
421  return 0;
422  }
423  } else {
424  print $this->db->error();
425  return -1;
426  }
427  }
428 
429  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
438  public function set_paid($user)
439  {
440  // phpcs:enable
441  dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
442  return $this->setPaid($user);
443  }
444 
451  public function setPaid($user)
452  {
453  $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
454  $sql .= " paye = 1";
455  $sql .= " WHERE rowid = ".((int) $this->id);
456  $return = $this->db->query($sql);
457  if ($return) {
458  return 1;
459  } else {
460  return -1;
461  }
462  }
463 
464  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
473  public function set_unpaid($user)
474  {
475  // phpcs:enable
476  dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
477  return $this->setUnpaid($user);
478  }
479 
486  public function setUnpaid($user)
487  {
488  $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
489  $sql .= " paye = 0";
490  $sql .= " WHERE rowid = ".((int) $this->id);
491  $return = $this->db->query($sql);
492  if ($return) {
493  return 1;
494  } else {
495  return -1;
496  }
497  }
498 
506  public function getLibStatut($mode = 0, $alreadypaid = -1)
507  {
508  return $this->LibStatut($this->paye, $mode, $alreadypaid);
509  }
510 
511  // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
520  public function LibStatut($status, $mode = 0, $alreadypaid = -1)
521  {
522  // phpcs:enable
523  global $langs;
524 
525  // Load translation files required by the page
526  $langs->loadLangs(array("customers", "bills"));
527 
528  // We reinit status array to force to redefine them because label may change according to properties values.
529  $this->labelStatus = array();
530  $this->labelStatusShort = array();
531 
532  if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
533  global $langs;
534  //$langs->load("mymodule");
535  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
536  $this->labelStatus[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
537  if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
538  $this->labelStatus[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
539  }
540  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv('Unpaid');
541  $this->labelStatusShort[self::STATUS_PAID] = $langs->transnoentitiesnoconv('Paid');
542  if ($status == self::STATUS_UNPAID && $alreadypaid > 0) {
543  $this->labelStatusShort[self::STATUS_UNPAID] = $langs->transnoentitiesnoconv("BillStatusStarted");
544  }
545  }
546 
547  $statusType = 'status1';
548  if ($status == 0 && $alreadypaid > 0) {
549  $statusType = 'status3';
550  }
551  if ($status == 1) {
552  $statusType = 'status6';
553  }
554 
555  return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
556  }
557 
558 
569  public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $short = 0, $save_lastsearch_value = -1)
570  {
571  global $langs, $conf, $user, $form, $hookmanager;
572 
573  if (!empty($conf->dol_no_mouse_hover)) {
574  $notooltip = 1; // Force disable tooltips
575  }
576 
577  $result = '';
578 
579  $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id;
580 
581  if ($short) {
582  return $url;
583  }
584 
585  if ($option !== 'nolink') {
586  // Add param to save lastsearch_values or not
587  $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
588  if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
589  $add_save_lastsearch_values = 1;
590  }
591  if ($add_save_lastsearch_values) {
592  $url .= '&save_lastsearch_values=1';
593  }
594  }
595 
596  if (empty($this->ref)) {
597  $this->ref = $this->label;
598  }
599 
600  $label = img_picto('', 'tax').'<u class="paddingrightonly">'.$langs->trans("SocialContribution").'</u>';
601  if (isset($this->paye)) {
602  $label .= ' '.$this->getLibStatut(5);
603  }
604  if (!empty($this->ref)) {
605  $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
606  }
607  if (!empty($this->label)) {
608  $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
609  }
610  if (!empty($this->type_label)) {
611  $label .= '<br><b>'.$langs->trans('Type').':</b> '.$this->type_label;
612  }
613 
614  $linkclose = '';
615  if (empty($notooltip) && $user->hasRight("facture", "read")) {
616  if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
617  $label = $langs->trans("SocialContribution");
618  $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
619  }
620  $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
621  $linkclose .= ' class="classfortooltip"';
622  }
623 
624  $linkstart = '<a href="'.$url.'"';
625  $linkstart .= $linkclose.'>';
626  $linkend = '</a>';
627 
628  $result .= $linkstart;
629  if ($withpicto) {
630  $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);
631  }
632  if ($withpicto != 2) {
633  $result .= $this->ref;
634  }
635  $result .= $linkend;
636  global $action;
637  $hookmanager->initHooks(array($this->element . 'dao'));
638  $parameters = array('id'=>$this->id, 'getnomurl' => &$result);
639  $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
640  if ($reshook > 0) {
641  $result = $hookmanager->resPrint;
642  } else {
643  $result .= $hookmanager->resPrint;
644  }
645  return $result;
646  }
647 
653  public function getSommePaiement()
654  {
655  $table = 'paiementcharge';
656  $field = 'fk_charge';
657 
658  $sql = 'SELECT sum(amount) as amount';
659  $sql .= ' FROM '.MAIN_DB_PREFIX.$table;
660  $sql .= " WHERE ".$field." = ".((int) $this->id);
661 
662  dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG);
663  $resql = $this->db->query($sql);
664  if ($resql) {
665  $amount = 0;
666 
667  $obj = $this->db->fetch_object($resql);
668  if ($obj) {
669  $amount = $obj->amount ? $obj->amount : 0;
670  }
671 
672  $this->db->free($resql);
673  return $amount;
674  } else {
675  return -1;
676  }
677  }
678 
685  public function info($id)
686  {
687  $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
688  $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
689  $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
690  $sql .= " WHERE e.rowid = ".((int) $id);
691 
692  dol_syslog(get_class($this)."::info", LOG_DEBUG);
693  $result = $this->db->query($sql);
694  if ($result) {
695  if ($this->db->num_rows($result)) {
696  $obj = $this->db->fetch_object($result);
697 
698  $this->id = $obj->rowid;
699 
700  if ($obj->fk_user_author) {
701  $cuser = new User($this->db);
702  $cuser->fetch($obj->fk_user_author);
703  $this->user_creation = $cuser;
704  }
705 
706  if ($obj->fk_user_modif) {
707  $muser = new User($this->db);
708  $muser->fetch($obj->fk_user_modif);
709  $this->user_modification = $muser;
710  }
711 
712  if ($obj->fk_user_valid) {
713  $vuser = new User($this->db);
714  $vuser->fetch($obj->fk_user_valid);
715  $this->user_validation = $vuser;
716  }
717 
718  $this->date_creation = $this->db->jdate($obj->datec);
719  $this->date_modification = $this->db->jdate($obj->datem);
720  $this->date_validation = $this->db->jdate($obj->datev);
721  $this->import_key = $obj->import_key;
722  }
723 
724  $this->db->free($result);
725  } else {
726  dol_print_error($this->db);
727  }
728  }
729 
737  public function initAsSpecimen()
738  {
739  // Initialize parameters
740  $this->id = 0;
741  $this->ref = 'SPECIMEN';
742  $this->specimen = 1;
743  $this->paye = 0;
744  $this->date = dol_now();
745  $this->date_ech = $this->date + 3600 * 24 * 30;
746  $this->periode = $this->date + 3600 * 24 * 30;
747  $this->amount = 100;
748  $this->label = 'Social contribution label';
749  $this->type = 1;
750  $this->type_label = 'Type of social contribution';
751  }
752 }
$object ref
Definition: info.php:78
Class to manage bank accounts.
Class to manage bank transaction lines.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
LibStatut($status, $mode=0, $alreadypaid=-1)
Renvoi le libelle d'un statut donne.
__construct(DoliDB $db)
Constructor.
setUnpaid($user)
Remove tag paid on social contribution.
initAsSpecimen()
Initialise an instance with random values.
check()
Check if a social contribution can be created into database.
getSommePaiement()
Return amount of payments already done.
solde($year=0)
Calculate amount remaining to pay by year.
fetch($id, $ref='')
Retrouve et charge une charge sociale.
update($user, $notrigger=0)
Update social or fiscal contribution.
set_unpaid($user)
Remove tag paid on social contribution.
set_paid($user)
Tag social contribution as paid completely.
getNomUrl($withpicto=0, $option='', $notooltip=0, $short=0, $save_lastsearch_value=-1)
Return a link to the object card (with optionaly the picto)
info($id)
Charge les informations d'ordre info dans l'objet entrepot.
create($user)
Create a social contribution into database.
getLibStatut($mode=0, $alreadypaid=-1)
Retourne le libelle du statut d'une charge (impaye, payee)
setPaid($user)
Tag social contribution as paid completely.
Parent class of all other business classes (invoices, contracts, proposals, orders,...
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
Definition: user.class.php:47
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dolGetStatus($statusLabel='', $statusLabelShort='', $html='', $statusType='status0', $displayMode=0, $url='', $params=array())
Output the badge of a status.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119
$conf db
API class for accounts.
Definition: inc.php:41