@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $permissionnote = $user->hasRight('contrat', 'creer'); // Used by the include of actions_setnotes.inc.php |
101 | 101 | $permissiondellink = $user->hasRight('contrat', 'creer'); // Used by the include of actions_dellink.inc.php |
102 | 102 | $permissiontodelete = ($user->hasRight('contrat', 'creer') && $object->statut == $object::STATUS_DRAFT) || $user->hasRight('contrat', 'supprimer'); |
103 | -$permissiontoadd = $user->hasRight('contrat', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
|
103 | +$permissiontoadd = $user->hasRight('contrat', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
|
104 | 104 | $permissiontoedit = $permissiontoadd; |
105 | 105 | $permissiontoactivate = $user->hasRight('contrat', 'activer'); |
106 | 106 | $error = 0; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once |
145 | 145 | |
146 | - include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once |
|
146 | + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once |
|
147 | 147 | |
148 | 148 | if ($action == 'confirm_active' && $confirm == 'yes' && $permissiontoactivate) { |
149 | 149 | $date_start = ''; |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $lines[$i]->pa_ht, |
371 | 371 | $array_options, |
372 | 372 | $lines[$i]->fk_unit, |
373 | - $num+1 |
|
373 | + $num + 1 |
|
374 | 374 | ); |
375 | 375 | |
376 | 376 | if ($result < 0) { |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | $result = $prodcustprice->fetchAll('', '', 0, 0, $filter); |
521 | 521 | if ($result) { |
522 | 522 | if (count($prodcustprice->lines) > 0) { |
523 | - $price_min = price($prodcustprice->lines[0]->price_min); |
|
524 | - $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); |
|
523 | + $price_min = price($prodcustprice->lines[0]->price_min); |
|
524 | + $price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc); |
|
525 | 525 | /*$tva_tx = $prodcustprice->lines[0]->tva_tx; |
526 | 526 | if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) { |
527 | 527 | $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | // update price_ht with discount |
756 | 756 | // TODO Use object->updateline instead objedtline->update |
757 | 757 | |
758 | - $price_ht = price2num(GETPOST('elprice'), 'MU'); |
|
758 | + $price_ht = price2num(GETPOST('elprice'), 'MU'); |
|
759 | 759 | $remise_percent = price2num(GETPOST('elremise_percent'), 2); |
760 | 760 | if ($remise_percent > 0) { |
761 | 761 | $remise = round(($price_ht * $remise_percent / 100), 2); |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | } elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { |
862 | 862 | $date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear')); |
863 | 863 | $date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear')); |
864 | - $comment = GETPOST('comment', 'alpha'); |
|
864 | + $comment = GETPOST('comment', 'alpha'); |
|
865 | 865 | $result = $object->activateAll($user, $date_start, 0, $comment, $date_end); |
866 | 866 | if ($result < 0) { |
867 | 867 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
998 | 998 | |
999 | 999 | // Actions to build doc |
1000 | - $upload_dir = $conf->contrat->multidir_output[!empty($object->entity)?$object->entity:$conf->entity]; |
|
1000 | + $upload_dir = $conf->contrat->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]; |
|
1001 | 1001 | include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
1002 | 1002 | |
1003 | 1003 | // Actions to send emails |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | |
1492 | - $arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error |
|
1492 | + $arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error |
|
1493 | 1493 | |
1494 | 1494 | /* |
1495 | 1495 | * Lines of contracts |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($contratline->statut != ContratLigne::STATUS_OPEN) { |
404 | 404 | $contratline->context = $this->context; |
405 | 405 | |
406 | - $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE |
|
406 | + $result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE |
|
407 | 407 | if ($result < 0) { |
408 | 408 | $error++; |
409 | 409 | $this->error = $contratline->error; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | // Close lines not already closed |
454 | 454 | if ($contratline->statut != ContratLigne::STATUS_CLOSED) { |
455 | 455 | $contratline->date_end_real = $now; |
456 | - $contratline->date_cloture = $now; // For backward compatibility |
|
456 | + $contratline->date_cloture = $now; // For backward compatibility |
|
457 | 457 | $contratline->fk_user_cloture = $user->id; |
458 | 458 | $contratline->statut = ContratLigne::STATUS_CLOSED; |
459 | 459 | $result = $contratline->close_line($user, $now, $comment, $notrigger); |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | if (!$error) { |
585 | 585 | $this->ref = $num; |
586 | 586 | $this->status = self::STATUS_VALIDATED; |
587 | - $this->statut = self::STATUS_VALIDATED; // deprecated |
|
587 | + $this->statut = self::STATUS_VALIDATED; // deprecated |
|
588 | 588 | $this->date_validation = $now; |
589 | 589 | } |
590 | 590 | } else { |
@@ -844,10 +844,10 @@ discard block |
||
844 | 844 | $line->localtax2_tx = $objp->localtax2_tx; |
845 | 845 | $line->localtax1_type = $objp->localtax1_type; |
846 | 846 | $line->localtax2_type = $objp->localtax2_type; |
847 | - $line->subprice = $objp->subprice; |
|
847 | + $line->subprice = $objp->subprice; |
|
848 | 848 | $line->statut = $objp->status; |
849 | 849 | $line->status = $objp->status; |
850 | - $line->remise_percent = $objp->remise_percent; |
|
850 | + $line->remise_percent = $objp->remise_percent; |
|
851 | 851 | $line->price_ht = $objp->price_ht; |
852 | 852 | $line->price = $objp->price_ht; // For backward compatibility |
853 | 853 | $line->total_ht = $objp->total_ht; |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | //$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); |
891 | 891 | //$line->date_fin_reel = $this->db->jdate($objp->date_cloture); |
892 | 892 | |
893 | - $line->rang = $objp->rang; |
|
893 | + $line->rang = $objp->rang; |
|
894 | 894 | |
895 | 895 | // Retrieve all extrafields for contract line |
896 | 896 | // fetch optionals attributes and labels |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | if (!$error) { |
1402 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
1402 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
1403 | 1403 | if ($result < 0) { |
1404 | 1404 | $error++; |
1405 | 1405 | } |
@@ -2035,7 +2035,7 @@ discard block |
||
2035 | 2035 | } |
2036 | 2036 | $datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1); |
2037 | 2037 | } |
2038 | - $datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer; |
|
2038 | + $datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_customer; |
|
2039 | 2039 | if (!$nofetch) { |
2040 | 2040 | $langs->load('project'); |
2041 | 2041 | if (empty($this->project)) { |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | $label = $langs->trans("ShowContract"); |
2109 | 2109 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
2110 | 2110 | } |
2111 | - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2111 | + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
2112 | 2112 | $linkclose .= $dataparams.' class="'.$classfortooltip.'"'; |
2113 | 2113 | } |
2114 | 2114 | $linkstart = '<a href="'.$url.'"'; |
@@ -2509,7 +2509,7 @@ discard block |
||
2509 | 2509 | global $user; |
2510 | 2510 | |
2511 | 2511 | $ticket = new Ticket($this->db); |
2512 | - $nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id)); |
|
2512 | + $nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id)); |
|
2513 | 2513 | |
2514 | 2514 | return ($nbTicket < 0 ? $nbTicket : $ticket->lines); |
2515 | 2515 | } |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | global $conf, $langs; |
2532 | 2532 | |
2533 | 2533 | if (!dol_strlen($modele)) { |
2534 | - $modele = ''; // No doc template/generation by default |
|
2534 | + $modele = ''; // No doc template/generation by default |
|
2535 | 2535 | |
2536 | 2536 | if (!empty($this->model_pdf)) { |
2537 | 2537 | $modele = $this->model_pdf; |
@@ -2722,7 +2722,7 @@ discard block |
||
2722 | 2722 | |
2723 | 2723 | $error = 0; |
2724 | 2724 | $this->output = ''; |
2725 | - $this->error=''; |
|
2725 | + $this->error = ''; |
|
2726 | 2726 | |
2727 | 2727 | $contractlineprocessed = array(); |
2728 | 2728 | $contractignored = array(); |
@@ -2731,12 +2731,12 @@ discard block |
||
2731 | 2731 | dol_syslog(__METHOD__, LOG_DEBUG); |
2732 | 2732 | |
2733 | 2733 | $sql = 'SELECT c.rowid, c.ref_customer, cd.rowid as lid, cd.date_fin_validite, p.duration'; |
2734 | - $sql.= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd'; |
|
2735 | - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product'; |
|
2736 | - $sql.= ' WHERE cd.fk_contrat = c.rowid'; |
|
2737 | - $sql.= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')"; |
|
2738 | - $sql.= " AND cd.statut = 4"; |
|
2739 | - if ($thirdparty_id > 0) $sql.=" AND c.fk_soc = ".((int) $thirdparty_id); |
|
2734 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd'; |
|
2735 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product'; |
|
2736 | + $sql .= ' WHERE cd.fk_contrat = c.rowid'; |
|
2737 | + $sql .= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')"; |
|
2738 | + $sql .= " AND cd.statut = 4"; |
|
2739 | + if ($thirdparty_id > 0) $sql .= " AND c.fk_soc = ".((int) $thirdparty_id); |
|
2740 | 2740 | //print $sql; |
2741 | 2741 | |
2742 | 2742 | $resql = $this->db->query($sql); |
@@ -2745,7 +2745,7 @@ discard block |
||
2745 | 2745 | |
2746 | 2746 | include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; |
2747 | 2747 | |
2748 | - $i=0; |
|
2748 | + $i = 0; |
|
2749 | 2749 | while ($i < $num) { |
2750 | 2750 | $obj = $this->db->fetch_object($resql); |
2751 | 2751 | if ($obj) { |
@@ -2755,7 +2755,7 @@ discard block |
||
2755 | 2755 | |
2756 | 2756 | // Load contract |
2757 | 2757 | $object = new Contrat($this->db); |
2758 | - $object->fetch($obj->rowid); // fetch also lines |
|
2758 | + $object->fetch($obj->rowid); // fetch also lines |
|
2759 | 2759 | $object->fetch_thirdparty(); |
2760 | 2760 | |
2761 | 2761 | if ($object->id <= 0) { |
@@ -2779,9 +2779,9 @@ discard block |
||
2779 | 2779 | usort($object->linkedObjects['facture'], "cmp"); |
2780 | 2780 | |
2781 | 2781 | //dol_sort_array($contract->linkedObjects['facture'], 'date'); |
2782 | - $someinvoicenotpaid=0; |
|
2782 | + $someinvoicenotpaid = 0; |
|
2783 | 2783 | foreach ($object->linkedObjects['facture'] as $idinvoice => $invoice) { |
2784 | - if ($invoice->statut == Facture::STATUS_DRAFT) continue; // Draft invoice are not invoice not paid |
|
2784 | + if ($invoice->statut == Facture::STATUS_DRAFT) continue; // Draft invoice are not invoice not paid |
|
2785 | 2785 | |
2786 | 2786 | if (empty($invoice->paye)) { |
2787 | 2787 | $someinvoicenotpaid++; |
@@ -2789,7 +2789,7 @@ discard block |
||
2789 | 2789 | } |
2790 | 2790 | if ($someinvoicenotpaid) { |
2791 | 2791 | $this->output .= 'Contract '.$object->ref.' is qualified for renewal but there is '.$someinvoicenotpaid.' invoice(s) unpayed so we cancel renewal'."\n"; |
2792 | - $contractignored[$object->id]=$object->ref; |
|
2792 | + $contractignored[$object->id] = $object->ref; |
|
2793 | 2793 | continue; |
2794 | 2794 | } |
2795 | 2795 | } |
@@ -2797,7 +2797,7 @@ discard block |
||
2797 | 2797 | if ($expirationdate && $expirationdate < $enddatetoscan) { |
2798 | 2798 | dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate); |
2799 | 2799 | $newdate = $expirationdate; |
2800 | - $protecti=0; //$protecti is to avoid infinite loop |
|
2800 | + $protecti = 0; //$protecti is to avoid infinite loop |
|
2801 | 2801 | while ($newdate < $enddatetoscan && $protecti < 1000) { |
2802 | 2802 | $newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit); |
2803 | 2803 | $protecti++; |
@@ -2815,39 +2815,39 @@ discard block |
||
2815 | 2815 | $comment = 'Renew date of contract '.$object->ref.' line '.$obj->lid.' by doAutoRenewContracts'; |
2816 | 2816 | |
2817 | 2817 | $sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."contratdet SET date_fin_validite = '".$this->db->idate($newdate)."'"; |
2818 | - $sqlupdate.= ' WHERE rowid = '.((int) $obj->lid); |
|
2818 | + $sqlupdate .= ' WHERE rowid = '.((int) $obj->lid); |
|
2819 | 2819 | $resqlupdate = $this->db->query($sqlupdate); |
2820 | 2820 | if ($resqlupdate) { |
2821 | - $contractlineprocessed[$obj->lid]=$object->ref; |
|
2821 | + $contractlineprocessed[$obj->lid] = $object->ref; |
|
2822 | 2822 | |
2823 | 2823 | $actioncode = 'RENEW_CONTRACT'; |
2824 | 2824 | $now = dol_now(); |
2825 | 2825 | |
2826 | 2826 | // Create an event |
2827 | 2827 | $actioncomm = new ActionComm($this->db); |
2828 | - $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
2828 | + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) |
|
2829 | 2829 | $actioncomm->code = 'AC_'.$actioncode; |
2830 | 2830 | $actioncomm->label = $label; |
2831 | 2831 | $actioncomm->datep = $now; |
2832 | 2832 | $actioncomm->datef = $now; |
2833 | - $actioncomm->percentage = -1; // Not applicable |
|
2833 | + $actioncomm->percentage = -1; // Not applicable |
|
2834 | 2834 | $actioncomm->socid = $object->thirdparty->id; |
2835 | - $actioncomm->authorid = $user->id; // User saving action |
|
2836 | - $actioncomm->userownerid = $user->id; // Owner of action |
|
2835 | + $actioncomm->authorid = $user->id; // User saving action |
|
2836 | + $actioncomm->userownerid = $user->id; // Owner of action |
|
2837 | 2837 | $actioncomm->fk_element = $object->id; |
2838 | 2838 | $actioncomm->elementtype = 'contract'; |
2839 | 2839 | $actioncomm->note_private = $comment; |
2840 | 2840 | |
2841 | - $ret = $actioncomm->create($user); // User creating action |
|
2841 | + $ret = $actioncomm->create($user); // User creating action |
|
2842 | 2842 | } else { |
2843 | - $contracterror[$object->id]=$object->ref; |
|
2843 | + $contracterror[$object->id] = $object->ref; |
|
2844 | 2844 | |
2845 | 2845 | $error++; |
2846 | 2846 | $errorforlocaltransaction++; |
2847 | 2847 | $this->error = $this->db->lasterror(); |
2848 | 2848 | } |
2849 | 2849 | |
2850 | - if (! $errorforlocaltransaction) { |
|
2850 | + if (!$errorforlocaltransaction) { |
|
2851 | 2851 | $this->db->commit(); |
2852 | 2852 | } else { |
2853 | 2853 | $this->db->rollback(); |
@@ -2866,9 +2866,9 @@ discard block |
||
2866 | 2866 | $this->error = $this->db->lasterror(); |
2867 | 2867 | } |
2868 | 2868 | |
2869 | - $this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed)>0 ? ' : '.join(',', $contractlineprocessed) : ''); |
|
2869 | + $this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed) > 0 ? ' : '.join(',', $contractlineprocessed) : ''); |
|
2870 | 2870 | |
2871 | - return ($error ? 1: 0); |
|
2871 | + return ($error ? 1 : 0); |
|
2872 | 2872 | } |
2873 | 2873 | |
2874 | 2874 | /** |
@@ -3202,7 +3202,7 @@ discard block |
||
3202 | 3202 | } |
3203 | 3203 | |
3204 | 3204 | $link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'"'; |
3205 | - $link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
3205 | + $link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); |
|
3206 | 3206 | $link .= $dataparams.' class="'.$classfortooltip.'">'; |
3207 | 3207 | $linkend = '</a>'; |
3208 | 3208 |
@@ -841,16 +841,16 @@ discard block |
||
841 | 841 | } |
842 | 842 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
843 | 843 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
844 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
844 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
845 | 845 | } else { |
846 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
847 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
846 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
847 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
848 | 848 | $count++; |
849 | 849 | } |
850 | 850 | } |
851 | 851 | } |
852 | 852 | |
853 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
853 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
854 | 854 | $parameters = array( |
855 | 855 | 'tooltipcontentarray' => &$datas, |
856 | 856 | 'params' => $params, |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | if ($source == 'external' || $source == 'thirdparty') { |
1342 | 1342 | $sql .= " AND tc.source = 'external'"; |
1343 | 1343 | if ($status >= 0) { |
1344 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1344 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1345 | 1345 | } |
1346 | 1346 | } |
1347 | 1347 | $sql .= " AND tc.active = 1"; |
@@ -1700,8 +1700,8 @@ discard block |
||
1700 | 1700 | if ($idtofetch) { |
1701 | 1701 | $thirdparty = new Societe($this->db); |
1702 | 1702 | $result = $thirdparty->fetch($idtofetch); |
1703 | - if ($result<0) { |
|
1704 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
1703 | + if ($result < 0) { |
|
1704 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
1705 | 1705 | } |
1706 | 1706 | $this->thirdparty = $thirdparty; |
1707 | 1707 | |
@@ -2003,9 +2003,9 @@ discard block |
||
2003 | 2003 | if ($trigkey) { |
2004 | 2004 | $oldvalue = null; |
2005 | 2005 | |
2006 | - $sql = "SELECT " . $field; |
|
2007 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
2008 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
2006 | + $sql = "SELECT ".$field; |
|
2007 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
2008 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
2009 | 2009 | |
2010 | 2010 | $resql = $this->db->query($sql); |
2011 | 2011 | if ($resql) { |
@@ -2135,7 +2135,7 @@ discard block |
||
2135 | 2135 | } |
2136 | 2136 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
2137 | 2137 | $sql = "SELECT MAX(te.".$fieldid.")"; |
2138 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2138 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2139 | 2139 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2140 | 2140 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2141 | 2141 | } |
@@ -2209,7 +2209,7 @@ discard block |
||
2209 | 2209 | $this->ref_previous = $row[0]; |
2210 | 2210 | |
2211 | 2211 | $sql = "SELECT MIN(te.".$fieldid.")"; |
2212 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2212 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2213 | 2213 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2214 | 2214 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2215 | 2215 | } |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | // Triggers |
2368 | 2368 | if (!$error && !$notrigger) { |
2369 | 2369 | // Call triggers |
2370 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
2370 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
2371 | 2371 | if ($result < 0) { |
2372 | 2372 | $error++; |
2373 | 2373 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2732,7 +2732,7 @@ discard block |
||
2732 | 2732 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
2733 | 2733 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
2734 | 2734 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
2735 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2735 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2736 | 2736 | } |
2737 | 2737 | $sql .= ' WHERE rowid='.((int) $this->id); |
2738 | 2738 | |
@@ -3081,10 +3081,10 @@ discard block |
||
3081 | 3081 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
3082 | 3082 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3083 | 3083 | if (!$renum) { |
3084 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
3084 | + $sql .= " AND ".$fieldposition." = 0"; |
|
3085 | 3085 | } |
3086 | 3086 | if ($renum) { |
3087 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
3087 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
3088 | 3088 | } |
3089 | 3089 | |
3090 | 3090 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3105,7 +3105,7 @@ discard block |
||
3105 | 3105 | if ($fk_parent_line) { |
3106 | 3106 | $sql .= ' AND fk_parent_line IS NULL'; |
3107 | 3107 | } |
3108 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
3108 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
3109 | 3109 | |
3110 | 3110 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
3111 | 3111 | $resql = $this->db->query($sql); |
@@ -3156,7 +3156,7 @@ discard block |
||
3156 | 3156 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3157 | 3157 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3158 | 3158 | $sql .= ' AND fk_parent_line = '.((int) $id); |
3159 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
3159 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
3160 | 3160 | |
3161 | 3161 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
3162 | 3162 | $resql = $this->db->query($sql); |
@@ -3239,8 +3239,8 @@ discard block |
||
3239 | 3239 | dol_print_error($this->db); |
3240 | 3240 | return -1; |
3241 | 3241 | } else { |
3242 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3243 | - $action=''; |
|
3242 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3243 | + $action = ''; |
|
3244 | 3244 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
3245 | 3245 | return 1; |
3246 | 3246 | } |
@@ -3279,7 +3279,7 @@ discard block |
||
3279 | 3279 | |
3280 | 3280 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3281 | 3281 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3282 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
3282 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
3283 | 3283 | if ($this->db->query($sql)) { |
3284 | 3284 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
3285 | 3285 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3310,7 +3310,7 @@ discard block |
||
3310 | 3310 | |
3311 | 3311 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3312 | 3312 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3313 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
3313 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
3314 | 3314 | if ($this->db->query($sql)) { |
3315 | 3315 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
3316 | 3316 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3336,7 +3336,7 @@ discard block |
||
3336 | 3336 | $fieldposition = 'position'; |
3337 | 3337 | } |
3338 | 3338 | |
3339 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
3339 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
3340 | 3340 | $sql .= " WHERE rowid = ".((int) $rowid); |
3341 | 3341 | |
3342 | 3342 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3364,7 +3364,7 @@ discard block |
||
3364 | 3364 | |
3365 | 3365 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3366 | 3366 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3367 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
3367 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
3368 | 3368 | $resql = $this->db->query($sql); |
3369 | 3369 | if ($resql) { |
3370 | 3370 | $row = $this->db->fetch_row($resql); |
@@ -3481,7 +3481,7 @@ discard block |
||
3481 | 3481 | $newsuffix = ''; |
3482 | 3482 | } |
3483 | 3483 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
3484 | - $fieldusermod = "fk_user_mod"; |
|
3484 | + $fieldusermod = "fk_user_mod"; |
|
3485 | 3485 | } elseif ($this->table_element == 'ecm_files') { |
3486 | 3486 | $fieldusermod = "fk_user_m"; |
3487 | 3487 | } else { |
@@ -3853,7 +3853,7 @@ discard block |
||
3853 | 3853 | // It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target. |
3854 | 3854 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
3855 | 3855 | // Add module part to target type if object has $module property and isn't in core modules. |
3856 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3856 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3857 | 3857 | |
3858 | 3858 | $parameters = array('targettype'=>$targettype); |
3859 | 3859 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3865,19 +3865,19 @@ discard block |
||
3865 | 3865 | $this->db->begin(); |
3866 | 3866 | $error = 0; |
3867 | 3867 | |
3868 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
3868 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
3869 | 3869 | $sql .= "fk_source"; |
3870 | 3870 | $sql .= ", sourcetype"; |
3871 | 3871 | $sql .= ", fk_target"; |
3872 | 3872 | $sql .= ", targettype"; |
3873 | 3873 | $sql .= ") VALUES ("; |
3874 | 3874 | $sql .= ((int) $origin_id); |
3875 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
3876 | - $sql .= ", " . ((int) $this->id); |
|
3877 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
3875 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
3876 | + $sql .= ", ".((int) $this->id); |
|
3877 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
3878 | 3878 | $sql .= ")"; |
3879 | 3879 | |
3880 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
3880 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
3881 | 3881 | if ($this->db->query($sql)) { |
3882 | 3882 | if (!$notrigger) { |
3883 | 3883 | // Call trigger |
@@ -4184,20 +4184,20 @@ discard block |
||
4184 | 4184 | $this->db->begin(); |
4185 | 4185 | $error = 0; |
4186 | 4186 | |
4187 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
4187 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
4188 | 4188 | if ($updatesource) { |
4189 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
4190 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4191 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
4192 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4189 | + $sql .= "fk_source = ".((int) $sourceid); |
|
4190 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4191 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
4192 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
4193 | 4193 | } elseif ($updatetarget) { |
4194 | - $sql .= "fk_target = " . ((int) $targetid); |
|
4195 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
4196 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
4197 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4194 | + $sql .= "fk_target = ".((int) $targetid); |
|
4195 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
4196 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
4197 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4198 | 4198 | } |
4199 | 4199 | |
4200 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
4200 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
4201 | 4201 | if ($this->db->query($sql)) { |
4202 | 4202 | if (!$notrigger) { |
4203 | 4203 | // Call trigger |
@@ -4273,25 +4273,25 @@ discard block |
||
4273 | 4273 | } |
4274 | 4274 | |
4275 | 4275 | if (!$error) { |
4276 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
4276 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
4277 | 4277 | $sql .= " WHERE"; |
4278 | 4278 | if ($rowid > 0) { |
4279 | - $sql .= " rowid = " . ((int) $rowid); |
|
4279 | + $sql .= " rowid = ".((int) $rowid); |
|
4280 | 4280 | } else { |
4281 | 4281 | if ($deletesource) { |
4282 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4283 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4282 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4283 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
4284 | 4284 | } elseif ($deletetarget) { |
4285 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
4286 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4285 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
4286 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4287 | 4287 | } else { |
4288 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
4288 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
4289 | 4289 | $sql .= " OR"; |
4290 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
4290 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
4291 | 4291 | } |
4292 | 4292 | } |
4293 | 4293 | |
4294 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
4294 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
4295 | 4295 | if (!$this->db->query($sql)) { |
4296 | 4296 | $this->error = $this->db->lasterror(); |
4297 | 4297 | $this->errors[] = $this->error; |
@@ -4453,14 +4453,14 @@ discard block |
||
4453 | 4453 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
4454 | 4454 | } |
4455 | 4455 | $sql .= " WHERE rowid = ".((int) $elementId); |
4456 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4456 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4457 | 4457 | |
4458 | 4458 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
4459 | 4459 | $resql = $this->db->query($sql); |
4460 | 4460 | if ($resql) { |
4461 | 4461 | $error = 0; |
4462 | 4462 | |
4463 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4463 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4464 | 4464 | |
4465 | 4465 | if ($nb_rows_affected > 0) { |
4466 | 4466 | if (empty($trigkey)) { |
@@ -4614,7 +4614,7 @@ discard block |
||
4614 | 4614 | return -1; |
4615 | 4615 | } |
4616 | 4616 | |
4617 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
4617 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
4618 | 4618 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
4619 | 4619 | $tmparray = array_keys($this->childtables); |
4620 | 4620 | if (is_numeric($tmparray[0])) { |
@@ -4627,26 +4627,26 @@ discard block |
||
4627 | 4627 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
4628 | 4628 | // Check if element can be deleted |
4629 | 4629 | $sql = "SELECT COUNT(*) as nb"; |
4630 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
4630 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
4631 | 4631 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4632 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4632 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4633 | 4633 | } |
4634 | 4634 | if (!empty($element['fk_element'])) { |
4635 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
4635 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
4636 | 4636 | } else { |
4637 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4637 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4638 | 4638 | } |
4639 | 4639 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4640 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
4640 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
4641 | 4641 | } |
4642 | 4642 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
4643 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
4643 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
4644 | 4644 | } |
4645 | 4645 | if (!empty($entity)) { |
4646 | 4646 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4647 | - $sql.= " AND p.entity = ".((int) $entity); |
|
4647 | + $sql .= " AND p.entity = ".((int) $entity); |
|
4648 | 4648 | } else { |
4649 | - $sql.= " AND c.entity = ".((int) $entity); |
|
4649 | + $sql .= " AND c.entity = ".((int) $entity); |
|
4650 | 4650 | } |
4651 | 4651 | } |
4652 | 4652 | |
@@ -4660,9 +4660,9 @@ discard block |
||
4660 | 4660 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
4661 | 4661 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
4662 | 4662 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
4663 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4663 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4664 | 4664 | } else { // new usage: $element['name']=Translation key |
4665 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4665 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4666 | 4666 | } |
4667 | 4667 | break; // We found at least one, we stop here |
4668 | 4668 | } |
@@ -4721,7 +4721,7 @@ discard block |
||
4721 | 4721 | */ |
4722 | 4722 | public function getTotalDiscount() |
4723 | 4723 | { |
4724 | - if (!empty($this->table_element_line) ) { |
|
4724 | + if (!empty($this->table_element_line)) { |
|
4725 | 4725 | $total_discount = 0.00; |
4726 | 4726 | |
4727 | 4727 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5671,7 +5671,7 @@ discard block |
||
5671 | 5671 | $setsharekey = false; |
5672 | 5672 | if ($this->element == 'propal' || $this->element == 'proposal') { |
5673 | 5673 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
5674 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5674 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5675 | 5675 | } |
5676 | 5676 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
5677 | 5677 | $setsharekey = true; |
@@ -5729,7 +5729,7 @@ discard block |
||
5729 | 5729 | $ecmfile->gen_or_uploaded = 'generated'; |
5730 | 5730 | $ecmfile->description = ''; // indexed content |
5731 | 5731 | $ecmfile->keywords = ''; // keyword content |
5732 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5732 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5733 | 5733 | $ecmfile->src_object_id = $this->id; |
5734 | 5734 | |
5735 | 5735 | $result = $ecmfile->create($user); |
@@ -5781,7 +5781,7 @@ discard block |
||
5781 | 5781 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
5782 | 5782 | $maxheightmini = $tmparraysize['maxheightmini']; |
5783 | 5783 | //$quality = $tmparraysize['quality']; |
5784 | - $quality = 50; // For thumbs, we force quality to 50 |
|
5784 | + $quality = 50; // For thumbs, we force quality to 50 |
|
5785 | 5785 | |
5786 | 5786 | // Create small thumbs for company (Ratio is near 16/9) |
5787 | 5787 | // Used on logon for example |
@@ -5882,8 +5882,8 @@ discard block |
||
5882 | 5882 | { |
5883 | 5883 | // phpcs:enable |
5884 | 5884 | global $langs, $conf; |
5885 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
5886 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
5885 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
5886 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
5887 | 5887 | exit; |
5888 | 5888 | } |
5889 | 5889 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6181,9 +6181,9 @@ discard block |
||
6181 | 6181 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
6182 | 6182 | //var_dump($conf->disable_compute); |
6183 | 6183 | if (empty($conf->disable_compute)) { |
6184 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
6185 | - $objectoffield = $this; // we can use it inside computed formula |
|
6186 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
6184 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
6185 | + $objectoffield = $this; // we can use it inside computed formula |
|
6186 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
6187 | 6187 | } |
6188 | 6188 | } |
6189 | 6189 | } |
@@ -6197,7 +6197,7 @@ discard block |
||
6197 | 6197 | return 0; |
6198 | 6198 | } |
6199 | 6199 | } else { |
6200 | - $this->errors[]=$this->db->lasterror; |
|
6200 | + $this->errors[] = $this->db->lasterror; |
|
6201 | 6201 | return -1; |
6202 | 6202 | } |
6203 | 6203 | } |
@@ -6364,7 +6364,7 @@ discard block |
||
6364 | 6364 | // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. |
6365 | 6365 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
6366 | 6366 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
6367 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
6367 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
6368 | 6368 | } else { |
6369 | 6369 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
6370 | 6370 | } |
@@ -6375,7 +6375,7 @@ discard block |
||
6375 | 6375 | // If value has changed |
6376 | 6376 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
6377 | 6377 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
6378 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
6378 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
6379 | 6379 | } else { |
6380 | 6380 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
6381 | 6381 | } |
@@ -6387,7 +6387,7 @@ discard block |
||
6387 | 6387 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
6388 | 6388 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
6389 | 6389 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
6390 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
6390 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
6391 | 6391 | } else { |
6392 | 6392 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
6393 | 6393 | } |
@@ -6773,7 +6773,7 @@ discard block |
||
6773 | 6773 | if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) { // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. |
6774 | 6774 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
6775 | 6775 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
6776 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
6776 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
6777 | 6777 | } else { |
6778 | 6778 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
6779 | 6779 | } |
@@ -6793,7 +6793,7 @@ discard block |
||
6793 | 6793 | } |
6794 | 6794 | } else { |
6795 | 6795 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
6796 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
6796 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
6797 | 6797 | } else { |
6798 | 6798 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
6799 | 6799 | } |
@@ -7042,7 +7042,7 @@ discard block |
||
7042 | 7042 | // Special case that force options and type ($type can be integer, varchar, ...) |
7043 | 7043 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
7044 | 7044 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
7045 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
7045 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
7046 | 7046 | } |
7047 | 7047 | |
7048 | 7048 | $label = $this->fields[$key]['label']; |
@@ -7094,7 +7094,7 @@ discard block |
||
7094 | 7094 | |
7095 | 7095 | // Add validation state class |
7096 | 7096 | if (!empty($validationClass)) { |
7097 | - $morecss.= $validationClass; |
|
7097 | + $morecss .= $validationClass; |
|
7098 | 7098 | } |
7099 | 7099 | |
7100 | 7100 | if (in_array($type, array('date'))) { |
@@ -7238,8 +7238,8 @@ discard block |
||
7238 | 7238 | } |
7239 | 7239 | |
7240 | 7240 | $sqlwhere = ''; |
7241 | - $sql = "SELECT " . $keyList; |
|
7242 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
7241 | + $sql = "SELECT ".$keyList; |
|
7242 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
7243 | 7243 | if (!empty($InfoFieldList[4])) { |
7244 | 7244 | // can use SELECT request |
7245 | 7245 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7255,24 +7255,24 @@ discard block |
||
7255 | 7255 | |
7256 | 7256 | //We have to join on extrafield table |
7257 | 7257 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7258 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
7259 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7258 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
7259 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7260 | 7260 | } else { |
7261 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7261 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7262 | 7262 | } |
7263 | 7263 | } else { |
7264 | 7264 | $sqlwhere .= ' WHERE 1=1'; |
7265 | 7265 | } |
7266 | 7266 | // Some tables may have field, some other not. For the moment we disable it. |
7267 | 7267 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7268 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7268 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7269 | 7269 | } |
7270 | 7270 | $sql .= $sqlwhere; |
7271 | 7271 | //print $sql; |
7272 | 7272 | |
7273 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
7273 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
7274 | 7274 | |
7275 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
7275 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
7276 | 7276 | $resql = $this->db->query($sql); |
7277 | 7277 | if ($resql) { |
7278 | 7278 | $out .= '<option value="0"> </option>'; |
@@ -7288,7 +7288,7 @@ discard block |
||
7288 | 7288 | if (count($fields_label) > 1) { |
7289 | 7289 | $notrans = true; |
7290 | 7290 | foreach ($fields_label as $field_toshow) { |
7291 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7291 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7292 | 7292 | } |
7293 | 7293 | } else { |
7294 | 7294 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7299,12 +7299,12 @@ discard block |
||
7299 | 7299 | foreach ($fields_label as $field_toshow) { |
7300 | 7300 | $translabel = $langs->trans($obj->$field_toshow); |
7301 | 7301 | if ($translabel != $obj->$field_toshow) { |
7302 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
7302 | + $labeltoshow = dol_trunc($translabel).' '; |
|
7303 | 7303 | } else { |
7304 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
7304 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
7305 | 7305 | } |
7306 | 7306 | } |
7307 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7307 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7308 | 7308 | } else { |
7309 | 7309 | if (!$notrans) { |
7310 | 7310 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7318,34 +7318,34 @@ discard block |
||
7318 | 7318 | $labeltoshow = '(not defined)'; |
7319 | 7319 | } |
7320 | 7320 | if ($value == $obj->rowid) { |
7321 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7321 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7322 | 7322 | } |
7323 | 7323 | |
7324 | 7324 | if (!empty($InfoFieldList[3]) && $parentField) { |
7325 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7325 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7326 | 7326 | $isDependList = 1; |
7327 | 7327 | } |
7328 | 7328 | |
7329 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
7329 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
7330 | 7330 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
7331 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
7332 | - $out .= '>' . $labeltoshow . '</option>'; |
|
7331 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
7332 | + $out .= '>'.$labeltoshow.'</option>'; |
|
7333 | 7333 | } |
7334 | 7334 | |
7335 | 7335 | $i++; |
7336 | 7336 | } |
7337 | 7337 | $this->db->free($resql); |
7338 | 7338 | } else { |
7339 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7339 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7340 | 7340 | } |
7341 | 7341 | } else { |
7342 | 7342 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7343 | 7343 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7344 | 7344 | $out .= '<option value="0"> </option>'; |
7345 | 7345 | foreach ($data as $data_key => $data_value) { |
7346 | - $out .= '<option value="' . $data_key . '"'; |
|
7346 | + $out .= '<option value="'.$data_key.'"'; |
|
7347 | 7347 | $out .= ($value == $data_key ? ' selected' : ''); |
7348 | - $out .= '>' . $data_value . '</option>'; |
|
7348 | + $out .= '>'.$data_value.'</option>'; |
|
7349 | 7349 | } |
7350 | 7350 | } |
7351 | 7351 | } |
@@ -7410,8 +7410,8 @@ discard block |
||
7410 | 7410 | } |
7411 | 7411 | |
7412 | 7412 | $sqlwhere = ''; |
7413 | - $sql = "SELECT " . $keyList; |
|
7414 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
7413 | + $sql = "SELECT ".$keyList; |
|
7414 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
7415 | 7415 | if (!empty($InfoFieldList[4])) { |
7416 | 7416 | // can use SELECT request |
7417 | 7417 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7427,23 +7427,23 @@ discard block |
||
7427 | 7427 | |
7428 | 7428 | // We have to join on extrafield table |
7429 | 7429 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7430 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
7431 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7430 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
7431 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7432 | 7432 | } else { |
7433 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7433 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7434 | 7434 | } |
7435 | 7435 | } else { |
7436 | 7436 | $sqlwhere .= ' WHERE 1=1'; |
7437 | 7437 | } |
7438 | 7438 | // Some tables may have field, some other not. For the moment we disable it. |
7439 | 7439 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7440 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7440 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7441 | 7441 | } |
7442 | 7442 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
7443 | 7443 | // print $sql; |
7444 | 7444 | |
7445 | 7445 | $sql .= $sqlwhere; |
7446 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
7446 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
7447 | 7447 | $resql = $this->db->query($sql); |
7448 | 7448 | if ($resql) { |
7449 | 7449 | $num = $this->db->num_rows($resql); |
@@ -7461,7 +7461,7 @@ discard block |
||
7461 | 7461 | if (count($fields_label) > 1) { |
7462 | 7462 | $notrans = true; |
7463 | 7463 | foreach ($fields_label as $field_toshow) { |
7464 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7464 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7465 | 7465 | } |
7466 | 7466 | } else { |
7467 | 7467 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7472,9 +7472,9 @@ discard block |
||
7472 | 7472 | foreach ($fields_label as $field_toshow) { |
7473 | 7473 | $translabel = $langs->trans($obj->$field_toshow); |
7474 | 7474 | if ($translabel != $obj->$field_toshow) { |
7475 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
7475 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
7476 | 7476 | } else { |
7477 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
7477 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
7478 | 7478 | } |
7479 | 7479 | } |
7480 | 7480 | |
@@ -7497,7 +7497,7 @@ discard block |
||
7497 | 7497 | } |
7498 | 7498 | |
7499 | 7499 | if (!empty($InfoFieldList[3]) && $parentField) { |
7500 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7500 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7501 | 7501 | $isDependList = 1; |
7502 | 7502 | } |
7503 | 7503 | |
@@ -7508,14 +7508,14 @@ discard block |
||
7508 | 7508 | } |
7509 | 7509 | $this->db->free($resql); |
7510 | 7510 | |
7511 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7511 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7512 | 7512 | } else { |
7513 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7513 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7514 | 7514 | } |
7515 | 7515 | } else { |
7516 | 7516 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7517 | 7517 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7518 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7518 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7519 | 7519 | } |
7520 | 7520 | } |
7521 | 7521 | } elseif ($type == 'link') { |
@@ -7596,7 +7596,7 @@ discard block |
||
7596 | 7596 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
7597 | 7597 | } |
7598 | 7598 | |
7599 | - if ($isDependList==1) { |
|
7599 | + if ($isDependList == 1) { |
|
7600 | 7600 | $out .= $this->getJSListDependancies('_common'); |
7601 | 7601 | } |
7602 | 7602 | /* Add comments |
@@ -7647,7 +7647,7 @@ discard block |
||
7647 | 7647 | $type = 'varchar'; // convert varchar(xx) int varchar |
7648 | 7648 | } |
7649 | 7649 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
7650 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
7650 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
7651 | 7651 | } |
7652 | 7652 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
7653 | 7653 | $type = 'link'; |
@@ -7731,7 +7731,7 @@ discard block |
||
7731 | 7731 | $value = $this->getLibStatut(3); |
7732 | 7732 | } elseif ($type == 'date') { |
7733 | 7733 | if (!empty($value)) { |
7734 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7734 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7735 | 7735 | } else { |
7736 | 7736 | $value = ''; |
7737 | 7737 | } |
@@ -7769,7 +7769,7 @@ discard block |
||
7769 | 7769 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
7770 | 7770 | } |
7771 | 7771 | } elseif ($type == 'select') { |
7772 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
7772 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
7773 | 7773 | } elseif ($type == 'sellist') { |
7774 | 7774 | $param_list = array_keys($param['options']); |
7775 | 7775 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7829,9 +7829,9 @@ discard block |
||
7829 | 7829 | $translabel = $langs->trans($obj->$field_toshow); |
7830 | 7830 | } |
7831 | 7831 | if ($translabel != $field_toshow) { |
7832 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
7832 | + $value .= dol_trunc($translabel, 18).' '; |
|
7833 | 7833 | } else { |
7834 | - $value .= $obj->$field_toshow . ' '; |
|
7834 | + $value .= $obj->$field_toshow.' '; |
|
7835 | 7835 | } |
7836 | 7836 | } |
7837 | 7837 | } else { |
@@ -7847,7 +7847,7 @@ discard block |
||
7847 | 7847 | } |
7848 | 7848 | } |
7849 | 7849 | } else { |
7850 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7850 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7851 | 7851 | |
7852 | 7852 | $toprint = array(); |
7853 | 7853 | $obj = $this->db->fetch_object($resql); |
@@ -7855,7 +7855,7 @@ discard block |
||
7855 | 7855 | $c->fetch($obj->rowid); |
7856 | 7856 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7857 | 7857 | foreach ($ways as $way) { |
7858 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7858 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7859 | 7859 | } |
7860 | 7860 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
7861 | 7861 | } |
@@ -7871,11 +7871,11 @@ discard block |
||
7871 | 7871 | $toprint = array(); |
7872 | 7872 | foreach ($value_arr as $keyval => $valueval) { |
7873 | 7873 | if (!empty($valueval)) { |
7874 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
7874 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
7875 | 7875 | } |
7876 | 7876 | } |
7877 | 7877 | if (!empty($toprint)) { |
7878 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
7878 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
7879 | 7879 | } |
7880 | 7880 | } |
7881 | 7881 | } elseif ($type == 'chkbxlst') { |
@@ -7930,9 +7930,9 @@ discard block |
||
7930 | 7930 | $translabel = $langs->trans($obj->$field_toshow); |
7931 | 7931 | } |
7932 | 7932 | if ($translabel != $field_toshow) { |
7933 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7933 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7934 | 7934 | } else { |
7935 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
7935 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
7936 | 7936 | } |
7937 | 7937 | } |
7938 | 7938 | } else { |
@@ -7941,15 +7941,15 @@ discard block |
||
7941 | 7941 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
7942 | 7942 | } |
7943 | 7943 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
7944 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7944 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7945 | 7945 | } else { |
7946 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
7946 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
7947 | 7947 | } |
7948 | 7948 | } |
7949 | 7949 | } |
7950 | 7950 | } |
7951 | 7951 | } else { |
7952 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7952 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7953 | 7953 | |
7954 | 7954 | $toprint = array(); |
7955 | 7955 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -7958,7 +7958,7 @@ discard block |
||
7958 | 7958 | $c->fetch($obj->rowid); |
7959 | 7959 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7960 | 7960 | foreach ($ways as $way) { |
7961 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7961 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7962 | 7962 | } |
7963 | 7963 | } |
7964 | 7964 | } |
@@ -8092,7 +8092,7 @@ discard block |
||
8092 | 8092 | global $langs; |
8093 | 8093 | |
8094 | 8094 | if (!class_exists('Validate')) { |
8095 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
8095 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
8096 | 8096 | } |
8097 | 8097 | |
8098 | 8098 | $this->clearFieldError($fieldKey); |
@@ -8306,7 +8306,7 @@ discard block |
||
8306 | 8306 | $out .= "\n"; |
8307 | 8307 | |
8308 | 8308 | $nbofextrafieldsshown = 0; |
8309 | - $e = 0; // var to manage the modulo (odd/even) |
|
8309 | + $e = 0; // var to manage the modulo (odd/even) |
|
8310 | 8310 | |
8311 | 8311 | $lastseparatorkeyfound = ''; |
8312 | 8312 | $extrafields_collapse_num = ''; |
@@ -8357,7 +8357,7 @@ discard block |
||
8357 | 8357 | } |
8358 | 8358 | |
8359 | 8359 | $colspan = 0; |
8360 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
8360 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
8361 | 8361 | if (array_key_exists('cols', $params)) { |
8362 | 8362 | $colspan = $params['cols']; |
8363 | 8363 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8444,7 +8444,7 @@ discard block |
||
8444 | 8444 | $domData .= ' data-targetid="'.$this->id.'"'; |
8445 | 8445 | |
8446 | 8446 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
8447 | - if ($display_type=='card') { |
|
8447 | + if ($display_type == 'card') { |
|
8448 | 8448 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
8449 | 8449 | $colspan = 0; |
8450 | 8450 | } |
@@ -8555,12 +8555,12 @@ discard block |
||
8555 | 8555 | break; |
8556 | 8556 | } |
8557 | 8557 | |
8558 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
8558 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
8559 | 8559 | |
8560 | 8560 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
8561 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8561 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8562 | 8562 | } else { |
8563 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8563 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8564 | 8564 | } |
8565 | 8565 | |
8566 | 8566 | $e++; |
@@ -8943,7 +8943,7 @@ discard block |
||
8943 | 8943 | if ($val['share']) { |
8944 | 8944 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
8945 | 8945 | $return .= '<!-- Show original file (thumb not yet available with shared links) -->'; |
8946 | - $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">'; |
|
8946 | + $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">'; |
|
8947 | 8947 | } else { |
8948 | 8948 | $return .= '<!-- Show original file -->'; |
8949 | 8949 | $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">'; |
@@ -8955,7 +8955,7 @@ discard block |
||
8955 | 8955 | } else { |
8956 | 8956 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
8957 | 8957 | $return .= '<!-- Show thumb -->'; |
8958 | - $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; |
|
8958 | + $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">'; |
|
8959 | 8959 | } else { |
8960 | 8960 | $return .= '<!-- Show original file -->'; |
8961 | 8961 | $return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">'; |
@@ -9364,7 +9364,7 @@ discard block |
||
9364 | 9364 | continue; |
9365 | 9365 | } |
9366 | 9366 | } |
9367 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
9367 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
9368 | 9368 | } |
9369 | 9369 | return implode(',', $keys_with_alias); |
9370 | 9370 | } else { |
@@ -9480,7 +9480,7 @@ discard block |
||
9480 | 9480 | if (!$error) { |
9481 | 9481 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
9482 | 9482 | $sql .= " (".implode(", ", $keys).')'; |
9483 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9483 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9484 | 9484 | |
9485 | 9485 | $res = $this->db->query($sql); |
9486 | 9486 | if (!$res) { |
@@ -9748,7 +9748,7 @@ discard block |
||
9748 | 9748 | |
9749 | 9749 | // Update extrafield |
9750 | 9750 | if (!$error) { |
9751 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
9751 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
9752 | 9752 | if ($result < 0) { |
9753 | 9753 | $error++; |
9754 | 9754 | } |
@@ -10276,7 +10276,7 @@ discard block |
||
10276 | 10276 | // Process |
10277 | 10277 | foreach ($to_del as $del) { |
10278 | 10278 | if ($c->fetch($del) > 0) { |
10279 | - $result=$c->del_type($this, $type_categ); |
|
10279 | + $result = $c->del_type($this, $type_categ); |
|
10280 | 10280 | if ($result < 0) { |
10281 | 10281 | $error++; |
10282 | 10282 | $this->error = $c->error; |