From a8012d0f1861e53f55f429cb8bb6b9bb71560669 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Dec 2012 18:02:36 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20[=20bug=20#617=20]=20champs=20non=20repr?= =?UTF-8?q?is=20lors=20d'une=20cr=C3=A9ation=20de=20commande=20=C3=A0=20pa?= =?UTF-8?q?rtir=20d'une=20propale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/fiche.php | 26 ++++++++++++-------------- htdocs/core/class/html.form.class.php | 6 +++--- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 7bd1544fe14..cc27e0cd835 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1394,6 +1394,8 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:''); + $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); @@ -1410,6 +1412,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $remise_percent = $soc->remise_percent; $remise_absolue = 0; $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $projectid = 0; } $absolute_discount=$soc->getAvailableDiscounts(); @@ -1432,7 +1435,8 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Reference client print ''.$langs->trans('RefCustomer').''; - print ''; + //print ''; + print ''; // We must not use ref_client of proposal for an order print ''; // Client @@ -1463,43 +1467,37 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G // Date de livraison print "".$langs->trans("DeliveryDate").''; - if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) + if (empty($datedelivery)) { - $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - } - else - { - $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + if (! empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) $datedelivery = time() + ((7*$conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + else $datedelivery=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; } $form->select_date($datedelivery,'liv_','','','',"crea_commande",1,1); print ""; // Conditions de reglement print ''.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1); + $form->select_conditions_paiements($cond_reglement_id,'cond_reglement_id',-1,1); print ''; // Mode de reglement print ''.$langs->trans('PaymentMode').''; - $form->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); + $form->select_types_paiements($mode_reglement_id,'mode_reglement_id'); print ''; // Delivery delay print ''.$langs->trans('AvailabilityPeriod').''; - $form->select_availability($propal->availability,'availability_id','',1); + $form->select_availability($availability_id,'availability_id','',1); print ''; // What trigger creation print ''.$langs->trans('Source').''; - $form->select_demand_reason(($origin=='propal'?'SRC_COMM':''),'demand_reason_id','',1); + $form->select_demand_reason($demand_reason_id,'demand_reason_id','',1); print ''; // Project if (! empty($conf->projet->enabled)) { - $projectid = 0; - if ($origin == 'project') $projectid = ($originid?$originid:0); - print ''.$langs->trans('Project').''; $numprojet=select_projects($soc->id,$projectid); if ($numprojet==0) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 32fd57ec3c5..40cad87130f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1971,10 +1971,10 @@ class Form /** * Return list of events that triggered an object creation * - * @param int $selected Id du type d'origine pre-selectionne + * @param int $selected Id or code of type origin to select by default * @param string $htmlname Nom de la zone select * @param string $exclude To exclude a code value (Example: SRC_PROP) - * @param int $addempty Add an empty entry + * @param int $addempty Add an empty entry * @return void */ function select_demand_reason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0) @@ -1989,7 +1989,7 @@ class Form { if ($arraydemandreason['code']==$exclude) continue; - if ($selected == $arraydemandreason['id']) + if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { print '