@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | // Protection to avoid direct call of template |
25 | 25 | if (empty($conf) || ! is_object($conf)) |
26 | 26 | { |
27 | - print "Error, template page can't be called as URL"; |
|
28 | - exit; |
|
27 | + print "Error, template page can't be called as URL"; |
|
28 | + exit; |
|
29 | 29 | } |
30 | 30 | if (! is_object($form)) $form=new Form($db); |
31 | 31 | |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | |
38 | 38 | foreach($object->fields as $key => $val) |
39 | 39 | { |
40 | - // Discard if extrafield is a hidden field on form |
|
41 | - if (abs($val['visible']) != 1) continue; |
|
40 | + // Discard if extrafield is a hidden field on form |
|
41 | + if (abs($val['visible']) != 1) continue; |
|
42 | 42 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
43 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
44 | 44 | |
45 | - print '<tr><td'; |
|
46 | - print ' class="titlefieldcreate'; |
|
47 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
48 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
49 | - print '">'; |
|
50 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
51 | - else print $langs->trans($val['label']); |
|
52 | - print '</td>'; |
|
53 | - print '<td>'; |
|
54 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key; |
|
55 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key; |
|
56 | - else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key; |
|
57 | - //var_dump($val.' '.$key.' '.$value); |
|
58 | - print $object->showInputField($val, $key, $value, '', '', '', 0); |
|
59 | - print '</td>'; |
|
60 | - print '</tr>'; |
|
45 | + print '<tr><td'; |
|
46 | + print ' class="titlefieldcreate'; |
|
47 | + if ($val['notnull'] > 0) print ' fieldrequired'; |
|
48 | + if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
49 | + print '">'; |
|
50 | + if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
51 | + else print $langs->trans($val['label']); |
|
52 | + print '</td>'; |
|
53 | + print '<td>'; |
|
54 | + if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key; |
|
55 | + elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key; |
|
56 | + else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key; |
|
57 | + //var_dump($val.' '.$key.' '.$value); |
|
58 | + print $object->showInputField($val, $key, $value, '', '', '', 0); |
|
59 | + print '</td>'; |
|
60 | + print '</tr>'; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | ?> |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | // Protection to avoid direct call of template |
25 | -if (empty($conf) || ! is_object($conf)) |
|
25 | +if (empty($conf) || !is_object($conf)) |
|
26 | 26 | { |
27 | 27 | print "Error, template page can't be called as URL"; |
28 | 28 | exit; |
29 | 29 | } |
30 | -if (! is_object($form)) $form=new Form($db); |
|
30 | +if (!is_object($form)) $form = new Form($db); |
|
31 | 31 | |
32 | 32 | ?> |
33 | 33 | <!-- BEGIN PHP TEMPLATE commonfields_edit.tpl.php --> |
@@ -35,25 +35,25 @@ discard block |
||
35 | 35 | |
36 | 36 | $object->fields = dol_sort_array($object->fields, 'position'); |
37 | 37 | |
38 | -foreach($object->fields as $key => $val) |
|
38 | +foreach ($object->fields as $key => $val) |
|
39 | 39 | { |
40 | 40 | // Discard if extrafield is a hidden field on form |
41 | 41 | if (abs($val['visible']) != 1) continue; |
42 | 42 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
43 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && !verifCond($val['enabled'])) continue; // We don't want this field |
|
44 | 44 | |
45 | 45 | print '<tr><td'; |
46 | 46 | print ' class="titlefieldcreate'; |
47 | 47 | if ($val['notnull'] > 0) print ' fieldrequired'; |
48 | 48 | if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
49 | 49 | print '">'; |
50 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
50 | + if (!empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
51 | 51 | else print $langs->trans($val['label']); |
52 | 52 | print '</td>'; |
53 | 53 | print '<td>'; |
54 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key; |
|
55 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key; |
|
56 | - else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key; |
|
54 | + if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key; |
|
55 | + elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key) ?GETPOST($key, 'none') : $object->$key; |
|
56 | + else $value = GETPOSTISSET($key) ?GETPOST($key, 'alpha') : $object->$key; |
|
57 | 57 | //var_dump($val.' '.$key.' '.$value); |
58 | 58 | print $object->showInputField($val, $key, $value, '', '', '', 0); |
59 | 59 | print '</td>'; |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | print "Error, template page can't be called as URL"; |
28 | 28 | exit; |
29 | 29 | } |
30 | -if (! is_object($form)) $form=new Form($db); |
|
30 | +if (! is_object($form)) { |
|
31 | + $form=new Form($db); |
|
32 | +} |
|
31 | 33 | |
32 | 34 | ?> |
33 | 35 | <!-- BEGIN PHP TEMPLATE commonfields_edit.tpl.php --> |
@@ -38,22 +40,38 @@ discard block |
||
38 | 40 | foreach($object->fields as $key => $val) |
39 | 41 | { |
40 | 42 | // Discard if extrafield is a hidden field on form |
41 | - if (abs($val['visible']) != 1) continue; |
|
43 | + if (abs($val['visible']) != 1) { |
|
44 | + continue; |
|
45 | + } |
|
42 | 46 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
47 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) { |
|
48 | + continue; |
|
49 | + } |
|
50 | + // We don't want this field |
|
44 | 51 | |
45 | 52 | print '<tr><td'; |
46 | 53 | print ' class="titlefieldcreate'; |
47 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
48 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
54 | + if ($val['notnull'] > 0) { |
|
55 | + print ' fieldrequired'; |
|
56 | + } |
|
57 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
58 | + print ' tdtop'; |
|
59 | + } |
|
49 | 60 | print '">'; |
50 | - if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
51 | - else print $langs->trans($val['label']); |
|
61 | + if (! empty($val['help'])) { |
|
62 | + print $form->textwithpicto($langs->trans($val['label']), $val['help']); |
|
63 | + } else { |
|
64 | + print $langs->trans($val['label']); |
|
65 | + } |
|
52 | 66 | print '</td>'; |
53 | 67 | print '<td>'; |
54 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key; |
|
55 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key; |
|
56 | - else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key; |
|
68 | + if (in_array($val['type'], array('int', 'integer'))) { |
|
69 | + $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key; |
|
70 | + } elseif ($val['type'] == 'text' || $val['type'] == 'html') { |
|
71 | + $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key; |
|
72 | + } else { |
|
73 | + $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key; |
|
74 | + } |
|
57 | 75 | //var_dump($val.' '.$key.' '.$value); |
58 | 76 | print $object->showInputField($val, $key, $value, '', '', '', 0); |
59 | 77 | print '</td>'; |
@@ -35,74 +35,74 @@ |
||
35 | 35 | |
36 | 36 | $fixedDiscount = $thirdparty->remise_percent; |
37 | 37 | if(! empty($discount_type)) { |
38 | - $fixedDiscount = $thirdparty->remise_supplier_percent; |
|
38 | + $fixedDiscount = $thirdparty->remise_supplier_percent; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | if ($fixedDiscount > 0) |
42 | 42 | { |
43 | - $translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; |
|
44 | - print $langs->trans($translationKey, $fixedDiscount).'.'; |
|
43 | + $translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; |
|
44 | + print $langs->trans($translationKey, $fixedDiscount).'.'; |
|
45 | 45 | } |
46 | 46 | else |
47 | 47 | { |
48 | - $translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; |
|
49 | - print $langs->trans($translationKey).'.'; |
|
48 | + $translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; |
|
49 | + print $langs->trans($translationKey).'.'; |
|
50 | 50 | } |
51 | 51 | if($isNewObject) print ' ('.$addrelativediscount.')'; |
52 | 52 | |
53 | 53 | // Is there is commercial discount or down payment available ? |
54 | 54 | if ($absolute_discount > 0) { |
55 | 55 | |
56 | - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) { |
|
57 | - $translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount'; |
|
58 | - $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.'; |
|
56 | + if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) { |
|
57 | + $translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount'; |
|
58 | + $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.'; |
|
59 | 59 | |
60 | - if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
|
61 | - $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse')); |
|
62 | - } |
|
60 | + if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
|
61 | + $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse')); |
|
62 | + } |
|
63 | 63 | |
64 | - if ($isNewObject) { |
|
65 | - $text.= ' ('.$addabsolutediscount.')'; |
|
66 | - } |
|
64 | + if ($isNewObject) { |
|
65 | + $text.= ' ('.$addabsolutediscount.')'; |
|
66 | + } |
|
67 | 67 | |
68 | - print '<br>'.$text; |
|
69 | - } else { |
|
70 | - // Discount available of type fixed amount (not credit note) |
|
71 | - $more = '(' . $addabsolutediscount . ')'; |
|
72 | - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type); |
|
73 | - } |
|
68 | + print '<br>'.$text; |
|
69 | + } else { |
|
70 | + // Discount available of type fixed amount (not credit note) |
|
71 | + $more = '(' . $addabsolutediscount . ')'; |
|
72 | + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type); |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // Is there credit notes availables ? |
77 | 77 | if ($absolute_creditnote > 0) { |
78 | 78 | |
79 | - // If validated, we show link "add credit note to payment" |
|
80 | - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) { |
|
81 | - $translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; |
|
82 | - $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.'; |
|
83 | - |
|
84 | - if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) { |
|
85 | - $text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse')); |
|
86 | - } |
|
87 | - |
|
88 | - if ($absolute_discount <= 0 || $isNewObject) { |
|
89 | - $text.= '('.$addabsolutediscount.')'; |
|
90 | - } |
|
91 | - |
|
92 | - print '<br>'.$text; |
|
93 | - } else { // We can add a credit note on a down payment or standard invoice or situation invoice |
|
94 | - // There is credit notes discounts available |
|
95 | - $more = $isInvoice && ! $isNewObject ? ' (' . $viewabsolutediscount . ')' : ''; |
|
96 | - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher |
|
97 | - } |
|
79 | + // If validated, we show link "add credit note to payment" |
|
80 | + if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) { |
|
81 | + $translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; |
|
82 | + $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.'; |
|
83 | + |
|
84 | + if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) { |
|
85 | + $text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse')); |
|
86 | + } |
|
87 | + |
|
88 | + if ($absolute_discount <= 0 || $isNewObject) { |
|
89 | + $text.= '('.$addabsolutediscount.')'; |
|
90 | + } |
|
91 | + |
|
92 | + print '<br>'.$text; |
|
93 | + } else { // We can add a credit note on a down payment or standard invoice or situation invoice |
|
94 | + // There is credit notes discounts available |
|
95 | + $more = $isInvoice && ! $isNewObject ? ' (' . $viewabsolutediscount . ')' : ''; |
|
96 | + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher |
|
97 | + } |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | if($absolute_discount <= 0 && $absolute_creditnote <= 0) { |
101 | - $translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount'; |
|
102 | - print '<br>'.$langs->trans($translationKey).'.'; |
|
101 | + $translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount'; |
|
102 | + print '<br>'.$langs->trans($translationKey).'.'; |
|
103 | 103 | |
104 | - if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
|
105 | - print ' (' . $addabsolutediscount . ')'; |
|
106 | - } |
|
104 | + if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
|
105 | + print ' (' . $addabsolutediscount . ')'; |
|
106 | + } |
|
107 | 107 | } |
108 | 108 |
@@ -29,47 +29,47 @@ discard block |
||
29 | 29 | $isNewObject = empty($object->id) && empty($object->rowid); |
30 | 30 | |
31 | 31 | // Relative and absolute discounts |
32 | -$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("EditRelativeDiscount") . '</a>'; |
|
33 | -$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("EditGlobalDiscounts") . '</a>'; |
|
34 | -$viewabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $thirdparty->id . '&backtopage=' . $backtopage . '">' . $langs->trans("ViewAvailableGlobalDiscounts") . '</a>'; |
|
32 | +$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditRelativeDiscount").'</a>'; |
|
33 | +$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditGlobalDiscounts").'</a>'; |
|
34 | +$viewabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("ViewAvailableGlobalDiscounts").'</a>'; |
|
35 | 35 | |
36 | 36 | $fixedDiscount = $thirdparty->remise_percent; |
37 | -if(! empty($discount_type)) { |
|
37 | +if (!empty($discount_type)) { |
|
38 | 38 | $fixedDiscount = $thirdparty->remise_supplier_percent; |
39 | 39 | } |
40 | 40 | |
41 | 41 | if ($fixedDiscount > 0) |
42 | 42 | { |
43 | - $translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; |
|
43 | + $translationKey = (!empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; |
|
44 | 44 | print $langs->trans($translationKey, $fixedDiscount).'.'; |
45 | 45 | } |
46 | 46 | else |
47 | 47 | { |
48 | - $translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; |
|
48 | + $translationKey = (!empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; |
|
49 | 49 | print $langs->trans($translationKey).'.'; |
50 | 50 | } |
51 | -if($isNewObject) print ' ('.$addrelativediscount.')'; |
|
51 | +if ($isNewObject) print ' ('.$addrelativediscount.')'; |
|
52 | 52 | |
53 | 53 | // Is there is commercial discount or down payment available ? |
54 | 54 | if ($absolute_discount > 0) { |
55 | 55 | |
56 | - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) { |
|
57 | - $translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount'; |
|
58 | - $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.'; |
|
56 | + if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) { |
|
57 | + $translationKey = !empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount'; |
|
58 | + $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency".$conf->currency)).'.'; |
|
59 | 59 | |
60 | - if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
|
60 | + if ($isInvoice && !$isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
|
61 | 61 | $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse')); |
62 | 62 | } |
63 | 63 | |
64 | 64 | if ($isNewObject) { |
65 | - $text.= ' ('.$addabsolutediscount.')'; |
|
65 | + $text .= ' ('.$addabsolutediscount.')'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | print '<br>'.$text; |
69 | 69 | } else { |
70 | 70 | // Discount available of type fixed amount (not credit note) |
71 | - $more = '(' . $addabsolutediscount . ')'; |
|
72 | - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type); |
|
71 | + $more = '('.$addabsolutediscount.')'; |
|
72 | + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -77,32 +77,32 @@ discard block |
||
77 | 77 | if ($absolute_creditnote > 0) { |
78 | 78 | |
79 | 79 | // If validated, we show link "add credit note to payment" |
80 | - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) { |
|
81 | - $translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; |
|
82 | - $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.'; |
|
80 | + if ($cannotApplyDiscount || !$isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) { |
|
81 | + $translationKey = !empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; |
|
82 | + $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency".$conf->currency)).'.'; |
|
83 | 83 | |
84 | - if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) { |
|
84 | + if ($isInvoice && !$isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) { |
|
85 | 85 | $text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse')); |
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($absolute_discount <= 0 || $isNewObject) { |
89 | - $text.= '('.$addabsolutediscount.')'; |
|
89 | + $text .= '('.$addabsolutediscount.')'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | print '<br>'.$text; |
93 | 93 | } else { // We can add a credit note on a down payment or standard invoice or situation invoice |
94 | 94 | // There is credit notes discounts available |
95 | - $more = $isInvoice && ! $isNewObject ? ' (' . $viewabsolutediscount . ')' : ''; |
|
96 | - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher |
|
95 | + $more = $isInvoice && !$isNewObject ? ' ('.$viewabsolutediscount.')' : ''; |
|
96 | + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | -if($absolute_discount <= 0 && $absolute_creditnote <= 0) { |
|
101 | - $translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount'; |
|
100 | +if ($absolute_discount <= 0 && $absolute_creditnote <= 0) { |
|
101 | + $translationKey = !empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount'; |
|
102 | 102 | print '<br>'.$langs->trans($translationKey).'.'; |
103 | 103 | |
104 | 104 | if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { |
105 | - print ' (' . $addabsolutediscount . ')'; |
|
105 | + print ' ('.$addabsolutediscount.')'; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 |
@@ -42,13 +42,14 @@ |
||
42 | 42 | { |
43 | 43 | $translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; |
44 | 44 | print $langs->trans($translationKey, $fixedDiscount).'.'; |
45 | -} |
|
46 | -else |
|
45 | +} else |
|
47 | 46 | { |
48 | 47 | $translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; |
49 | 48 | print $langs->trans($translationKey).'.'; |
50 | 49 | } |
51 | -if($isNewObject) print ' ('.$addrelativediscount.')'; |
|
50 | +if($isNewObject) { |
|
51 | + print ' ('.$addrelativediscount.')'; |
|
52 | +} |
|
52 | 53 | |
53 | 54 | // Is there is commercial discount or down payment available ? |
54 | 55 | if ($absolute_discount > 0) { |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | |
20 | 20 | // Protection to avoid direct call of template |
21 | 21 | if (empty($object) || ! is_object($object)) { |
22 | - print "Error, template page can't be called as URL"; |
|
23 | - exit; |
|
22 | + print "Error, template page can't be called as URL"; |
|
23 | + exit; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | $value_private=$object->note_private; |
38 | 38 | if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES)) |
39 | 39 | { |
40 | - $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
41 | - if (GETPOST('action','aZ09') == 'edit'.$note_public) |
|
42 | - { |
|
43 | - $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd); |
|
44 | - if (dol_textishtml($value_public)) $value_public.="<br>\n"; |
|
45 | - else $value_public.="\n"; |
|
46 | - } |
|
40 | + $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
41 | + if (GETPOST('action','aZ09') == 'edit'.$note_public) |
|
42 | + { |
|
43 | + $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd); |
|
44 | + if (dol_textishtml($value_public)) $value_public.="<br>\n"; |
|
45 | + else $value_public.="\n"; |
|
46 | + } |
|
47 | 47 | } |
48 | 48 | if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) |
49 | 49 | { |
50 | - $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
51 | - if (GETPOST('action','aZ09') == 'edit'.$note_private) |
|
52 | - { |
|
53 | - $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd); |
|
54 | - if (dol_textishtml($value_private)) $value_private.="<br>\n"; |
|
55 | - else $value_private.="\n"; |
|
56 | - } |
|
50 | + $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
51 | + if (GETPOST('action','aZ09') == 'edit'.$note_private) |
|
52 | + { |
|
53 | + $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd); |
|
54 | + if (dol_textishtml($value_private)) $value_private.="<br>\n"; |
|
55 | + else $value_private.="\n"; |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Special cases |
@@ -76,25 +76,25 @@ discard block |
||
76 | 76 | print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n"; |
77 | 77 | print '<div class="tagtable border table-border centpercent">'."\n"; |
78 | 78 | if ($module != 'product') { |
79 | - // No public note yet on products |
|
80 | - print '<div class="tagtr pair table-border-row">'."\n"; |
|
81 | - print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
82 | - print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); |
|
83 | - print '</div>'."\n"; |
|
84 | - print '<div class="tagtd table-val-border-col">'."\n"; |
|
85 | - print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n"; |
|
86 | - print '</div>'."\n"; |
|
87 | - print '</div>'."\n"; |
|
79 | + // No public note yet on products |
|
80 | + print '<div class="tagtr pair table-border-row">'."\n"; |
|
81 | + print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
82 | + print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); |
|
83 | + print '</div>'."\n"; |
|
84 | + print '<div class="tagtd table-val-border-col">'."\n"; |
|
85 | + print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n"; |
|
86 | + print '</div>'."\n"; |
|
87 | + print '</div>'."\n"; |
|
88 | 88 | } |
89 | 89 | if (empty($user->societe_id)) { |
90 | - print '<div class="tagtr '.($module != 'product'?'impair':'pair').' table-border-row">'."\n"; |
|
91 | - print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
92 | - print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); |
|
93 | - print '</div>'."\n"; |
|
94 | - print '<div class="tagtd table-val-border-col">'."\n"; |
|
95 | - print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); |
|
96 | - print '</div>'."\n"; |
|
97 | - print '</div>'."\n"; |
|
90 | + print '<div class="tagtr '.($module != 'product'?'impair':'pair').' table-border-row">'."\n"; |
|
91 | + print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
92 | + print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); |
|
93 | + print '</div>'."\n"; |
|
94 | + print '<div class="tagtd table-val-border-col">'."\n"; |
|
95 | + print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); |
|
96 | + print '</div>'."\n"; |
|
97 | + print '</div>'."\n"; |
|
98 | 98 | } |
99 | 99 | print '</div>'."\n"; |
100 | 100 | ?> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | // Protection to avoid direct call of template |
21 | -if (empty($object) || ! is_object($object)) { |
|
21 | +if (empty($object) || !is_object($object)) { |
|
22 | 22 | print "Error, template page can't be called as URL"; |
23 | 23 | exit; |
24 | 24 | } |
@@ -29,56 +29,56 @@ discard block |
||
29 | 29 | $note_public = 'note_public'; |
30 | 30 | $note_private = 'note_private'; |
31 | 31 | |
32 | -$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':'')); |
|
32 | +$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : '')); |
|
33 | 33 | // Set $permission from the $permissionnote var defined on calling page |
34 | -$permission=(isset($permissionnote)?$permissionnote:(isset($permission)?$permission:(isset($user->rights->$module->create)?$user->rights->$module->create:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)))); |
|
35 | -$moreparam=(isset($moreparam)?$moreparam:''); |
|
36 | -$value_public=$object->note_public; |
|
37 | -$value_private=$object->note_private; |
|
38 | -if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES)) |
|
34 | +$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0)))); |
|
35 | +$moreparam = (isset($moreparam) ? $moreparam : ''); |
|
36 | +$value_public = $object->note_public; |
|
37 | +$value_private = $object->note_private; |
|
38 | +if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES)) |
|
39 | 39 | { |
40 | - $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
41 | - if (GETPOST('action','aZ09') == 'edit'.$note_public) |
|
40 | + $stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
41 | + if (GETPOST('action', 'aZ09') == 'edit'.$note_public) |
|
42 | 42 | { |
43 | - $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd); |
|
44 | - if (dol_textishtml($value_public)) $value_public.="<br>\n"; |
|
45 | - else $value_public.="\n"; |
|
43 | + $value_public = dol_concatdesc($value_public, ($value_public ? "\n" : "")."-- ".$stringtoadd); |
|
44 | + if (dol_textishtml($value_public)) $value_public .= "<br>\n"; |
|
45 | + else $value_public .= "\n"; |
|
46 | 46 | } |
47 | 47 | } |
48 | -if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) |
|
48 | +if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) |
|
49 | 49 | { |
50 | - $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
51 | - if (GETPOST('action','aZ09') == 'edit'.$note_private) |
|
50 | + $stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --'; |
|
51 | + if (GETPOST('action', 'aZ09') == 'edit'.$note_private) |
|
52 | 52 | { |
53 | - $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd); |
|
54 | - if (dol_textishtml($value_private)) $value_private.="<br>\n"; |
|
55 | - else $value_private.="\n"; |
|
53 | + $value_private = dol_concatdesc($value_private, ($value_private ? "\n" : "")."-- ".$stringtoadd); |
|
54 | + if (dol_textishtml($value_private)) $value_private .= "<br>\n"; |
|
55 | + else $value_private .= "\n"; |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | 59 | // Special cases |
60 | -if ($module == 'propal') { $permission=$user->rights->propale->creer;} |
|
61 | -elseif ($module == 'supplier_proposal') { $permission=$user->rights->supplier_proposal->creer;} |
|
62 | -elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;} |
|
63 | -elseif ($module == 'project') { $permission=$user->rights->projet->creer;} |
|
64 | -elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;} |
|
65 | -elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;} |
|
66 | -elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;} |
|
67 | -elseif ($module == 'societe') { $permission=$user->rights->societe->creer;} |
|
68 | -elseif ($module == 'contact') { $permission=$user->rights->societe->creer;} |
|
69 | -elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;} |
|
70 | -elseif ($module == 'product') { $permission=$user->rights->produit->creer;} |
|
60 | +if ($module == 'propal') { $permission = $user->rights->propale->creer; } |
|
61 | +elseif ($module == 'supplier_proposal') { $permission = $user->rights->supplier_proposal->creer; } |
|
62 | +elseif ($module == 'fichinter') { $permission = $user->rights->ficheinter->creer; } |
|
63 | +elseif ($module == 'project') { $permission = $user->rights->projet->creer; } |
|
64 | +elseif ($module == 'project_task') { $permission = $user->rights->projet->creer; } |
|
65 | +elseif ($module == 'invoice_supplier') { $permission = $user->rights->fournisseur->facture->creer; } |
|
66 | +elseif ($module == 'order_supplier') { $permission = $user->rights->fournisseur->commande->creer; } |
|
67 | +elseif ($module == 'societe') { $permission = $user->rights->societe->creer; } |
|
68 | +elseif ($module == 'contact') { $permission = $user->rights->societe->creer; } |
|
69 | +elseif ($module == 'shipping') { $permission = $user->rights->expedition->creer; } |
|
70 | +elseif ($module == 'product') { $permission = $user->rights->produit->creer; } |
|
71 | 71 | //else dol_print_error('','Bad value '.$module.' for param module'); |
72 | 72 | |
73 | -if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note. |
|
74 | -else $typeofdata='textarea:12:95%'; |
|
73 | +if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata = 'ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note. |
|
74 | +else $typeofdata = 'textarea:12:95%'; |
|
75 | 75 | |
76 | 76 | print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n"; |
77 | 77 | print '<div class="tagtable border table-border centpercent">'."\n"; |
78 | 78 | if ($module != 'product') { |
79 | 79 | // No public note yet on products |
80 | 80 | print '<div class="tagtr pair table-border-row">'."\n"; |
81 | - print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
81 | + print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
82 | 82 | print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); |
83 | 83 | print '</div>'."\n"; |
84 | 84 | print '<div class="tagtd table-val-border-col">'."\n"; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | print '</div>'."\n"; |
88 | 88 | } |
89 | 89 | if (empty($user->societe_id)) { |
90 | - print '<div class="tagtr '.($module != 'product'?'impair':'pair').' table-border-row">'."\n"; |
|
91 | - print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
90 | + print '<div class="tagtr '.($module != 'product' ? 'impair' : 'pair').' table-border-row">'."\n"; |
|
91 | + print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n"; |
|
92 | 92 | print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); |
93 | 93 | print '</div>'."\n"; |
94 | 94 | print '<div class="tagtd table-val-border-col">'."\n"; |
@@ -41,8 +41,11 @@ discard block |
||
41 | 41 | if (GETPOST('action','aZ09') == 'edit'.$note_public) |
42 | 42 | { |
43 | 43 | $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd); |
44 | - if (dol_textishtml($value_public)) $value_public.="<br>\n"; |
|
45 | - else $value_public.="\n"; |
|
44 | + if (dol_textishtml($value_public)) { |
|
45 | + $value_public.="<br>\n"; |
|
46 | + } else { |
|
47 | + $value_public.="\n"; |
|
48 | + } |
|
46 | 49 | } |
47 | 50 | } |
48 | 51 | if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) |
@@ -51,27 +54,25 @@ discard block |
||
51 | 54 | if (GETPOST('action','aZ09') == 'edit'.$note_private) |
52 | 55 | { |
53 | 56 | $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd); |
54 | - if (dol_textishtml($value_private)) $value_private.="<br>\n"; |
|
55 | - else $value_private.="\n"; |
|
57 | + if (dol_textishtml($value_private)) { |
|
58 | + $value_private.="<br>\n"; |
|
59 | + } else { |
|
60 | + $value_private.="\n"; |
|
61 | + } |
|
56 | 62 | } |
57 | 63 | } |
58 | 64 | |
59 | 65 | // Special cases |
60 | -if ($module == 'propal') { $permission=$user->rights->propale->creer;} |
|
61 | -elseif ($module == 'supplier_proposal') { $permission=$user->rights->supplier_proposal->creer;} |
|
62 | -elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;} |
|
63 | -elseif ($module == 'project') { $permission=$user->rights->projet->creer;} |
|
64 | -elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;} |
|
65 | -elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;} |
|
66 | -elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;} |
|
67 | -elseif ($module == 'societe') { $permission=$user->rights->societe->creer;} |
|
68 | -elseif ($module == 'contact') { $permission=$user->rights->societe->creer;} |
|
69 | -elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;} |
|
70 | -elseif ($module == 'product') { $permission=$user->rights->produit->creer;} |
|
66 | +if ($module == 'propal') { $permission=$user->rights->propale->creer;} elseif ($module == 'supplier_proposal') { $permission=$user->rights->supplier_proposal->creer;} elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;} elseif ($module == 'project') { $permission=$user->rights->projet->creer;} elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;} elseif ($module == 'invoice_supplier') { $permission=$user->rights->fournisseur->facture->creer;} elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->commande->creer;} elseif ($module == 'societe') { $permission=$user->rights->societe->creer;} elseif ($module == 'contact') { $permission=$user->rights->societe->creer;} elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer;} elseif ($module == 'product') { $permission=$user->rights->produit->creer;} |
|
71 | 67 | //else dol_print_error('','Bad value '.$module.' for param module'); |
72 | 68 | |
73 | -if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note. |
|
74 | -else $typeofdata='textarea:12:95%'; |
|
69 | +if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { |
|
70 | + $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; |
|
71 | +} |
|
72 | +// Rem: This var is for all notes, not only thirdparties note. |
|
73 | +else { |
|
74 | + $typeofdata='textarea:12:95%'; |
|
75 | +} |
|
75 | 76 | |
76 | 77 | print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n"; |
77 | 78 | print '<div class="tagtable border table-border centpercent">'."\n"; |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // Protection to avoid direct call of template |
4 | 4 | if (empty($conf) || ! is_object($conf)) |
5 | 5 | { |
6 | - print "Error, template page can't be called as URL"; |
|
7 | - exit; |
|
6 | + print "Error, template page can't be called as URL"; |
|
7 | + exit; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | // Loop to complete $param for extrafields |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | { |
13 | 13 | foreach ($search_array_options as $key => $val) |
14 | 14 | { |
15 | - $crit=$val; |
|
16 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
15 | + $crit=$val; |
|
16 | + $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
18 | 18 | } |
19 | 19 | } |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Protection to avoid direct call of template |
4 | -if (empty($conf) || ! is_object($conf)) |
|
4 | +if (empty($conf) || !is_object($conf)) |
|
5 | 5 | { |
6 | 6 | print "Error, template page can't be called as URL"; |
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | 10 | // Loop to complete $param for extrafields |
11 | -if (! empty($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
11 | +if (!empty($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
12 | 12 | { |
13 | 13 | foreach ($search_array_options as $key => $val) |
14 | 14 | { |
15 | - $crit=$val; |
|
16 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
15 | + $crit = $val; |
|
16 | + $tmpkey = preg_replace('/search_options_/', '', $key); |
|
17 | + if ($val != '') $param .= '&search_options_'.$tmpkey.'='.urlencode($val); |
|
18 | 18 | } |
19 | 19 | } |
@@ -8,12 +8,16 @@ |
||
8 | 8 | } |
9 | 9 | |
10 | 10 | // Loop to complete $param for extrafields |
11 | -if (! empty($search_array_options)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
11 | +if (! empty($search_array_options)) { |
|
12 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
12 | 13 | { |
13 | 14 | foreach ($search_array_options as $key => $val) |
14 | 15 | { |
15 | 16 | $crit=$val; |
16 | - $tmpkey=preg_replace('/search_options_/','',$key); |
|
17 | - if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
18 | 17 | } |
18 | + $tmpkey=preg_replace('/search_options_/','',$key); |
|
19 | + if ($val != '') { |
|
20 | + $param.='&search_options_'.$tmpkey.'='.urlencode($val); |
|
21 | + } |
|
22 | + } |
|
19 | 23 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | // Protection to avoid direct call of template |
29 | 29 | if (empty($conf) || ! is_object($conf)) |
30 | 30 | { |
31 | - print "Error, template page can't be called as URL"; |
|
32 | - exit; |
|
31 | + print "Error, template page can't be called as URL"; |
|
32 | + exit; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | ?> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
42 | 42 | print $hookmanager->resPrint; |
43 | 43 | if (empty($reshook)) { |
44 | - print $object->showOptionals($extrafields, 'edit'); |
|
44 | + print $object->showOptionals($extrafields, 'edit'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | ?> |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | |
28 | 28 | // Protection to avoid direct call of template |
29 | -if (empty($conf) || ! is_object($conf)) |
|
29 | +if (empty($conf) || !is_object($conf)) |
|
30 | 30 | { |
31 | 31 | print "Error, template page can't be called as URL"; |
32 | 32 | exit; |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | // Protection to avoid direct call of template |
4 | 4 | if (empty($conf) || ! is_object($conf)) |
5 | 5 | { |
6 | - print "Error, template page can't be called as URL"; |
|
7 | - exit; |
|
6 | + print "Error, template page can't be called as URL"; |
|
7 | + exit; |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
@@ -12,18 +12,18 @@ discard block |
||
12 | 12 | // Loop to show all columns of extrafields for the title line |
13 | 13 | if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
14 | 14 | { |
15 | - if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
|
16 | - { |
|
17 | - foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | - { |
|
19 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
20 | - { |
|
21 | - $align=$extrafields->getAlignFlag($key); |
|
22 | - $sortonfield = "ef.".$key; |
|
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | - if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
26 | - } |
|
27 | - } |
|
28 | - } |
|
15 | + if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
|
16 | + { |
|
17 | + foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | + { |
|
19 | + if (! empty($arrayfields["ef.".$key]['checked'])) |
|
20 | + { |
|
21 | + $align=$extrafields->getAlignFlag($key); |
|
22 | + $sortonfield = "ef.".$key; |
|
23 | + if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | + if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | + else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
26 | + } |
|
27 | + } |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Protection to avoid direct call of template |
4 | -if (empty($conf) || ! is_object($conf)) |
|
4 | +if (empty($conf) || !is_object($conf)) |
|
5 | 5 | { |
6 | 6 | print "Error, template page can't be called as URL"; |
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey = $object->table_element; |
|
11 | 11 | |
12 | 12 | // Loop to show all columns of extrafields for the title line |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
13 | +if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 14 | { |
15 | 15 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 16 | { |
17 | - foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
17 | + foreach ($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) |
|
18 | 18 | { |
19 | - if (! empty($arrayfields["ef.".$key]['checked'])) |
|
19 | + if (!empty($arrayfields["ef.".$key]['checked'])) |
|
20 | 20 | { |
21 | - $align=$extrafields->getAlignFlag($key); |
|
21 | + $align = $extrafields->getAlignFlag($key); |
|
22 | 22 | $sortonfield = "ef.".$key; |
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
23 | + if (!empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield = ''; |
|
24 | 24 | if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
25 | + else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'"' : ''), $sortfield, $sortorder)."\n"; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | } |
@@ -7,10 +7,13 @@ discard block |
||
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; |
|
10 | +if (empty($extrafieldsobjectkey) && is_object($object)) { |
|
11 | + $extrafieldsobjectkey=$object->table_element; |
|
12 | +} |
|
11 | 13 | |
12 | 14 | // Loop to show all columns of extrafields for the title line |
13 | -if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
15 | +if (! empty($extrafieldsobjectkey)) { |
|
16 | + // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... |
|
14 | 17 | { |
15 | 18 | if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) |
16 | 19 | { |
@@ -19,10 +22,16 @@ discard block |
||
19 | 22 | if (! empty($arrayfields["ef.".$key]['checked'])) |
20 | 23 | { |
21 | 24 | $align=$extrafields->getAlignFlag($key); |
25 | +} |
|
22 | 26 | $sortonfield = "ef.".$key; |
23 | - if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield=''; |
|
24 | - if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>'; |
|
25 | - else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
27 | + if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) { |
|
28 | + $sortonfield=''; |
|
29 | + } |
|
30 | + if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') { |
|
31 | + print '<th class="liste_titre thseparator"></th>'; |
|
32 | + } else { |
|
33 | + print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n"; |
|
34 | + } |
|
26 | 35 | } |
27 | 36 | } |
28 | 37 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | // Protection to avoid direct call of template |
26 | 26 | if (empty($conf) || ! is_object($conf)) |
27 | 27 | { |
28 | - print "Error, template page can't be called as URL"; |
|
29 | - exit; |
|
28 | + print "Error, template page can't be called as URL"; |
|
29 | + exit; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | ?> |
@@ -37,30 +37,30 @@ discard block |
||
37 | 37 | |
38 | 38 | foreach($object->fields as $key => $val) |
39 | 39 | { |
40 | - // Discard if extrafield is a hidden field on form |
|
41 | - if (abs($val['visible']) != 1) continue; |
|
40 | + // Discard if extrafield is a hidden field on form |
|
41 | + if (abs($val['visible']) != 1) continue; |
|
42 | 42 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
43 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
44 | 44 | |
45 | - print '<tr id="field_'.$key.'">'; |
|
46 | - print '<td'; |
|
47 | - print ' class="titlefieldcreate'; |
|
48 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
50 | - print '"'; |
|
51 | - print '>'; |
|
52 | - print $langs->trans($val['label']); |
|
45 | + print '<tr id="field_'.$key.'">'; |
|
46 | + print '<td'; |
|
47 | + print ' class="titlefieldcreate'; |
|
48 | + if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | + if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
50 | + print '"'; |
|
51 | + print '>'; |
|
52 | + print $langs->trans($val['label']); |
|
53 | 53 | if(!empty($val['help'])){ |
54 | 54 | print $form->textwithpicto('',$langs->trans($val['help'])); |
55 | 55 | } |
56 | - print '</td>'; |
|
57 | - print '<td>'; |
|
58 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | - else $value = GETPOST($key, 'alpha'); |
|
61 | - print $object->showInputField($val, $key, $value, '', '', '', 0); |
|
62 | - print '</td>'; |
|
63 | - print '</tr>'; |
|
56 | + print '</td>'; |
|
57 | + print '<td>'; |
|
58 | + if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | + elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | + else $value = GETPOST($key, 'alpha'); |
|
61 | + print $object->showInputField($val, $key, $value, '', '', '', 0); |
|
62 | + print '</td>'; |
|
63 | + print '</tr>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | ?> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Protection to avoid direct call of template |
26 | -if (empty($conf) || ! is_object($conf)) |
|
26 | +if (empty($conf) || !is_object($conf)) |
|
27 | 27 | { |
28 | 28 | print "Error, template page can't be called as URL"; |
29 | 29 | exit; |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | |
36 | 36 | $object->fields = dol_sort_array($object->fields, 'position'); |
37 | 37 | |
38 | -foreach($object->fields as $key => $val) |
|
38 | +foreach ($object->fields as $key => $val) |
|
39 | 39 | { |
40 | 40 | // Discard if extrafield is a hidden field on form |
41 | 41 | if (abs($val['visible']) != 1) continue; |
42 | 42 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
43 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && !verifCond($val['enabled'])) continue; // We don't want this field |
|
44 | 44 | |
45 | 45 | print '<tr id="field_'.$key.'">'; |
46 | 46 | print '<td'; |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | print '"'; |
51 | 51 | print '>'; |
52 | 52 | print $langs->trans($val['label']); |
53 | - if(!empty($val['help'])){ |
|
54 | - print $form->textwithpicto('',$langs->trans($val['help'])); |
|
53 | + if (!empty($val['help'])) { |
|
54 | + print $form->textwithpicto('', $langs->trans($val['help'])); |
|
55 | 55 | } |
56 | 56 | print '</td>'; |
57 | 57 | print '<td>'; |
@@ -38,15 +38,24 @@ discard block |
||
38 | 38 | foreach($object->fields as $key => $val) |
39 | 39 | { |
40 | 40 | // Discard if extrafield is a hidden field on form |
41 | - if (abs($val['visible']) != 1) continue; |
|
41 | + if (abs($val['visible']) != 1) { |
|
42 | + continue; |
|
43 | + } |
|
42 | 44 | |
43 | - if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue; // We don't want this field |
|
45 | + if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) { |
|
46 | + continue; |
|
47 | + } |
|
48 | + // We don't want this field |
|
44 | 49 | |
45 | 50 | print '<tr id="field_'.$key.'">'; |
46 | 51 | print '<td'; |
47 | 52 | print ' class="titlefieldcreate'; |
48 | - if ($val['notnull'] > 0) print ' fieldrequired'; |
|
49 | - if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop'; |
|
53 | + if ($val['notnull'] > 0) { |
|
54 | + print ' fieldrequired'; |
|
55 | + } |
|
56 | + if ($val['type'] == 'text' || $val['type'] == 'html') { |
|
57 | + print ' tdtop'; |
|
58 | + } |
|
50 | 59 | print '"'; |
51 | 60 | print '>'; |
52 | 61 | print $langs->trans($val['label']); |
@@ -55,9 +64,13 @@ discard block |
||
55 | 64 | } |
56 | 65 | print '</td>'; |
57 | 66 | print '<td>'; |
58 | - if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int'); |
|
59 | - elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none'); |
|
60 | - else $value = GETPOST($key, 'alpha'); |
|
67 | + if (in_array($val['type'], array('int', 'integer'))) { |
|
68 | + $value = GETPOST($key, 'int'); |
|
69 | + } elseif ($val['type'] == 'text' || $val['type'] == 'html') { |
|
70 | + $value = GETPOST($key, 'none'); |
|
71 | + } else { |
|
72 | + $value = GETPOST($key, 'alpha'); |
|
73 | + } |
|
61 | 74 | print $object->showInputField($val, $key, $value, '', '', '', 0); |
62 | 75 | print '</td>'; |
63 | 76 | print '</tr>'; |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | // Protection to avoid direct call of template |
19 | 19 | if (empty($conf) || ! is_object($conf)) |
20 | 20 | { |
21 | - print "Error, template page can't be called as URL"; |
|
22 | - exit; |
|
21 | + print "Error, template page can't be called as URL"; |
|
22 | + exit; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | print '<strong>'.getOnlinePaymentUrl(1,'free')."</strong><br><br>\n"; |
33 | 33 | if (! empty($conf->commande->enabled)) |
34 | 34 | { |
35 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>'; |
|
36 | - print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n"; |
|
37 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
38 | - { |
|
39 | - $langs->load("orders"); |
|
40 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
41 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; |
|
35 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>'; |
|
36 | + print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n"; |
|
37 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
38 | + { |
|
39 | + $langs->load("orders"); |
|
40 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
41 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; |
|
42 | 42 | print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref','alpha').'" size="10">'; |
43 | 43 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
44 | 44 | if (GETPOST('generate_order_ref','alpha')) |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | print "</strong><br>\n"; |
50 | 50 | } |
51 | 51 | print '</form>'; |
52 | - } |
|
53 | - print '<br>'; |
|
52 | + } |
|
53 | + print '<br>'; |
|
54 | 54 | } |
55 | 55 | if (! empty($conf->facture->enabled)) |
56 | 56 | { |
57 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>'; |
|
58 | - print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n"; |
|
59 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
60 | - { |
|
61 | - $langs->load("bills"); |
|
62 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
63 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; |
|
57 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>'; |
|
58 | + print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n"; |
|
59 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
60 | + { |
|
61 | + $langs->load("bills"); |
|
62 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
63 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; |
|
64 | 64 | print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref','alpha').'" size="10">'; |
65 | 65 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
66 | 66 | if (GETPOST('generate_invoice_ref','alpha')) |
@@ -71,18 +71,18 @@ discard block |
||
71 | 71 | print "</strong><br>\n"; |
72 | 72 | } |
73 | 73 | print '</form>'; |
74 | - } |
|
75 | - print '<br>'; |
|
74 | + } |
|
75 | + print '<br>'; |
|
76 | 76 | } |
77 | 77 | if (! empty($conf->contrat->enabled)) |
78 | 78 | { |
79 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>'; |
|
80 | - print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n"; |
|
81 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
82 | - { |
|
83 | - $langs->load("contracts"); |
|
84 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
85 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("ContractLine")).': '; |
|
79 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>'; |
|
80 | + print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n"; |
|
81 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
82 | + { |
|
83 | + $langs->load("contracts"); |
|
84 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
85 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("ContractLine")).': '; |
|
86 | 86 | print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref','alpha').'" size="10">'; |
87 | 87 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
88 | 88 | if (GETPOST('generate_contract_ref')) |
@@ -93,18 +93,18 @@ discard block |
||
93 | 93 | print "</strong><br>\n"; |
94 | 94 | } |
95 | 95 | print '</form>'; |
96 | - } |
|
97 | - print '<br>'; |
|
96 | + } |
|
97 | + print '<br>'; |
|
98 | 98 | } |
99 | 99 | if (! empty($conf->adherent->enabled)) |
100 | 100 | { |
101 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>'; |
|
102 | - print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n"; |
|
103 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
104 | - { |
|
105 | - $langs->load("members"); |
|
106 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
107 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; |
|
101 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>'; |
|
102 | + print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n"; |
|
103 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
104 | + { |
|
105 | + $langs->load("members"); |
|
106 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
107 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; |
|
108 | 108 | print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref','alpha').'" size="10">'; |
109 | 109 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
110 | 110 | if (GETPOST('generate_member_ref')) |
@@ -115,18 +115,18 @@ discard block |
||
115 | 115 | print "</strong><br>\n"; |
116 | 116 | } |
117 | 117 | print '</form>'; |
118 | - } |
|
119 | - print '<br>'; |
|
118 | + } |
|
119 | + print '<br>'; |
|
120 | 120 | } |
121 | 121 | if (! empty($conf->don->enabled)) |
122 | 122 | { |
123 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':<br>'; |
|
124 | - print '<strong>'.getOnlinePaymentUrl(1,'donation')."</strong><br>\n"; |
|
125 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
126 | - { |
|
127 | - $langs->load("members"); |
|
128 | - print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
129 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Don")).': '; |
|
123 | + print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':<br>'; |
|
124 | + print '<strong>'.getOnlinePaymentUrl(1,'donation')."</strong><br>\n"; |
|
125 | + if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
126 | + { |
|
127 | + $langs->load("members"); |
|
128 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
|
129 | + print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Don")).': '; |
|
130 | 130 | print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref','alpha').'" size="10">'; |
131 | 131 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
132 | 132 | if (GETPOST('generate_donation_ref')) |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | print "</strong><br>\n"; |
138 | 138 | } |
139 | 139 | print '</form>'; |
140 | - } |
|
141 | - print '<br>'; |
|
140 | + } |
|
141 | + print '<br>'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (! empty($conf->use_javascript_ajax)) |
145 | 145 | { |
146 | - print "\n".'<script type="text/javascript">'; |
|
147 | - print '$(document).ready(function () { |
|
146 | + print "\n".'<script type="text/javascript">'; |
|
147 | + print '$(document).ready(function () { |
|
148 | 148 | $("#generate_token").click(function() { |
149 | 149 | $.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", { |
150 | 150 | action: \'getrandompassword\', |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | }); |
156 | 156 | }); |
157 | 157 | });'; |
158 | - print '</script>'; |
|
158 | + print '</script>'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | print info_admin($langs->trans("YouCanAddTagOnUrl")); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Protection to avoid direct call of template |
19 | -if (empty($conf) || ! is_object($conf)) |
|
19 | +if (empty($conf) || !is_object($conf)) |
|
20 | 20 | { |
21 | 21 | print "Error, template page can't be called as URL"; |
22 | 22 | exit; |
@@ -28,23 +28,23 @@ discard block |
||
28 | 28 | |
29 | 29 | // Url list |
30 | 30 | print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>'; |
31 | -print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':<br>'; |
|
32 | -print '<strong>'.getOnlinePaymentUrl(1,'free')."</strong><br><br>\n"; |
|
33 | -if (! empty($conf->commande->enabled)) |
|
31 | +print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':<br>'; |
|
32 | +print '<strong>'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n"; |
|
33 | +if (!empty($conf->commande->enabled)) |
|
34 | 34 | { |
35 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>'; |
|
36 | - print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n"; |
|
37 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
35 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':<br>'; |
|
36 | + print '<strong>'.getOnlinePaymentUrl(1, 'order')."</strong><br>\n"; |
|
37 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
38 | 38 | { |
39 | 39 | $langs->load("orders"); |
40 | 40 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
41 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': '; |
|
42 | - print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref','alpha').'" size="10">'; |
|
41 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': '; |
|
42 | + print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref', 'alpha').'" size="10">'; |
|
43 | 43 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
44 | - if (GETPOST('generate_order_ref','alpha')) |
|
44 | + if (GETPOST('generate_order_ref', 'alpha')) |
|
45 | 45 | { |
46 | 46 | print '<br> -> <strong>'; |
47 | - $url=getOnlinePaymentUrl(0,'order',GETPOST('generate_order_ref','alpha')); |
|
47 | + $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha')); |
|
48 | 48 | print $url; |
49 | 49 | print "</strong><br>\n"; |
50 | 50 | } |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | } |
53 | 53 | print '<br>'; |
54 | 54 | } |
55 | -if (! empty($conf->facture->enabled)) |
|
55 | +if (!empty($conf->facture->enabled)) |
|
56 | 56 | { |
57 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>'; |
|
58 | - print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n"; |
|
59 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
57 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':<br>'; |
|
58 | + print '<strong>'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n"; |
|
59 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
60 | 60 | { |
61 | 61 | $langs->load("bills"); |
62 | 62 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
63 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': '; |
|
64 | - print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref','alpha').'" size="10">'; |
|
63 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': '; |
|
64 | + print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref', 'alpha').'" size="10">'; |
|
65 | 65 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
66 | - if (GETPOST('generate_invoice_ref','alpha')) |
|
66 | + if (GETPOST('generate_invoice_ref', 'alpha')) |
|
67 | 67 | { |
68 | 68 | print '<br> -> <strong>'; |
69 | - $url=getOnlinePaymentUrl(0,'invoice',GETPOST('generate_invoice_ref','alpha')); |
|
69 | + $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha')); |
|
70 | 70 | print $url; |
71 | 71 | print "</strong><br>\n"; |
72 | 72 | } |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | } |
75 | 75 | print '<br>'; |
76 | 76 | } |
77 | -if (! empty($conf->contrat->enabled)) |
|
77 | +if (!empty($conf->contrat->enabled)) |
|
78 | 78 | { |
79 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>'; |
|
80 | - print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n"; |
|
81 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
79 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':<br>'; |
|
80 | + print '<strong>'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n"; |
|
81 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
82 | 82 | { |
83 | 83 | $langs->load("contracts"); |
84 | 84 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
85 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("ContractLine")).': '; |
|
86 | - print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref','alpha').'" size="10">'; |
|
85 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': '; |
|
86 | + print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref', 'alpha').'" size="10">'; |
|
87 | 87 | print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">'; |
88 | 88 | if (GETPOST('generate_contract_ref')) |
89 | 89 | { |
90 | 90 | print '<br> -> <strong>'; |
91 | - $url=getOnlinePaymentUrl(0,'contractline',GETPOST('generate_contract_ref','alpha')); |
|
91 | + $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha')); |
|
92 | 92 | print $url; |
93 | 93 | print "</strong><br>\n"; |
94 | 94 | } |
@@ -96,21 +96,21 @@ discard block |
||
96 | 96 | } |
97 | 97 | print '<br>'; |
98 | 98 | } |
99 | -if (! empty($conf->adherent->enabled)) |
|
99 | +if (!empty($conf->adherent->enabled)) |
|
100 | 100 | { |
101 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>'; |
|
102 | - print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n"; |
|
103 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
101 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':<br>'; |
|
102 | + print '<strong>'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n"; |
|
103 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
104 | 104 | { |
105 | 105 | $langs->load("members"); |
106 | 106 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
107 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': '; |
|
108 | - print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref','alpha').'" size="10">'; |
|
107 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': '; |
|
108 | + print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref', 'alpha').'" size="10">'; |
|
109 | 109 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
110 | 110 | if (GETPOST('generate_member_ref')) |
111 | 111 | { |
112 | 112 | print '<br> -> <strong>'; |
113 | - $url=getOnlinePaymentUrl(0,'membersubscription',GETPOST('generate_member_ref','alpha')); |
|
113 | + $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha')); |
|
114 | 114 | print $url; |
115 | 115 | print "</strong><br>\n"; |
116 | 116 | } |
@@ -118,21 +118,21 @@ discard block |
||
118 | 118 | } |
119 | 119 | print '<br>'; |
120 | 120 | } |
121 | -if (! empty($conf->don->enabled)) |
|
121 | +if (!empty($conf->don->enabled)) |
|
122 | 122 | { |
123 | - print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation",$servicename).':<br>'; |
|
124 | - print '<strong>'.getOnlinePaymentUrl(1,'donation')."</strong><br>\n"; |
|
125 | - if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
123 | + print img_picto('', 'object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':<br>'; |
|
124 | + print '<strong>'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n"; |
|
125 | + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) |
|
126 | 126 | { |
127 | 127 | $langs->load("members"); |
128 | 128 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
129 | - print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Don")).': '; |
|
130 | - print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref','alpha').'" size="10">'; |
|
129 | + print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': '; |
|
130 | + print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref', 'alpha').'" size="10">'; |
|
131 | 131 | print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">'; |
132 | 132 | if (GETPOST('generate_donation_ref')) |
133 | 133 | { |
134 | 134 | print '<br> -> <strong>'; |
135 | - $url=getOnlinePaymentUrl(0,'donation',GETPOST('generate_donation_ref','alpha')); |
|
135 | + $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha')); |
|
136 | 136 | print $url; |
137 | 137 | print "</strong><br>\n"; |
138 | 138 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | print '<br>'; |
142 | 142 | } |
143 | 143 | |
144 | -if (! empty($conf->use_javascript_ajax)) |
|
144 | +if (!empty($conf->use_javascript_ajax)) |
|
145 | 145 | { |
146 | 146 | print "\n".'<script type="text/javascript">'; |
147 | 147 | print '$(document).ready(function () { |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | // Protection to avoid direct call of template |
28 | 28 | if (empty($object) || ! is_object($object)) |
29 | 29 | { |
30 | - print "Error, template page can't be called as URL"; |
|
31 | - exit; |
|
30 | + print "Error, template page can't be called as URL"; |
|
31 | + exit; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | if (! is_object($form)) $form=new Form($db); |
@@ -50,134 +50,134 @@ discard block |
||
50 | 50 | if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) |
51 | 51 | |
52 | 52 | { |
53 | - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) |
|
54 | - { |
|
55 | - // Discard if extrafield is a hidden field on form |
|
56 | - |
|
57 | - $enabled = 1; |
|
58 | - if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$key])) |
|
59 | - { |
|
60 | - $enabled = dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1); |
|
61 | - } |
|
62 | - if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) |
|
63 | - { |
|
64 | - $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); |
|
65 | - } |
|
66 | - $perms = 1; |
|
67 | - if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) |
|
68 | - { |
|
69 | - $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); |
|
70 | - } |
|
71 | - //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
|
72 | - |
|
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
76 | - |
|
77 | - // Load language if required |
|
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
79 | - if ($action == 'edit_extras') |
|
80 | - { |
|
81 | - $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
|
82 | - } |
|
83 | - else |
|
84 | - { |
|
85 | - $value = $object->array_options["options_" . $key]; |
|
86 | - } |
|
87 | - if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
|
88 | - { |
|
89 | - print $extrafields->showSeparator($key, $object); |
|
90 | - } |
|
91 | - else |
|
92 | - { |
|
93 | - print '<tr>'; |
|
94 | - print '<td class="titlefield">'; |
|
95 | - print '<table width="100%" class="nobordernopadding">'; |
|
96 | - print '<tr>'; |
|
97 | - print '<td'; |
|
98 | - print ' class="'; |
|
99 | - //var_dump($action);exit; |
|
100 | - |
|
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
102 | - print '">'; |
|
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | - else print $langs->trans($label); |
|
105 | - print '</td>'; |
|
106 | - |
|
107 | - //TODO Improve element and rights detection |
|
108 | - //var_dump($user->rights); |
|
109 | - $permok=false; |
|
110 | - $keyforperm=$object->element; |
|
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
119 | - if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
120 | - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
|
121 | - && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
|
122 | - { |
|
123 | - $fieldid='id'; |
|
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
125 | - print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
|
126 | - } |
|
127 | - print '</tr></table>'; |
|
128 | - print '</td>'; |
|
129 | - |
|
130 | - $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; |
|
131 | - |
|
132 | - print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>'; |
|
133 | - |
|
134 | - // Convert date into timestamp format |
|
135 | - if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) |
|
136 | - { |
|
137 | - $datenotinstring = $object->array_options['options_' . $key]; |
|
138 | - // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
|
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
140 | - { |
|
141 | - $datenotinstring = $db->jdate($datenotinstring); |
|
142 | - } |
|
143 | - //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
|
144 | - $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
|
145 | - } |
|
146 | - //TODO Improve element and rights detection |
|
147 | - if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
|
148 | - { |
|
149 | - $fieldid='id'; |
|
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
151 | - print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
|
152 | - print '<input type="hidden" name="action" value="update_extras">'; |
|
153 | - print '<input type="hidden" name="attribute" value="' . $key . '">'; |
|
154 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
155 | - print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">'; |
|
156 | - print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); |
|
157 | - |
|
158 | - |
|
159 | - print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
|
160 | - |
|
161 | - print '</form>'; |
|
162 | - } |
|
163 | - else |
|
164 | - { |
|
165 | - //print $key.'-'.$value.'-'.$object->table_element; |
|
166 | - print $extrafields->showOutputField($key, $value, '', $object->table_element); |
|
167 | - } |
|
168 | - |
|
169 | - print '</td>'; |
|
170 | - print '</tr>' . "\n"; |
|
171 | - } |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - // Add code to manage list depending on others |
|
176 | - // TODO Test/enhance this with a more generic solution |
|
177 | - if (! empty($conf->use_javascript_ajax)) |
|
178 | - { |
|
179 | - print "\n"; |
|
180 | - print ' |
|
53 | + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) |
|
54 | + { |
|
55 | + // Discard if extrafield is a hidden field on form |
|
56 | + |
|
57 | + $enabled = 1; |
|
58 | + if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$key])) |
|
59 | + { |
|
60 | + $enabled = dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1); |
|
61 | + } |
|
62 | + if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) |
|
63 | + { |
|
64 | + $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); |
|
65 | + } |
|
66 | + $perms = 1; |
|
67 | + if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) |
|
68 | + { |
|
69 | + $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); |
|
70 | + } |
|
71 | + //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
|
72 | + |
|
73 | + if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | + if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | + if (empty($perms)) continue; // 0 = Not visible |
|
76 | + |
|
77 | + // Load language if required |
|
78 | + if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
79 | + if ($action == 'edit_extras') |
|
80 | + { |
|
81 | + $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
85 | + $value = $object->array_options["options_" . $key]; |
|
86 | + } |
|
87 | + if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
|
88 | + { |
|
89 | + print $extrafields->showSeparator($key, $object); |
|
90 | + } |
|
91 | + else |
|
92 | + { |
|
93 | + print '<tr>'; |
|
94 | + print '<td class="titlefield">'; |
|
95 | + print '<table width="100%" class="nobordernopadding">'; |
|
96 | + print '<tr>'; |
|
97 | + print '<td'; |
|
98 | + print ' class="'; |
|
99 | + //var_dump($action);exit; |
|
100 | + |
|
101 | + if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
102 | + print '">'; |
|
103 | + if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | + else print $langs->trans($label); |
|
105 | + print '</td>'; |
|
106 | + |
|
107 | + //TODO Improve element and rights detection |
|
108 | + //var_dump($user->rights); |
|
109 | + $permok=false; |
|
110 | + $keyforperm=$object->element; |
|
111 | + if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | + if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | + if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | + if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | + if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | + if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | + if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | + if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
119 | + if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
120 | + && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
|
121 | + && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
|
122 | + { |
|
123 | + $fieldid='id'; |
|
124 | + if ($object->table_element == 'societe') $fieldid='socid'; |
|
125 | + print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
|
126 | + } |
|
127 | + print '</tr></table>'; |
|
128 | + print '</td>'; |
|
129 | + |
|
130 | + $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; |
|
131 | + |
|
132 | + print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>'; |
|
133 | + |
|
134 | + // Convert date into timestamp format |
|
135 | + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) |
|
136 | + { |
|
137 | + $datenotinstring = $object->array_options['options_' . $key]; |
|
138 | + // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
|
139 | + if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
140 | + { |
|
141 | + $datenotinstring = $db->jdate($datenotinstring); |
|
142 | + } |
|
143 | + //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
|
144 | + $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
|
145 | + } |
|
146 | + //TODO Improve element and rights detection |
|
147 | + if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
|
148 | + { |
|
149 | + $fieldid='id'; |
|
150 | + if ($object->table_element == 'societe') $fieldid='socid'; |
|
151 | + print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
|
152 | + print '<input type="hidden" name="action" value="update_extras">'; |
|
153 | + print '<input type="hidden" name="attribute" value="' . $key . '">'; |
|
154 | + print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
155 | + print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">'; |
|
156 | + print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); |
|
157 | + |
|
158 | + |
|
159 | + print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
|
160 | + |
|
161 | + print '</form>'; |
|
162 | + } |
|
163 | + else |
|
164 | + { |
|
165 | + //print $key.'-'.$value.'-'.$object->table_element; |
|
166 | + print $extrafields->showOutputField($key, $value, '', $object->table_element); |
|
167 | + } |
|
168 | + |
|
169 | + print '</td>'; |
|
170 | + print '</tr>' . "\n"; |
|
171 | + } |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + // Add code to manage list depending on others |
|
176 | + // TODO Test/enhance this with a more generic solution |
|
177 | + if (! empty($conf->use_javascript_ajax)) |
|
178 | + { |
|
179 | + print "\n"; |
|
180 | + print ' |
|
181 | 181 | <script type="text/javascript"> |
182 | 182 | jQuery(document).ready(function() { |
183 | 183 | function showOptions(child_list, parent_list) |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | setListDependencies(); |
206 | 206 | }); |
207 | 207 | </script>'."\n"; |
208 | - } |
|
208 | + } |
|
209 | 209 | } |
210 | 210 | ?> |
211 | 211 | <!-- END PHP TEMPLATE extrafields_view.tpl.php --> |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | * $cols |
26 | 26 | */ |
27 | 27 | // Protection to avoid direct call of template |
28 | -if (empty($object) || ! is_object($object)) |
|
28 | +if (empty($object) || !is_object($object)) |
|
29 | 29 | { |
30 | 30 | print "Error, template page can't be called as URL"; |
31 | 31 | exit; |
32 | 32 | } |
33 | 33 | |
34 | -if (! is_object($form)) $form=new Form($db); |
|
34 | +if (!is_object($form)) $form = new Form($db); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | ?> |
38 | 38 | <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php --> |
39 | 39 | <?php |
40 | -if (! is_array($parameters)) $parameters = array(); |
|
41 | -if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | -if (! empty($cols)) $parameters['cols'] = $cols; |
|
43 | -if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
40 | +if (!is_array($parameters)) $parameters = array(); |
|
41 | +if (!empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | +if (!empty($cols)) $parameters['cols'] = $cols; |
|
43 | +if (!empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
44 | 44 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); |
45 | 45 | print $hookmanager->resPrint; |
46 | 46 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
@@ -70,19 +70,19 @@ discard block |
||
70 | 70 | } |
71 | 71 | //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
72 | 72 | |
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
73 | + if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | + if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | + if (empty($perms)) continue; // 0 = Not visible |
|
76 | 76 | |
77 | 77 | // Load language if required |
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
78 | + if (!empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
79 | 79 | if ($action == 'edit_extras') |
80 | 80 | { |
81 | - $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
|
81 | + $value = (isset($_POST["options_".$key]) ? $_POST["options_".$key] : $object->array_options["options_".$key]); |
|
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - $value = $object->array_options["options_" . $key]; |
|
85 | + $value = $object->array_options["options_".$key]; |
|
86 | 86 | } |
87 | 87 | if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
88 | 88 | { |
@@ -98,65 +98,65 @@ discard block |
||
98 | 98 | print ' class="'; |
99 | 99 | //var_dump($action);exit; |
100 | 100 | |
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
101 | + if ((!empty($action) && ($action == 'create' || $action == 'edit')) && !empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
102 | 102 | print '">'; |
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
103 | + if (!empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | 104 | else print $langs->trans($label); |
105 | 105 | print '</td>'; |
106 | 106 | |
107 | 107 | //TODO Improve element and rights detection |
108 | 108 | //var_dump($user->rights); |
109 | - $permok=false; |
|
110 | - $keyforperm=$object->element; |
|
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
119 | - if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
109 | + $permok = false; |
|
110 | + $keyforperm = $object->element; |
|
111 | + if ($object->element == 'fichinter') $keyforperm = 'ficheinter'; |
|
112 | + if (isset($user->rights->$keyforperm)) $permok = $user->rights->$keyforperm->creer || $user->rights->$keyforperm->create || $user->rights->$keyforperm->write; |
|
113 | + if ($object->element == 'order_supplier') $permok = $user->rights->fournisseur->commande->creer; |
|
114 | + if ($object->element == 'invoice_supplier') $permok = $user->rights->fournisseur->facture->creer; |
|
115 | + if ($object->element == 'shipping') $permok = $user->rights->expedition->creer; |
|
116 | + if ($object->element == 'delivery') $permok = $user->rights->expedition->livraison->creer; |
|
117 | + if ($object->element == 'productlot') $permok = $user->rights->stock->creer; |
|
118 | + if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; |
|
119 | + if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
|
120 | 120 | && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
121 | 121 | && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
122 | 122 | { |
123 | - $fieldid='id'; |
|
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
125 | - print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
|
123 | + $fieldid = 'id'; |
|
124 | + if ($object->table_element == 'societe') $fieldid = 'socid'; |
|
125 | + print '<td align="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?'.$fieldid.'='.$object->id.'&action=edit_extras&attribute='.$key.'">'.img_edit().'</a></td>'; |
|
126 | 126 | } |
127 | 127 | print '</tr></table>'; |
128 | 128 | print '</td>'; |
129 | 129 | |
130 | 130 | $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; |
131 | 131 | |
132 | - print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols?' colspan="'.$cols.'"':'').'>'; |
|
132 | + print '<td id="'.$html_id.'" class="'.$object->element.'_extras_'.$key.' wordbreak"'.($cols ? ' colspan="'.$cols.'"' : '').'>'; |
|
133 | 133 | |
134 | 134 | // Convert date into timestamp format |
135 | - if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) |
|
135 | + if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date', 'datetime'))) |
|
136 | 136 | { |
137 | - $datenotinstring = $object->array_options['options_' . $key]; |
|
137 | + $datenotinstring = $object->array_options['options_'.$key]; |
|
138 | 138 | // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
139 | + if (!is_numeric($object->array_options['options_'.$key])) // For backward compatibility |
|
140 | 140 | { |
141 | 141 | $datenotinstring = $db->jdate($datenotinstring); |
142 | 142 | } |
143 | 143 | //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
144 | - $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
|
144 | + $value = isset($_POST["options_".$key]) ? dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]) : $datenotinstring; |
|
145 | 145 | } |
146 | 146 | //TODO Improve element and rights detection |
147 | - if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
|
147 | + if ($action == 'edit_extras' && $permok && GETPOST('attribute', 'none') == $key) |
|
148 | 148 | { |
149 | - $fieldid='id'; |
|
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
151 | - print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
|
149 | + $fieldid = 'id'; |
|
150 | + if ($object->table_element == 'societe') $fieldid = 'socid'; |
|
151 | + print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formextra">'; |
|
152 | 152 | print '<input type="hidden" name="action" value="update_extras">'; |
153 | - print '<input type="hidden" name="attribute" value="' . $key . '">'; |
|
154 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
155 | - print '<input type="hidden" name="'.$fieldid.'" value="' . $object->id . '">'; |
|
153 | + print '<input type="hidden" name="attribute" value="'.$key.'">'; |
|
154 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
155 | + print '<input type="hidden" name="'.$fieldid.'" value="'.$object->id.'">'; |
|
156 | 156 | print $extrafields->showInputField($key, $value, '', '', '', 0, $object->id); |
157 | 157 | |
158 | 158 | |
159 | - print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
|
159 | + print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Modify')).'">'; |
|
160 | 160 | |
161 | 161 | print '</form>'; |
162 | 162 | } |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | print '</td>'; |
170 | - print '</tr>' . "\n"; |
|
170 | + print '</tr>'."\n"; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | 174 | |
175 | 175 | // Add code to manage list depending on others |
176 | 176 | // TODO Test/enhance this with a more generic solution |
177 | - if (! empty($conf->use_javascript_ajax)) |
|
177 | + if (!empty($conf->use_javascript_ajax)) |
|
178 | 178 | { |
179 | 179 | print "\n"; |
180 | 180 | print ' |
@@ -31,19 +31,31 @@ discard block |
||
31 | 31 | exit; |
32 | 32 | } |
33 | 33 | |
34 | -if (! is_object($form)) $form=new Form($db); |
|
34 | +if (! is_object($form)) { |
|
35 | + $form=new Form($db); |
|
36 | +} |
|
35 | 37 | |
36 | 38 | |
37 | 39 | ?> |
38 | 40 | <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php --> |
39 | 41 | <?php |
40 | -if (! is_array($parameters)) $parameters = array(); |
|
41 | -if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
42 | -if (! empty($cols)) $parameters['cols'] = $cols; |
|
43 | -if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc; |
|
42 | +if (! is_array($parameters)) { |
|
43 | + $parameters = array(); |
|
44 | +} |
|
45 | +if (! empty($cols)) { |
|
46 | + $parameters['colspan'] = ' colspan="'.$cols.'"'; |
|
47 | +} |
|
48 | +if (! empty($cols)) { |
|
49 | + $parameters['cols'] = $cols; |
|
50 | +} |
|
51 | +if (! empty($object->fk_soc)) { |
|
52 | + $parameters['socid'] = $object->fk_soc; |
|
53 | +} |
|
44 | 54 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); |
45 | 55 | print $hookmanager->resPrint; |
46 | -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
56 | +if ($reshook < 0) { |
|
57 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
58 | +} |
|
47 | 59 | |
48 | 60 | |
49 | 61 | //var_dump($extrafields->attributes[$object->table_element]); |
@@ -70,25 +82,34 @@ discard block |
||
70 | 82 | } |
71 | 83 | //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n"; |
72 | 84 | |
73 | - if (empty($enabled)) continue; // 0 = Never visible field |
|
74 | - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
75 | - if (empty($perms)) continue; // 0 = Not visible |
|
85 | + if (empty($enabled)) { |
|
86 | + continue; |
|
87 | + } |
|
88 | + // 0 = Never visible field |
|
89 | + if (abs($enabled) != 1 && abs($enabled) != 3) { |
|
90 | + continue; |
|
91 | + } |
|
92 | + // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
|
93 | + if (empty($perms)) { |
|
94 | + continue; |
|
95 | + } |
|
96 | + // 0 = Not visible |
|
76 | 97 | |
77 | 98 | // Load language if required |
78 | - if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
99 | + if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) { |
|
100 | + $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]); |
|
101 | + } |
|
79 | 102 | if ($action == 'edit_extras') |
80 | 103 | { |
81 | 104 | $value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]); |
82 | - } |
|
83 | - else |
|
105 | + } else |
|
84 | 106 | { |
85 | 107 | $value = $object->array_options["options_" . $key]; |
86 | 108 | } |
87 | 109 | if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') |
88 | 110 | { |
89 | 111 | print $extrafields->showSeparator($key, $object); |
90 | - } |
|
91 | - else |
|
112 | + } else |
|
92 | 113 | { |
93 | 114 | print '<tr>'; |
94 | 115 | print '<td class="titlefield">'; |
@@ -98,30 +119,53 @@ discard block |
||
98 | 119 | print ' class="'; |
99 | 120 | //var_dump($action);exit; |
100 | 121 | |
101 | - if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; |
|
122 | + if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) { |
|
123 | + print ' fieldrequired'; |
|
124 | + } |
|
102 | 125 | print '">'; |
103 | - if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
104 | - else print $langs->trans($label); |
|
126 | + if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) { |
|
127 | + print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key])); |
|
128 | + } else { |
|
129 | + print $langs->trans($label); |
|
130 | + } |
|
105 | 131 | print '</td>'; |
106 | 132 | |
107 | 133 | //TODO Improve element and rights detection |
108 | 134 | //var_dump($user->rights); |
109 | 135 | $permok=false; |
110 | 136 | $keyforperm=$object->element; |
111 | - if ($object->element == 'fichinter') $keyforperm='ficheinter'; |
|
112 | - if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
113 | - if ($object->element=='order_supplier') $permok=$user->rights->fournisseur->commande->creer; |
|
114 | - if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer; |
|
115 | - if ($object->element=='shipping') $permok=$user->rights->expedition->creer; |
|
116 | - if ($object->element=='delivery') $permok=$user->rights->expedition->livraison->creer; |
|
117 | - if ($object->element=='productlot') $permok=$user->rights->stock->creer; |
|
118 | - if ($object->element=='facturerec') $permok=$user->rights->facture->creer; |
|
137 | + if ($object->element == 'fichinter') { |
|
138 | + $keyforperm='ficheinter'; |
|
139 | + } |
|
140 | + if (isset($user->rights->$keyforperm)) { |
|
141 | + $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write; |
|
142 | + } |
|
143 | + if ($object->element=='order_supplier') { |
|
144 | + $permok=$user->rights->fournisseur->commande->creer; |
|
145 | + } |
|
146 | + if ($object->element=='invoice_supplier') { |
|
147 | + $permok=$user->rights->fournisseur->facture->creer; |
|
148 | + } |
|
149 | + if ($object->element=='shipping') { |
|
150 | + $permok=$user->rights->expedition->creer; |
|
151 | + } |
|
152 | + if ($object->element=='delivery') { |
|
153 | + $permok=$user->rights->expedition->livraison->creer; |
|
154 | + } |
|
155 | + if ($object->element=='productlot') { |
|
156 | + $permok=$user->rights->stock->creer; |
|
157 | + } |
|
158 | + if ($object->element=='facturerec') { |
|
159 | + $permok=$user->rights->facture->creer; |
|
160 | + } |
|
119 | 161 | if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) |
120 | 162 | && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) |
121 | 163 | && empty($extrafields->attributes[$object->table_element]['computed'][$key])) |
122 | 164 | { |
123 | 165 | $fieldid='id'; |
124 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
166 | + if ($object->table_element == 'societe') { |
|
167 | + $fieldid='socid'; |
|
168 | + } |
|
125 | 169 | print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>'; |
126 | 170 | } |
127 | 171 | print '</tr></table>'; |
@@ -136,10 +180,12 @@ discard block |
||
136 | 180 | { |
137 | 181 | $datenotinstring = $object->array_options['options_' . $key]; |
138 | 182 | // print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x'; |
139 | - if (! is_numeric($object->array_options['options_' . $key])) // For backward compatibility |
|
183 | + if (! is_numeric($object->array_options['options_' . $key])) { |
|
184 | + // For backward compatibility |
|
140 | 185 | { |
141 | 186 | $datenotinstring = $db->jdate($datenotinstring); |
142 | 187 | } |
188 | + } |
|
143 | 189 | //print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour'); |
144 | 190 | $value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring; |
145 | 191 | } |
@@ -147,7 +193,9 @@ discard block |
||
147 | 193 | if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key) |
148 | 194 | { |
149 | 195 | $fieldid='id'; |
150 | - if ($object->table_element == 'societe') $fieldid='socid'; |
|
196 | + if ($object->table_element == 'societe') { |
|
197 | + $fieldid='socid'; |
|
198 | + } |
|
151 | 199 | print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">'; |
152 | 200 | print '<input type="hidden" name="action" value="update_extras">'; |
153 | 201 | print '<input type="hidden" name="attribute" value="' . $key . '">'; |
@@ -159,8 +207,7 @@ discard block |
||
159 | 207 | print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">'; |
160 | 208 | |
161 | 209 | print '</form>'; |
162 | - } |
|
163 | - else |
|
210 | + } else |
|
164 | 211 | { |
165 | 212 | //print $key.'-'.$value.'-'.$object->table_element; |
166 | 213 | print $extrafields->showOutputField($key, $value, '', $object->table_element); |