浏览代码

PHP8 Warnings

Alexandre SPANGARO 2 年之前
父节点
当前提交
4470a78c6e
共有 2 个文件被更改,包括 11 次插入10 次删除
  1. 8 7
      htdocs/core/modules/takepos/mod_takepos_ref_universal.php
  2. 3 3
      htdocs/takepos/admin/setup.php

+ 8 - 7
htdocs/core/modules/takepos/mod_takepos_ref_universal.php

@@ -57,11 +57,11 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
 	 */
 	public function info()
 	{
-		global $conf, $langs;
+		global $db, $langs;
 
 		$langs->load('cashdesk@cashdesk');
 
-		$form = new Form($this->db);
+		$form = new Form($db);
 
 		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
 		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@@ -79,9 +79,9 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
 
 		// Parametrage du prefix
 		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
-		$texte .= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskvalue" value="'.$conf->global->TAKEPOS_REF_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';
+		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskvalue" value="'.getDolGlobalString('TAKEPOS_REF_UNIVERSAL_MASK').'">', $tooltip, 1, 1).'</td>';
 
-		$texte .= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
+		$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
 
 		$texte .= '</tr>';
 
@@ -121,12 +121,12 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
 	 */
 	public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
 	{
-		global $db, $conf;
+		global $db;
 
 		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 
 		// On defini critere recherche compteur
-		$mask = $conf->global->TAKEPOS_REF_UNIVERSAL_MASK;
+		$mask = getDolGlobalString('TAKEPOS_REF_UNIVERSAL_MASK');
 
 		if (!$mask) {
 			$this->error = 'NotConfigured';
@@ -136,9 +136,10 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
 		// Get entities
 		$entity = getEntity('invoicenumber', 1, $invoice);
 
+		$date = (empty($invoice->date) ? dol_now() : $invoice->date);
 		$pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0;
 		$mask = str_replace('{TN}', $pos_source, $mask);
-		$numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $invoice->date, $mode, false, null, $entity);
+		$numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $date, $mode, false, null, $entity);
 
 		return $numFinal;
 	}

+ 3 - 3
htdocs/takepos/admin/setup.php

@@ -196,8 +196,8 @@ foreach ($dirmodels as $reldir) {
 						}
 						print '</td>'."\n";
 
-						print '<td align="center">';
-						if ($conf->global->TAKEPOS_REF_ADDON == "$file") {
+						print '<td class="center">';
+						if (getDolGlobalString('TAKEPOS_REF_ADDON') == "$file") {
 							print img_picto($langs->trans("Activated"), 'switch_on');
 						} else {
 							print '<a href="'.$_SERVER["PHP_SELF"].'?action=setrefmod&token='.newToken().'&value='.urlencode($file).'">';
@@ -277,7 +277,7 @@ if (!empty($conf->service->enabled)) {
 print '<tr class="oddeven"><td>';
 print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc"));
 print '<td colspan="2">';
-print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0);
+print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'), 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0);
 print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID');
 print "</td></tr>\n";