2
0
forked from Wavyzz/dolibarr

Fix : php 8.1 warnings

This commit is contained in:
hystepik
2022-11-27 00:44:05 +01:00
parent fb11f24fae
commit c1b355fcac
8 changed files with 158 additions and 155 deletions

View File

@@ -1253,7 +1253,7 @@ if ($action == 'create') {
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">'; print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>'; print '</div>';
// limit date // limit date
$repeateventlimitdate = $repeateventlimitdate ? $repeateventlimitdate : ''; $repeateventlimitdate = !empty($repeateventlimitdate) ? $repeateventlimitdate : '';
print '<div class="hidden marginrightonly inline-block repeateventlimitdate">'; print '<div class="hidden marginrightonly inline-block repeateventlimitdate">';
print $langs->trans("Until")." "; print $langs->trans("Until")." ";
print $form->selectDate($repeateventlimitdate, 'limit', 0, 0, 0, "action", 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel'); print $form->selectDate($repeateventlimitdate, 'limit', 0, 0, 0, "action", 1, 0, 0, '', '', '', '', 1, '', '', 'tzuserrel');

View File

@@ -1561,6 +1561,7 @@ if ($resql) {
$companylinked_id = 0; $companylinked_id = 0;
$userlinked_id = 0; $userlinked_id = 0;
$type_link = "";
//payment line type to define user display and user or company linked //payment line type to define user display and user or company linked
foreach ($links as $key => $value) { foreach ($links as $key => $value) {

View File

@@ -1209,7 +1209,7 @@ class BonPrelevement extends CommonObject
$result = ''; $result = '';
$labeltoshow = 'PaymentByDirectDebit'; $labeltoshow = 'PaymentByDirectDebit';
if ($this->type == 'bank-transfer') { if (!empty($this->type) && $this->type == 'bank-transfer') {
$labeltoshow = 'PaymentByBankTransfer'; $labeltoshow = 'PaymentByBankTransfer';
} }
@@ -1221,7 +1221,7 @@ class BonPrelevement extends CommonObject
} }
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
if ($this->type == 'bank-transfer') { if (!empty($this->type) && $this->type == 'bank-transfer') {
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
} }

View File

@@ -356,7 +356,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
} }
} }
} }
$texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : ''); $texttoinsert .= ((!empty($val['notnull']) && $val['notnull'] > 0) ? ' NOT NULL' : '');
if ($i < count($object->fields)) { if ($i < count($object->fields)) {
$texttoinsert .= ", "; $texttoinsert .= ", ";
} }

View File

