diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 57d887b2749..637b0808567 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -314,9 +314,9 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer) { $prod = new Product($db, $_POST['idprod']); $prod->fetch($_POST['idprod']); - + $tva_tx = get_default_tva($mysoc,$commande->client,$prod->tva_tx); - + // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) { @@ -330,7 +330,7 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer) $pu_ttc = $prod->price_ttc; $price_base_type = $prod->price_base_type; } - + // On reevalue prix selon taux tva car taux tva transaction peut etre different // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($tva_tx != $prod->tva_tx) @@ -480,9 +480,9 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer) $commande = new Commande($db); $commande->fetch($_GET['id']); $commande->set_draft($user); - + $result = $commande->set_draft($user); - if ($result >= 0) + if ($result >= 0) { //regeneration pdf if ($_REQUEST['lang_id']) { @@ -674,23 +674,18 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel']) $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } - // Get list of attached files - $listofpaths=array(); - $listofnames=array(); - $listofmimes=array(); - if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]); - if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]); - if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]); - if (! empty($_FILES['addedfile']['tmp_name'])) - { - $listofpaths[] = $_FILES['addedfile']['tmp_name']; - $listofnames[] = $_FILES['addedfile']['name']; - $listofmimes[] = $_FILES['addedfile']['type']; - } + // Create form object + include_once('../html.formmail.class.php'); + $formmail = new FormMail($db); + $attachedfiles=$formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + // Send mail require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); - $mailfile = new CMailFile($subject,$sendto,$from,$message,$listofpaths,$listofmimes,$listofnames,$sendtocc,'',$deliveryreceipt); + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error) { $mesg='
'.$mailfile->error.'
'; @@ -815,38 +810,38 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) if ($num) { $obj = $db->fetch_object($resql); - + $soc = new Societe($db); $soc->fetch($obj->rowid); - + $nbrow=10; - + print '
'; print ''; print '' ."\n"; print ''; print ''; - + print ''; - + // Reference print ''; - + // Reference client print ''; print ''; - + // Client print ''; - + /* * Contact de la commande */ print "'; - + // Ligne info remises tiers print ''; - + // Date print ''; - + // Date de livraison print "'; - + // Conditions de reglement print ''; - + // Mode de reglement print ''; - + // Projet if ($conf->projet->enabled) { @@ -913,7 +908,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) print ''; - + print ''; print '"; - + // Note publique print ''; print ''; print ''; - + // Note privée if (! $user->societe_id) { @@ -939,7 +934,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) print ''; } - + if ($propalid > 0) { $amount = ($obj->price); @@ -963,9 +958,9 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) * Services/produits predefinis */ $NBLINES=8; - + print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; print '
'.$langs->trans('Customer').''.$soc->getNomUrl(1).'
".$langs->trans("DefaultContact").''; $html->select_contacts($soc->id,$setcontact,'contactidp',1); print '
'.$langs->trans('Discounts').''; if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); @@ -857,12 +852,12 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) else print $langs->trans("CompanyHasNoAbsoluteDiscount"); print '.'; print '
'.$langs->trans('Date').''; $html->select_date('','re','','','',"crea_commande"); print '
".$langs->trans("DeliveryDate").""; if ($conf->global->DATE_LIVRAISON_WEEK_DELAY) @@ -886,17 +881,17 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) } print '
'.$langs->trans('PaymentConditionsShort').''; $html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id',-1,1); print '
'.$langs->trans('PaymentMode').''; $html->select_types_paiements($soc->mode_reglement,'mode_reglement_id'); print '
'.$langs->trans('Source').''; $html->selectSourcesCommande('','source_id',1); print '
'.$langs->trans('Model').''; // pdf @@ -922,14 +917,14 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) $liste=$model->liste_modeles($db); $html->select_array('model',$liste,$conf->global->COMMANDE_ADDON_PDF); print "
'.$langs->trans('NotePublic').''; print '
'; - + print ''; print ''; print ''; @@ -1083,14 +1078,14 @@ else { $soc = new Societe($db); $soc->fetch($commande->socid); - + $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); - + $head = commande_prepare_head($commande); dolibarr_fiche_head($head, 'order', $langs->trans("CustomerOrder")); - + /* * Confirmation de la suppression de la commande */ @@ -1099,7 +1094,7 @@ else $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); print '
'; } - + /* * Confirmation de la validation */ @@ -1120,7 +1115,7 @@ else $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate'); print '
'; } - + /* * Confirmation de la cloture */ @@ -1129,7 +1124,7 @@ else $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close'); print '
'; } - + /* * Confirmation de l'annulation */ @@ -1138,7 +1133,7 @@ else $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel'); print '
'; } - + /* * Confirmation de la suppression d'une ligne produit */ @@ -1147,20 +1142,20 @@ else $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); print '
'; } - + /* * Commande */ $nbrow=8; if ($conf->projet->enabled) $nbrow++; - + print '
'.$langs->trans('ProductsAndServices').''.$langs->trans('Qty').'
'; - + // Ref print ''; print ''; print ''; - + // Ref commande client print '
'.$langs->trans('Ref').''.$commande->ref.'
'; print ''; print ''; - + // Societe print ''; @@ -1301,7 +1296,7 @@ else $html->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none'); } print ''; - + //Note public lorsque le module expedition n'est pas active if (!$conf->projet->enabled) $nbrow--; if (!$conf->expedition->enabled) @@ -1312,7 +1307,7 @@ else print nl2br($commande->note_public); print ''; } - + print ''; print '
'; @@ -1183,7 +1178,7 @@ else } print '
'.$langs->trans('Company').'
'; print ''; print ''; print ''; - + print ''; print ''; print ''; @@ -1731,7 +1726,7 @@ else print '
'; @@ -1687,7 +1682,7 @@ else print ''.$langs->trans('ReductionShort').' 
'; print ''; - + /* * Boutons actions */ @@ -1869,7 +1864,7 @@ else print '
'; } - + if ($_GET['action'] != 'presend') { print '
'; @@ -1935,7 +1930,7 @@ else include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php'); $formactions=new FormActions($db); $somethingshown=$formactions->showactions($commande,'order',$socid); - + print '
'; } @@ -1972,7 +1967,7 @@ else $formmail->withto=$liste; $formmail->withtocc=1; $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); - $formmail->withfile=1; + $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; $formmail->withcancel=1; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e8e49fb1838..6898c3e10f5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1100,7 +1100,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a $filename = $attachedfiles['names']; $mimetype = $attachedfiles['mimes']; - // Envoi de la facture + // Send mail require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php'); $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt); if ($mailfile->error)