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 '