@@ -332,7 +332,7 @@ if (($id || $ref) && $action == 'edit') {
// $value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $sk->$key; // $value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $sk->$key;
// } // }
//var_dump($val.' '.$key.' '.$value); //var_dump($val.' '.$key.' '.$value);
if ($val['noteditable']) { if (!empty($val['noteditable'])) {
print $sk->showOutputField($val, $key, $value, '', '', '', 0); print $sk->showOutputField($val, $key, $value, '', '', '', 0);
} else { } else {
/** @var Skilldet $sk */ /** @var Skilldet $sk */

View File

@@ -3112,7 +3112,7 @@ if ($module == 'initmodule') {
$proplabel = $propval['label']; $proplabel = $propval['label'];
$proptype = $propval['type']; $proptype = $propval['type'];
$proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:''; $proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:'';
$propnotnull = $propval['notnull']; $propnotnull = !empty($propval['notnull']) ? $propval['notnull'] : '0';
$propdefault = !empty($propval['default'])?$propval['default']:''; $propdefault = !empty($propval['default'])?$propval['default']:'';
$propindex = !empty($propval['index'])?$propval['index']:''; $propindex = !empty($propval['index'])?$propval['index']:'';
$propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:''; $propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:'';

View File

@@ -1286,7 +1286,7 @@ if ($action == 'create') {
$lines = $object->lines; $lines = $object->lines;
$num_prod = count($lines); $num_prod = count($lines);
$indiceAsked = 0;
if ($object->id > 0) { if ($object->id > 0) {
if (!empty($object->origin) && $object->origin_id > 0) { if (!empty($object->origin) && $object->origin_id > 0) {
$object->origin = 'CommandeFournisseur'; $object->origin = 'CommandeFournisseur';

View File

@@ -87,38 +87,18 @@ if (!$rowid) {
$option = array('limit' => $limit + 1); $option = array('limit' => $limit + 1);
$num = 0; $num = 0;
$param = '';
$totalnboflines = '';
$moreforfilter = '';
$list = null;
if (GETPOSTISSET('starting_after_'.$page)) { if (GETPOSTISSET('starting_after_'.$page)) {
$option['starting_after'] = GETPOST('starting_after_'.$page, 'alphanohtml'); $option['starting_after'] = GETPOST('starting_after_'.$page, 'alphanohtml');
} }
try {
if ($stripeacc) {
$list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc));
} else {
$list = \Stripe\Charge::all($option);
}
$num = count($list->data);
$totalnboflines = '';
$param = '';
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id;
//$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id;
$moreforfilter = '';
} catch (Exception $e) {
print $e->getMessage();
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') { if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
} }
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
@@ -145,146 +125,168 @@ if (!$rowid) {
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
print "</tr>\n"; print "</tr>\n";
try {
if ($stripeacc) {
$list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc));
} else {
$list = \Stripe\Charge::all($option);
}
$num = count($list->data);
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
$param .= '&starting_after_'.($page + 1).'='.$list->data[($limit - 1)]->id;
//$param.='&ending_before_'.($page+1).'='.$list->data[($limit-1)]->id;
} catch (Exception $e) {
print '<tr><td colspan="6">'.$e->getMessage().'</td></td>';
}
//print $list; //print $list;
$i = 0; $i = 0;
foreach ($list->data as $charge) { if (!empty($list)) {
if ($i >= $limit) { foreach ($list->data as $charge) {
break; if ($i >= $limit) {
} break;
}
if ($charge->refunded == '1') { if ($charge->refunded == '1') {
$status = img_picto($langs->trans("refunded"), 'statut6'); $status = img_picto($langs->trans("refunded"), 'statut6');
} elseif ($charge->paid == '1') { } elseif ($charge->paid == '1') {
$status = img_picto($langs->trans((string) $charge->status), 'statut4'); $status = img_picto($langs->trans((string) $charge->status), 'statut4');
} else { } else {
$label = $langs->trans("Message").": ".$charge->failure_message."<br>"; $label = $langs->trans("Message").": ".$charge->failure_message."<br>";
$label .= $langs->trans("Network").": ".$charge->outcome->network_status."<br>"; $label .= $langs->trans("Network").": ".$charge->outcome->network_status."<br>";
$label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message); $label .= $langs->trans("Status").": ".$langs->trans((string) $charge->outcome->seller_message);
$status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1); $status = $form->textwithpicto(img_picto($langs->trans((string) $charge->status), 'statut8'), $label, -1);
} }
if (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'card') { if (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'card') {
$type = $langs->trans("card"); $type = $langs->trans("card");
} elseif (isset($charge->source->type) && $charge->source->type == 'card') { } elseif (isset($charge->source->type) && $charge->source->type == 'card') {
$type = $langs->trans("card"); $type = $langs->trans("card");
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'three_d_secure') { } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'three_d_secure') {
$type = $langs->trans("card3DS"); $type = $langs->trans("card3DS");
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'sepa_debit') { } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'sepa_debit') {
$type = $langs->trans("sepadebit"); $type = $langs->trans("sepadebit");
} elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'ideal') { } elseif (isset($charge->payment_method_details->type) && $charge->payment_method_details->type == 'ideal') {
$type = $langs->trans("iDEAL"); $type = $langs->trans("iDEAL");
} }
// Why this ? // Why this ?
/*if (!empty($charge->payment_intent)) { /*if (!empty($charge->payment_intent)) {
if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent); $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent);
} else { } else {
$charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc)); $charge = \Stripe\PaymentIntent::retrieve($charge->payment_intent, array("stripe_account" => $stripeacc));
} }
}*/ }*/
// The metadata FULLTAG is defined by the online payment page // The metadata FULLTAG is defined by the online payment page
$FULLTAG = $charge->metadata->FULLTAG; $FULLTAG = $charge->metadata->FULLTAG;
// Save into $tmparray all metadata // Save into $tmparray all metadata
$tmparray = dolExplodeIntoArray($FULLTAG, '.', '='); $tmparray = dolExplodeIntoArray($FULLTAG, '.', '=');
// Load origin object according to metadata // Load origin object according to metadata
if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) { if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) {
$societestatic->fetch($tmparray['CUS']); $societestatic->fetch($tmparray['CUS']);
} elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) { } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) {
$societestatic->fetch($charge->metadata->dol_thirdparty_id); $societestatic->fetch($charge->metadata->dol_thirdparty_id);
} else { } else {
$societestatic->id = 0; $societestatic->id = 0;
} }
if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) { if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) {
$memberstatic->fetch($tmparray['MEM']); $memberstatic->fetch($tmparray['MEM']);
} else { } else {
$memberstatic->id = 0; $memberstatic->id = 0;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (!empty($stripeacc)) { if (!empty($stripeacc)) {
$connect = $stripeacc.'/'; $connect = $stripeacc.'/';
} else { } else {
$connect = ''; $connect = '';
} }
// Ref // Ref
$url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id; $url = 'https://dashboard.stripe.com/'.$connect.'test/payments/'.$charge->id;
if ($servicestatus) { if ($servicestatus) {
$url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id; $url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
} }
print "<td>"; print "<td>";
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>"; print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
if ($charge->payment_intent) { if ($charge->payment_intent) {
print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>'; print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
} }
print "</td>\n"; print "</td>\n";
// Stripe customer // Stripe customer
print "<td>"; print "<td>";
if (isModEnabled('stripe') && !empty($stripeacc)) { if (isModEnabled('stripe') && !empty($stripeacc)) {
$connect = $stripeacc.'/'; $connect = $stripeacc.'/';
} }
$url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer; $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$charge->customer;
if ($servicestatus) { if ($servicestatus) {
$url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer; $url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$charge->customer;
} }
if (!empty($charge->customer)) { if (!empty($charge->customer)) {
print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>'; print '<a href="'.$url.'" target="_stripe">'.img_picto($langs->trans('ShowInStripe'), 'globe').' '.$charge->customer.'</a>';
} }
print "</td>\n"; print "</td>\n";
// Link // Link
print "<td>"; print "<td>";
if ($societestatic->id > 0) { if ($societestatic->id > 0) {
print $societestatic->getNomUrl(1); print $societestatic->getNomUrl(1);
} elseif ($memberstatic->id > 0) { } elseif ($memberstatic->id > 0) {
print $memberstatic->getNomUrl(1); print $memberstatic->getNomUrl(1);
} }
print "</td>\n"; print "</td>\n";
// Origin // Origin
print "<td>"; print "<td>";
if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") { if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") {
$object = new Commande($db); $object = new Commande($db);
$object->fetch($charge->metadata->dol_id); $object->fetch($charge->metadata->dol_id);
if ($object->id > 0) { if ($object->id > 0) {
print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'order')." ".$object->ref."</a>"; print "<a href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'order')." ".$object->ref."</a>";
} else {
print $FULLTAG;
}
} elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") {
$object = new Facture($db);
$object->fetch($charge->metadata->dol_id);
if ($object->id > 0) {
print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'bill')." ".$object->ref."</a>";
} else {
print $FULLTAG;
}
} else { } else {
print $FULLTAG; print $FULLTAG;
} }
} elseif ($charge->metadata->dol_type == "invoice" || $charge->metadata->dol_type == "facture") { print "</td>\n";
$object = new Facture($db);
$object->fetch($charge->metadata->dol_id); // Date payment
if ($object->id > 0) { print '<td class="center">'.dol_print_date($charge->created, 'dayhour')."</td>\n";
print "<a href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'bill')." ".$object->ref."</a>"; // Type
} else { print '<td>';
print $FULLTAG; print $type;
} print '</td>';
} else { // Amount
print $FULLTAG; print '<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</span></td>";
// Status
print '<td class="right">';
print $status;
print "</td>\n";
print "</tr>\n";
$i++;
} }
print "</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($charge->created, 'dayhour')."</td>\n";
// Type
print '<td>';
print $type;
print '</td>';
// Amount
print '<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</span></td>";
// Status
print '<td class="right">';
print $status;
print "</td>\n";
print "</tr>\n";
$i++;
} }
print '</table>'; print '</table>';