diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 6c9423b6178..feccaca0783 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -679,7 +679,16 @@ if ($rowid > 0) print '

'; foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); + if (isset($_POST["options_" . $key])) { + if (is_array($_POST["options_" . $key])) { + // $_POST["options"] is an array but following code expects a comma separated string + $value = implode(",", $_POST["options_" . $key]); + } else { + $value = $_POST["options_" . $key]; + } + } else { + $value = $adht->array_options["options_" . $key]; + } print '\n"; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8eef2b06b8b..94905919022 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1303,7 +1303,16 @@ if ($id > 0) print '

'.$label.''; print $extrafields->showInputField($key,$value); print "
'; foreach($extrafields->attribute_label as $key=>$label) { - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:'')); + if (isset($_POST["options_" . $key])) { + if (is_array($_POST["options_" . $key])) { + // $_POST["options"] is an array but following code expects a comma separated string + $value = implode(",", $_POST["options_" . $key]); + } else { + $value = $_POST["options_" . $key]; + } + } else { + $value = $object->array_options["options_" . $key]; + } print '\n"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index bfbc45b613d..b818de76a0e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -462,7 +462,7 @@ class Propal extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 80ca5e1f139..eee909645d7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -180,7 +180,7 @@ class Facture extends CommonInvoice const TYPE_DEPOSIT = 3; /** - * Proforma invoice + * Proforma invoice (should not be used. a proforma is an order) */ const TYPE_PROFORMA = 4; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e88f4c95d54..e4953c99853 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1284,7 +1284,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1457,7 +1457,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2449,7 +2449,7 @@ class ContratLigne extends CommonObjectLine */ function update($user, $notrigger=0) { - global $conf, $langs; + global $conf, $langs, $mysoc; $error=0; @@ -2491,7 +2491,9 @@ class ContratLigne extends CommonObjectLine // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1); + $localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->societe, $mysoc); + + $tabprice=calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type); $this->total_ht = $tabprice[0]; $this->total_tva = $tabprice[1]; $this->total_ttc = $tabprice[2]; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bcc0049a1d3..1cf042e9d13 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3805,10 +3805,10 @@ abstract class CommonObject /** * Function to show lines of extrafields with output datas * - * @param object $extrafields Extrafield Object - * @param string $mode Show output ('view') or input ('edit') for extrafield - * @param array $params Optionnal parameters. Example: array('colspan'=>2) - * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param Extrafields $extrafields Extrafield Object + * @param string $mode Show output (view) or input (edit) for extrafield + * @param array $params Optional parameters + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * * @return string */ @@ -3839,7 +3839,16 @@ abstract class CommonObject $value=$this->array_options["options_".$key]; break; case "edit": - $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]); + if (isset($_POST["options_" . $key])) { + if (is_array($_POST["options_" . $key])) { + // $_POST["options"] is an array but following code expects a comma separated string + $value = implode(",", $_POST["options_" . $key]); + } else { + $value = $_POST["options_" . $key]; + } + } else { + $value = $this->array_options["options_" . $key]; + } break; } if ($extrafields->attribute_type[$key] == 'separate') diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0807bbcec75..4d9fec42bf9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -815,7 +815,9 @@ class ExtraFields { $sqlwhere.= ' WHERE '.$InfoFieldList[4]; } - }else { + } + else + { $sqlwhere.= ' WHERE 1'; } if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it. @@ -1451,7 +1453,7 @@ class ExtraFields else if (in_array($key_type,array('checkbox'))) { $value_arr=GETPOST($keysuffix."options_".$key.$keyprefix); - $value_key=implode($value_arr,','); + $value_key=implode(',', $value_arr); } else if (in_array($key_type,array('price','double'))) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 2856fcb93a3..d58f4568e7c 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -304,7 +304,6 @@ if ($action == 'add') $urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount')); if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email')); - if (! empty($entity)) $urlback.='&entity='.$entity; } else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { @@ -315,7 +314,7 @@ if ($action == 'add') { $urlback.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2); } - if (! empty($entity)) $urlback.='&entity='.$entity; + } else { @@ -324,6 +323,7 @@ if ($action == 'add') } } + if (! empty($entity)) $urlback.='&entity='.$entity; dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); Header("Location: ".$urlback); exit;
'.$label.''; print $extrafields->showOutputField($key,$value); print "