diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index ab3d3cb8d2a..0f3ee6b9381 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -20,18 +20,18 @@ */ /** - \file htdocs/comm/addpropal.php - \ingroup propal - \brief Page d'ajout d'une proposition commmercial - \version $Id$ -*/ + \file htdocs/comm/addpropal.php + \ingroup propal + \brief Page d'ajout d'une proposition commmercial + \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/propal.class.php'); require_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php'); if (defined("PROPALE_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php")) { - require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php"); + require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php"); } if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php'); @@ -67,45 +67,45 @@ if ($_GET["projetid"]) */ if ($_GET["action"] == 'create') { - $soc = new Societe($db); - $result=$soc->fetch($_GET["socid"]); - if ($result < 0) - { - dolibarr_print_error($db,$soc->error); - exit; - } + $soc = new Societe($db); + $result=$soc->fetch($_GET["socid"]); + if ($result < 0) + { + dolibarr_print_error($db,$soc->error); + exit; + } - $propal = new Propal($db); - $propal->date=time(); - - $obj = $conf->global->PROPALE_ADDON; - $modPropale = new $obj; - $numpr = $modPropale->getNextValue($soc,$propal); + $propal = new Propal($db); + $propal->date=time(); + + $obj = $conf->global->PROPALE_ADDON; + $modPropale = new $obj; + $numpr = $modPropale->getNextValue($soc,$propal); // Fix pour modele numerotation qui deconne // Si numero deja pris (ne devrait pas arriver), on incremente par .num+1 - $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."propal WHERE ref like '$numpr%'"; - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $num = $obj->nb; - $db->free($resql); - if ($num > 0) - { - $numpr .= "." . ($num + 1); - } - } + $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."propal WHERE ref like '$numpr%'"; + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + $num = $obj->nb; + $db->free($resql); + if ($num > 0) + { + $numpr .= "." . ($num + 1); + } + } - print "
id."\" method=\"post\">"; - print ""; + print "id."\" method=\"post\">"; + print ""; - print ''; + print '
'; - // Ref - print ''; + // Ref + print ''; - // Reference client + // Reference client print ''; print ''; @@ -117,14 +117,14 @@ if ($_GET["action"] == 'create') print ''; /* - * Contact de la propale - */ - print "'; + * Contact de la propale + */ + print "'; // Ligne info remises tiers - print ''; // Date de livraison (ou de fabrication) -if ($conf->expedition->enabled) -{ - if ($conf->global->PROPALE_ADD_SHIPPING_DATE) + if ($conf->expedition->enabled) { - print ''; - print ''; + print ''; } - else + + // Adresse de livraison + if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) { - $html->select_date(-1,'liv_','','','',"addprop"); + print ''; + print ''; } - print ''; } - // Adresse de livraison - if ($conf->global->PROPALE_ADD_DELIVERY_ADDRESS) - { - print ''; - print ''; - } -} - - // Model - print ''; - print ''; - print '"; + // Model + print ''; + print ''; + print '"; // Projet - if ($conf->projet->enabled) - { - print ''; - print ''; + print ''; + $numprojet=select_projects($soc->id,$projetid,'projetidp'); + if ($numprojet==0) + { + print '   '.$langs->trans("AddProject").''; + } + print ''; print ''; - } + } - print "
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans('RefCustomer').''; print '
".$langs->trans("DefaultContact")."\n"; - $html->select_contacts($soc->id,$setcontact,'contactidp',1); - print '
".$langs->trans("DefaultContact")."\n"; + $html->select_contacts($soc->id,$setcontact,'contactidp',1); + print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$soc->getAvailableDiscounts(); @@ -152,151 +152,152 @@ if ($_GET["action"] == 'create') print '
'.$langs->trans("DeliveryDate").''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") + if ($conf->global->PROPALE_ADD_SHIPPING_DATE) { - $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); - $syear = date("Y", $tmpdte); - $smonth = date("m", $tmpdte); - $sday = date("d", $tmpdte); - $html->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); + print '
'.$langs->trans("DeliveryDate").''; + if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") + { + $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); + $syear = date("Y", $tmpdte); + $smonth = date("m", $tmpdte); + $sday = date("d", $tmpdte); + $html->select_date($syear."-".$smonth."-".$sday,'liv_','','','',"addprop"); + } + else + { + $datepropal=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $html->select_date($datepropal,'liv_','','','',"addprop"); + } + print '
'.$langs->trans('DeliveryAddress').''; + $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1); + if ($numaddress==0) + { + print '   id.'&action=create>'.$langs->trans("AddAddress").''; + } + print '
'.$langs->trans('DeliveryAddress').''; - $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1); - if ($numaddress==0) - { - print '   id.'&action=create>'.$langs->trans("AddAddress").''; - } - print '
'.$langs->trans("DefaultModel").''; - $model=new ModelePDFPropales(); - $liste=$model->liste_modeles($db); - $html->select_array('model',$liste,$conf->global->PROPALE_ADDON_PDF); - print "
'.$langs->trans("DefaultModel").''; + $model=new ModelePDFPropales(); + $liste=$model->liste_modeles($db); + $html->select_array('model',$liste,$conf->global->PROPALE_ADDON_PDF); + print "
'.$langs->trans("Project").''; + if ($conf->projet->enabled) + { + print '
'.$langs->trans("Project").''; - $numprojet=select_projects($soc->id,$projetid,'projetidp'); - if ($numprojet==0) - { - print '   '.$langs->trans("AddProject").''; - } - print '
"; + print ""; print '
'; - /* - * Combobox pour la fonction de copie - */ - print ''; - print ''; - print ''; - print ''; - print '"; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 3e25a30adbd..30eab293a6e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1291,7 +1291,7 @@ if ($_GET['action'] == 'create') $mode_reglement_id = $soc->mode_reglement; $remise_percent = $soc->remise_client; $remise_absolue = 0; - $dateinvoice=-1; + $dateinvoice=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; } $absolute_discount=$soc->getAvailableDiscounts(); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 8e499077251..4fb065a6e9a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -279,9 +279,10 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P print '\n"; // Date payment - $datepaye = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); print ''; print ''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index bd2b10814b1..894c12b5b94 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -206,7 +206,8 @@ if ($_GET["action"] == 'create') print ""; print '"; print ''; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 16eb7f74448..8706b2f6186 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -529,17 +529,17 @@ function dolibarr_getdate($timestamp,$fast=false) } /** - \brief Retourne une date fabriqu�e depuis infos. - Remplace la fonction mktime non impl�ment�e sous Windows si ann�e < 1970 - \param hour Heure + \brief Retourne une date fabriquee depuis infos. + Remplace la fonction mktime non implementee sous Windows si annee < 1970 + \param hour Hour \param minute Minute - \param second Seconde - \param month Mois - \param day Jour - \param year Ann�e + \param second Second + \param month Month + \param day Day + \param year Year \param gm Time gm \param check No check on parameters (Can use day 32, etc...) - \return timestamp Date en timestamp, '' if error + \return timestamp Date en timestamp, '' if error \remarks PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows */ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=0,$check=1)
'.$langs->trans("CopyPropalFrom").' '; - $liste_propal = array(); - $liste_propal[0] = ''; - $sql ="SELECT p.rowid as id, p.ref, s.nom"; - $sql.=" FROM ".MAIN_DB_PREFIX."propal p, ".MAIN_DB_PREFIX."societe s"; - $sql.=" WHERE s.rowid = p.fk_soc AND fk_statut <> 0 ORDER BY Id"; - $resql = $db->query($sql); - if ($resql) - { + /* + * Combobox pour la fonction de copie + */ + print ''; + print ''; + print ''; + print ''; + print ''; + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row($resql); + $propalRefAndSocName = $row[1]." - ".$row[2]; + $liste_propal[$row[0]]=$propalRefAndSocName; + $i++; + } + $html->select_array("copie_propal",$liste_propal, 0); + } + else + { + dolibarr_print_error($db); + } + print ''; - if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) print ''; + if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) print ''; - print ''; + print ''; print ''; if ($conf->global->PRODUCT_SHOW_WHEN_CREATE) { - print ''; + } + else + { + print ' '; + } + print ''; } print '
'.$langs->trans("CopyPropalFrom").' '; + $liste_propal = array(); + $liste_propal[0] = ''; + $sql ="SELECT p.rowid as id, p.ref, s.nom"; + $sql.=" FROM ".MAIN_DB_PREFIX."propal p, ".MAIN_DB_PREFIX."societe s"; + $sql.=" WHERE s.rowid = p.fk_soc AND fk_statut <> 0 ORDER BY Id"; + $resql = $db->query($sql); + if ($resql) + { $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $propalRefAndSocName = $row[1]." - ".$row[2]; - $liste_propal[$row[0]]=$propalRefAndSocName; - $i++; - } - $html->select_array("copie_propal",$liste_propal, 0); - } - else - { - dolibarr_print_error($db); - } - print '
 
 
'.$langs->trans("CreateEmptyPropal").'
'; - if ($conf->produit->enabled || $conf->service->enabled) - { - $lib=$langs->trans("ProductsAndServices"); + print '
'; + if ($conf->produit->enabled || $conf->service->enabled) + { + $lib=$langs->trans("ProductsAndServices"); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - for ($i = 1 ; $i <= $conf->global->PROPALE_NEW_FORM_NB_PRODUCT ; $i++) - { - print '
'.$lib.''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + for ($i = 1 ; $i <= $conf->global->PROPALE_NEW_FORM_NB_PRODUCT ; $i++) + { + print ''; - print ''; - print ''; + $html->select_produits('',"idprod".$i,'',$conf->produit->limit_size); + print ''; + print ''; + print ''; print ''; - } + } - print "
'.$lib.''.$langs->trans("Qty").''.$langs->trans("ReductionShort").'
'; // multiprix if($conf->global->PRODUIT_MULTIPRICES == 1) - $html->select_produits('',"idprod".$i,'',$conf->produit->limit_size,$soc->price_level); + $html->select_produits('',"idprod".$i,'',$conf->produit->limit_size,$soc->price_level); else - $html->select_produits('',"idprod".$i,'',$conf->produit->limit_size); - print '%%
"; + print "
"; - } - else - { - print ' '; - } - print '
'; - print '
'; + print '
'; - $langs->load("bills"); - print '
'; - print ''; - print '
'; + $langs->load("bills"); + print '
'; + print ''; + print '
'; - print ""; + print ""; } $db->close(); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 0097ca20a45..c3b26408969 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -867,7 +867,8 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) } else { - $html->select_date(-1,'liv_','','',1,"crea_commande"); + $dateorder=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $html->select_date($dateorder,'liv_','','',1,"crea_commande"); } print "
'.$langs->trans('Company').''.$facture->client->getNomUrl(4)."
'.$langs->trans('Date').''; - $html->select_date((! empty($datepaye) ? $datepaye : -1),'','','',0,"add_paiement"); + $datepayment = dolibarr_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0) : $datepayment); + $html->select_date($datepayment,'','','',0,"add_paiement"); print ''.$langs->trans('Comments').'
'.$langs->trans("Date").''; - $html->select_date(-1,'','','','',"add_paiement"); + $datepayment=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; + $html->select_date($datepayment,'','','','',"add_paiement"); print "'.$langs->trans("Comments").'