diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e2613e235ae..6de91ed5b7f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1021,8 +1021,8 @@ if ($id > 0 || ! empty($ref)) $propal = new Propal($db); $propal->fetch($id,$ref); - $societe = new Societe($db); - $societe->fetch($propal->socid); + $soc = new Societe($db); + $soc->fetch($propal->socid); $head = propal_prepare_head($propal); dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); @@ -1129,16 +1129,16 @@ if ($id > 0 || ! empty($ref)) $rowspan=9; // Company - print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; + print ''.$langs->trans('Company').''.$soc->getNomUrl(1).''; print ''; // Ligne info remises tiers print ''.$langs->trans('Discounts').''; - if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client); + if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; - $absolute_discount=$societe->getAvailableDiscounts('','fk_facture_source IS NULL'); - $absolute_creditnote=$societe->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); + $absolute_discount=$soc->getAvailableDiscounts('','fk_facture_source IS NULL'); + $absolute_creditnote=$soc->getAvailableDiscounts('','fk_facture_source IS NOT NULL'); $absolute_discount=price2num($absolute_discount,'MT'); $absolute_creditnote=price2num($absolute_creditnote,'MT'); if ($absolute_discount) @@ -1152,7 +1152,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
'; - $html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$propal->id,0,'remise_id',$societe->id,$absolute_discount,$filter); + $html->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$propal->id,0,'remise_id',$soc->id,$absolute_discount,$filter); } } if ($absolute_creditnote) @@ -1575,7 +1575,7 @@ if ($id > 0 || ! empty($ref)) $var=true; - $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf,1,0,0,28,0,'',0,'',$societe->default_lang); + $somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf,1,0,0,28,0,'',0,'',$soc->default_lang); /* @@ -1623,7 +1623,7 @@ if ($id > 0 || ! empty($ref)) $formmail->frommail = $user->email; $formmail->withfrom=1; $formmail->withto=empty($_POST["sendto"])?1:$_POST["sendto"]; - $formmail->withtosocid=$societe->id; + $formmail->withtosocid=$soc->id; $formmail->withtocc=1; $formmail->withtoccsocid=0; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c6b9ad65015..a56536a308e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2998,143 +2998,18 @@ else */ if ($fac->statut == 0 && $user->rights->facture->creer && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline') { - // Free zone form - print ''; - print ''; - print ''; // ancre - print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").''; - print ''.$langs->trans('VAT').''; - print ''.$langs->trans('PriceUHT').''; - print ''.$langs->trans('Qty').''; - print ''.$langs->trans('ReductionShort').''; - print ' '; - print "\n"; - - // Add free products/services form - print '
'; - print ''; - print ''; - print ''; - $var=true; - print ''; - print ''; - - print $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1); - if (($conf->product->enabled && $conf->service->enabled) - || (empty($conf->product->enabled) && empty($conf->service->enabled))) print '
'; - - // Editor wysiwyg - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) - { - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('dp_desc',$_POST["dp_desc"],100,'dolibarr_details'); - $doleditor->Create(); - } - else - { - $nbrows=ROWS_2; - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - print ''; - } - print ''; - print ''; - if($soc->tva_assuj == "0") - print '0'; - else - $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc); - print ''; - print ''; - print ''; - print '%'; - print ''; - print ''; - if ($conf->service->enabled) - { - print ''; - print ''.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - print $html->select_date('','date_start',$usehm,$usehm,1,"addline"); - print ' '.$langs->trans('to').' '; - print $html->select_date('','date_end',$usehm,$usehm,1,"addline"); - print ''; - print ''; - } - print '
'; - - - // Predefined services/products form + + $fac->showAddFreeProductForm(1); + + // Add predefined products/services if ($conf->product->enabled || $conf->service->enabled) { - print ''; - print ''; - print $langs->trans("AddNewLine").' - '; - if ($conf->service->enabled) - { - print $langs->trans('RecordedProductsAndServices'); - } - else - { - print $langs->trans('RecordedProducts'); - } - print ''; - print ''.$langs->trans('Qty').''; - print ''.$langs->trans('ReductionShort').''; - print ' '; - print ''; - - print '
'; - print ''; - print ''; - print ''; - - $var=! $var; - print ''; - print ''; - // multiprix - if($conf->global->PRODUIT_MULTIPRICES) - { - $html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->product->limit_size,$soc->price_level); - } - else - { - $html->select_produits((! empty($_POST['idprod'])?$_POST['idprod']:''),'idprod','',$conf->product->limit_size); - } - - if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '
'; - - // Editor wysiwyg - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS) - { - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); - $doleditor=new DolEditor('np_desc',$_POST["np_desc"],100,'dolibarr_details'); - $doleditor->Create(); - } - else - { - $nbrows=ROWS_2; - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - print ''; - } - - print ''; - print ''; - print '%'; - print ''; - print ''; - if ($conf->service->enabled) - { - print ''; - print ''.$langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - print $html->select_date('','date_start_predef',$usehm,$usehm,1,"addline_predef"); - print ' '.$langs->trans('to').' '; - print $html->select_date('','date_end_predef',$usehm,$usehm,1,"addline_predef"); - print ''; - print ''; - } - print '
'; + $var=!$var; + $fac->showAddPredefinedProductForm(1); } - } + print "\n"; print "\n"; diff --git a/htdocs/core/tpl/addfreeproductform.tpl.php b/htdocs/core/tpl/addfreeproductform.tpl.php index 34f57ecb034..4f0b9e0ece8 100644 --- a/htdocs/core/tpl/addfreeproductform.tpl.php +++ b/htdocs/core/tpl/addfreeproductform.tpl.php @@ -64,15 +64,15 @@ if ($conf->global->PRODUIT_USE_MARKUP) $colspan = 'colspan="2"'; tva_assuj == "0") + if ($soc->tva_assuj == "0") echo '0'; else - $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe); + $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $soc); ?> "> - % + % diff --git a/htdocs/core/tpl/addpredefinedproductform.tpl.php b/htdocs/core/tpl/addpredefinedproductform.tpl.php index 13d2c39bb16..4d7bb014d52 100644 --- a/htdocs/core/tpl/addpredefinedproductform.tpl.php +++ b/htdocs/core/tpl/addpredefinedproductform.tpl.php @@ -53,7 +53,7 @@ $colspan = 'colspan="3"'; global->PRODUIT_MULTIPRICES) - $html->select_produits('','idprod','',$conf->product->limit_size,$societe->price_level); + $html->select_produits('','idprod','',$conf->product->limit_size,$soc->price_level); else $html->select_produits('','idprod','',$conf->product->limit_size); @@ -75,7 +75,7 @@ $colspan = 'colspan="3"'; ?> - % + % " name="addline">