From 803f840761400f768d8a6d997da92d0c9249ac94 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Aug 2012 13:12:20 +0200 Subject: [PATCH 01/18] Qual: Rename label to avoid confusion. Qual: Fix code to reflect documentation. --- htdocs/commande/liste.php | 3 +- htdocs/commande/orderstoinvoice.php | 362 +++++++++++++----------- htdocs/core/menus/standard/eldy.lib.php | 4 +- htdocs/langs/en_US/orders.lang | 8 +- htdocs/langs/fr_FR/orders.lang | 8 +- 5 files changed, 205 insertions(+), 180 deletions(-) diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 5efeaad7b04..9416732af77 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -98,7 +98,8 @@ $formother = new FormOther($db); $formfile = new FormFile($db); $companystatic = new Societe($db); -llxHeader(); +$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; +llxHeader('',$langs->trans("Orders"),$help_url); $sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,'; $sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as facturee'; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index cae2461a780..b99b92391a9 100755 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -29,10 +29,12 @@ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); -require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php"); +require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); +require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/report.lib.php"); +if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php"); $langs->load('orders'); $langs->load('deliveries'); @@ -73,10 +75,9 @@ if ($action == 'create') } } $now=dol_now(); -$html = new Form($db); -$formfile = new FormFile($db); -$companystatic = new Societe($db); -$htmlother = new FormOther($db); + +$viewstatut=GETPOST('viewstatut'); + /* * Actions @@ -267,30 +268,30 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { $fk_parent_line = 0; } - $result = $object->addline( - $id, - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $date_start, - $date_end, - 0, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $product_type, - $lines[$i]->rang, - $lines[$i]->special_code, - $object->origin, - $lines[$i]->rowid, - $fk_parent_line - ); + $result = $object->addline( + $id, + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $lines[$i]->rang, + $lines[$i]->special_code, + $object->origin, + $lines[$i]->rowid, + $fk_parent_line + ); if ($result > 0) { $lineid=$result; @@ -342,146 +343,149 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) $mesgs[]='
'.$object->error.'
'; } } +} - /* - * View - */ - $html = new Form($db); - $htmlother = new FormOther($db); - $formfile = new FormFile($db); - $now=dol_now(); - // Mode creation - if ($action == 'create') +/* + * View + */ + +$html = new Form($db); +$htmlother = new FormOther($db); +$formfile = new FormFile($db); +$companystatic = new Societe($db); + +// Mode creation +if ($action == 'create') +{ + $facturestatic=new Facture($db); + + llxHeader(); + print_fiche_titre($langs->trans('NewBill')); + + $soc = new Societe($db); + if ($socid) $res=$soc->fetch($socid); + if ($res) { - $facturestatic=new Facture($db); + $cond_reglement_id = $soc->cond_reglement_id; + $mode_reglement_id = $soc->mode_reglement_id; + $remise_percent = $soc->remise_percent; + } + $remise_absolue = 0; + $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; - llxHeader(); - print_fiche_titre($langs->trans('NewBill')); + $absolute_discount=$soc->getAvailableDiscounts(); + print '
'; + print ''; + print ''; + print '' ."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + // Ref + print ''; + // Tiers + print ''; + print ''."\n"; + print ''; + // Payment term + print ''; + // Payment mode + print ''; + // Project + if ($conf->projet->enabled) + { + $langs->load('projects'); + print ''; + } + // Modele PDF + print ''; + print '"; - $soc = new Societe($db); - if ($socid) $res=$soc->fetch($socid); - if ($res) + // Public note + print ''; + print ''; + print ''; + // Private note + if (! $user->societe_id) + { print ''; - print ''; + print ''; print ''; - // Private note - if (! $user->societe_id) - { - print ''; - print ''; - print ''; - } - - print '
'.$langs->trans('Ref').''.$langs->trans('Draft').'
'.$langs->trans('Customer').''; + print $soc->getNomUrl(1); + print ''; + print '
'.$langs->trans('Type').''; + print ''."\n"; + // Standard invoice + print ''."\n"; + print '
'; + print ''; + print ''; + $desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1); + print $desc; + print '
'; + // Date invoice + print '
'.$langs->trans('Date').''; + $html->select_date(0,'','','','',"add",1,1); + print '
'.$langs->trans('PaymentConditionsShort').''; + $html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id'); + print '
'.$langs->trans('PaymentMode').''; + $html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id'); + print '
'.$langs->trans('Project').''; + select_projects($soc->id, $projectid, 'projectid'); + print '
'.$langs->trans('Model').''; + include_once(DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'); + $liste=ModelePDFFactures::liste_modeles($db); + print $html->selectarray('model',$liste,$conf->global->FACTURE_ADDON_PDF); + print "
'.$langs->trans('NotePublic').''; + print '
'.$langs->trans('NotePublic').''.$langs->trans('NotePrivate').''; - print '
'.$langs->trans('NotePrivate').''; - print '
'; - print ''; - } + print ''; + print ''; + + while ($i < $n) { print ''; - + $i++; } - + print "\n"; // Button "Create Draft" print '
'; print "
\n"; } + //Mode liste -else +if (($action != 'create' && $action != 'add') || ! empty($mesgs)) { llxHeader(); ?> - rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ' WHERE c.fk_soc = s.rowid'; - $sql.= ' AND c.fk_statut in (1, 2) AND c.facture = 0'; + // Which invoice to show + if ($viewstatut <> '') + { + if ($viewstatut < 4 && $viewstatut > -2) + { + $sql.= ' AND c.fk_statut ='.$viewstatut; // brouillon, validee, en cours, annulee + if ($viewstatut == 3) + { + $sql.= ' AND c.facture = 0'; // need to create invoice + } + } + if ($viewstatut == 4) + { + $sql.= ' AND c.facture = 1'; // invoice created + } + if ($viewstatut == -2) // To process + { + //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; + $sql.= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected + } + } $sql.= ' AND s.entity = '.$conf->entity; if ($socid) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; @@ -511,18 +535,18 @@ else { $sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')"; } - + //Date filter if ($date_start && $date_end) $sql.= " AND c.date_commande >= '".$db->idate($date_start)."' AND c.date_commande <= '".$db->idate($date_end)."'"; if ($date_starty && $date_endy) $sql.= " AND c.date_livraison >= '".$db->idate($date_starty)."' AND c.date_livraison <= '".$db->idate($date_endy)."'"; - + if (!empty($sref_client)) { $sql.= ' AND c.ref_client LIKE \'%'.$db->escape($sref_client).'%\''; } $sql.= ' ORDER BY '.$sortfield.' '.$sortorder; $resql = $db->query($sql); - + if ($resql) { if ($socid) @@ -545,7 +569,7 @@ else print '

'; $companystatic->id=$socid; $companystatic->nom=$soc->nom; - + print $companystatic->getNomUrl(1,'customer'); print '

'; print ''; @@ -557,7 +581,7 @@ else print_liste_field_titre($langs->trans('Status'),'','','','','align="right"'); print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"'); print ''; - + // Lignes des champs de filtre print ''; print ''; @@ -569,52 +593,52 @@ else //print ''; - + print ''; + //DATE DELIVERY print ''; - - //SEARCH BUTTON + + //SEARCH BUTTON print ''; - + print ''; print ''; - + print ''; $var=True; $generic_commande = new Commande($db); - + while ($i < $num) { $objp = $db->fetch_object($resql); $var=!$var; print ''; print ''; - + print ''; - + // Order date print ''; - + //Delivery date print ''; - + // Statut print ''; - + // Checkbox print '' ; - + print ''; - + $total = $total + $objp->price; $subtotal = $subtotal + $objp->price; $i++; } print '
'; print ''; print ''; - + //DATE ORDER print ''; print $period; - print ''; print $periodely; print ''; print ''; - + //ALL/NONE print ''; if ($conf->use_javascript_ajax) print ''.$langs->trans("All").' / '.$langs->trans("None").''; print '
'; - + $generic_commande->id=$objp->rowid; $generic_commande->ref=$objp->ref; - + print ''; print ''; - + print ''; - + print '
'; print $generic_commande->getNomUrl(1,$objp->fk_statut); print ''; if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $db->jdate($objp->date_valid) < ($now - $conf->commande->client->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print ''; $filename=dol_sanitizeFileName($objp->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); @@ -622,37 +646,37 @@ else $formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1); print '
'; print '
'.$objp->ref_client.''; print dol_print_date($db->jdate($objp->date_commande),'day'); print ''; print dol_print_date($db->jdate($objp->date_livraison),'day'); print ''.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).''; print ''; print '
'; - + /* - * Boutons actions + * Boutons actions */ print '
'; print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 9a51e08ea37..e24124c3239 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -858,8 +858,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/commande/liste.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire); - if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); + if ($leftmenu=="orders" && $conf->expedition->enabled) $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderOnProcessShort"), 2, $user->rights->commande->lire); + if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=".($conf->expedition->enabled?"3":"-2"), $langs->trans("StatusOrderToBill"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add("/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 570afcdabfb..cc63582c5ab 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -21,7 +21,7 @@ CustomersOrders=Customer's orders CustomersOrdersRunning=Current customer's orders CustomersOrdersAndOrdersLines=Customer orders and order's lines OrdersToValid=Customer's orders to validate -OrdersToBill=Customer's orders to bill +OrdersToBill=Customer's orders delivered OrdersInProcess=Customer's orders in process OrdersToProcess=Customer's orders to process SuppliersOrdersToProcess=Supplier's orders to process @@ -32,7 +32,7 @@ StatusOrderSentShort=In process StatusOrderSent=Shipment in process StatusOrderOnProcessShort=Reception StatusOrderProcessedShort=Processed -StatusOrderToBillShort=To bill +StatusOrderToBillShort=Delivered StatusOrderApprovedShort=Approved StatusOrderRefusedShort=Refused StatusOrderToProcessShort=To process @@ -43,7 +43,7 @@ StatusOrderDraft=Draft (needs to be validated) StatusOrderValidated=Validated StatusOrderOnProcess=Waiting to receive StatusOrderProcessed=Processed -StatusOrderToBill=To bill +StatusOrderToBill=Delivered StatusOrderApproved=Approved StatusOrderRefused=Refused StatusOrderReceivedPartially=Partially received @@ -51,7 +51,7 @@ StatusOrderReceivedAll=Everything received ShippingExist=A shipment exists DraftOrWaitingApproved=Draft or approved not yet ordered DraftOrWaitingShipped=Draft or validated not yet shipped -MenuOrdersToBill=Orders to bill +MenuOrdersToBill=Orders delivered SearchOrder=Search order Sending=Sending Sendings=Sendings diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang index cac2bcc278c..329afb01a8d 100644 --- a/htdocs/langs/fr_FR/orders.lang +++ b/htdocs/langs/fr_FR/orders.lang @@ -21,7 +21,7 @@ CustomersOrders=Commandes clients CustomersOrdersRunning=Commandes clients en cours CustomersOrdersAndOrdersLines=Commandes clients et lignes de commandes OrdersToValid=Commandes clients à valider -OrdersToBill=Commandes clients à facturer +OrdersToBill=Commandes clients délivrées OrdersInProcess=Commandes clients en traitement OrdersToProcess=Commandes clients à traiter SuppliersOrdersToProcess=Commandes fournisseurs à traiter @@ -32,7 +32,7 @@ StatusOrderOnProcessShort=Traitement en cours StatusOrderSentShort=Envoi en cours StatusOrderSent=Envoi en cours StatusOrderProcessedShort=Traitée -StatusOrderToBillShort=À facturer +StatusOrderToBillShort=Délivrée StatusOrderApprovedShort=Approuvée StatusOrderRefusedShort=Refusée StatusOrderToProcessShort=A traiter @@ -43,7 +43,7 @@ StatusOrderDraft=Brouillon (à valider) StatusOrderValidated=Validée StatusOrderOnProcess=Attente réception StatusOrderProcessed=Traitée -StatusOrderToBill=À facturer +StatusOrderToBill=Délivrée StatusOrderApproved=Approuvée StatusOrderRefused=Refusée StatusOrderReceivedPartially=Reçu partiellement @@ -52,7 +52,7 @@ ShippingExist=Une expédition existe DraftOrWaitingApproved=Brouillon ou approuvée pas encore commandée DraftOrWaitingShipped=Brouillon ou validée pas encore expédiée SearchOrder=Rechercher une commande -MenuOrdersToBill=Commandes à facturer +MenuOrdersToBill=Commandes délivrées Sending=Expédition Sendings=Expéditions ShipProduct=Expédier produit From e47accd87bc62cbae81b01e0b7b855006f31c511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Aug 2012 14:13:59 +0200 Subject: [PATCH 02/18] Qual: Removed deprecated code --- htdocs/core/menus/standard/eldy.lib.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e24124c3239..3aae851a2d6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -744,12 +744,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after) $newmenu->add("/societe/soc.php?action=create", $langs->trans("MenuNewThirdParty"),1); if (! $conf->use_javascript_ajax) $newmenu->add("/societe/soc.php?action=create&private=1",$langs->trans("MenuNewPrivateIndividual"),1); } - - // TODO Avoid doing dir scan - if(is_dir("societe/groupe")) - { - $newmenu->add("/societe/groupe/index.php", $langs->trans("MenuSocGroup"),1); - } } // Prospects From 068c53674169627103c4e1dafbb348c637e8f000 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Aug 2012 14:24:54 +0200 Subject: [PATCH 03/18] Fix: Delete all files (PROV* when validating. --- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/livraison/class/livraison.class.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 76cdd822ce5..11ce0f53b4b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -280,7 +280,7 @@ class Commande extends CommonOrder dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*'); + dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'*.*'); } } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a8e10747977..87405b5e0be 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1724,7 +1724,7 @@ class Facture extends CommonInvoice dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*'); + dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'*.*'); } } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 46f469a2d42..a69c7a04873 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -560,7 +560,7 @@ class Expedition extends CommonObject dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($dirdest.'/'.$oldref.'.*'); + dol_delete_file($dirdest.'/'.$oldref.'*.*'); } } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 612bfb01ee0..af36be18a44 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -367,7 +367,7 @@ class CommandeFournisseur extends CommonOrder dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($dirdest.'/'.$oldref.'.*'); + dol_delete_file($dirdest.'/'.$oldref.'*.*'); } } } diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 0e219d07690..9d56de64299 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -408,7 +408,7 @@ class Livraison extends CommonObject dol_syslog("Rename ok"); // Suppression ancien fichier PDF dans nouveau rep - dol_delete_file($dirdest.'/'.$oldref.'.*'); + dol_delete_file($dirdest.'/'.$oldref.'*.*'); } } } From 1df12a701d8e9d6dffc692c12c5036969a9d2d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Tue, 7 Aug 2012 14:10:16 +0200 Subject: [PATCH 04/18] Fix: Display correct user in project tasks' time spent list Use a local object rather than modifying the global $user object (sic!) --- htdocs/projet/tasks/time.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2e0d8b66984..b3738abc8d0 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -403,17 +403,17 @@ if ($id > 0 || ! empty($ref)) print ''; // User - $user->id = $task_time->fk_user; + $userstatic = new User($task_time->fk_user); print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { - print $form->select_users($user->id,'userid_line'); + print $form->select_users($userstatic->id,'userid_line'); } else { - $user->nom = $task_time->name; - $user->prenom = $task_time->firstname; - print $user->getNomUrl(1); + $userstatic->nom = $task_time->name; + $userstatic->prenom = $task_time->firstname; + print $userstatic->getNomUrl(1); } print ''; From 040c675de64a813a54bd45d2587bc8c6919d03ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Aug 2012 14:54:56 +0200 Subject: [PATCH 05/18] Fix: Do not overwrite global $user information --- htdocs/projet/tasks/time.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2e0d8b66984..68d2ced3d7e 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -170,6 +170,7 @@ if (! empty($project_ref) && ! empty($withproject)) llxHeader("",$langs->trans("Task")); $form = new Form($db); +$userstatic = new User($db); if ($id > 0 || ! empty($ref)) { @@ -403,17 +404,17 @@ if ($id > 0 || ! empty($ref)) print ''; // User - $user->id = $task_time->fk_user; print ''; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { - print $form->select_users($user->id,'userid_line'); + print $form->select_users($task_time->fk_user,'userid_line'); } else { - $user->nom = $task_time->name; - $user->prenom = $task_time->firstname; - print $user->getNomUrl(1); + $userstatic->id = $task_time->fk_user; + $userstatic->nom = $task_time->name; + $userstatic->prenom = $task_time->firstname; + print $userstatic->getNomUrl(1); } print ''; From 5ddd982f6e06dc1109f5eadf8992d8af9e3250db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Aug 2012 16:55:14 +0200 Subject: [PATCH 06/18] New: If field "signature" is filled into user table, text is added at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this feautre is disabled. --- ChangeLog | 3 +++ htdocs/core/class/html.formmail.class.php | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63952957652..57263615ebb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.3 compared to 3.2 ***** For users: +- New: If field "signature" is filled into user table, text is added + at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this + feautre is disabled. - New: Add link "Back to list" on all cards. - New: After first install, warning are visible onto mandatory setup not configured. Show also total number of activated modules. diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 8347725fd32..597d143f6ea 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -601,12 +601,13 @@ class FormMail { if (! isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes'; - if(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0) + if (empty($conf->global->MAIL_DO_NOT_USE_SIGN) && $this->fromid > 0) { $fuser=new User($this->db); $fuser->fetch($this->fromid); - if(!empty($fuser->signature)) { + if(! empty($fuser->signature)) + { $defaultmessage.=dol_htmlentitiesbr_decode($fuser->signature); } } From 30444da6b92f7d313a30806f75bf3d678d2b5b65 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 7 Aug 2012 18:55:55 +0200 Subject: [PATCH 07/18] Fix: autoselect when it should not --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 29433cfb63b..d990ce99586 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1424,7 +1424,7 @@ class Form $outval=''; $opt = '
');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});} -function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();} -var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}} -$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();} -if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}} -function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}} -if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}} -_enable_keyboard_navigation();} -function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});} -function _disable_keyboard_navigation(){$(document).unbind();} -function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;} -key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();} -if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}} -if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}} -function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];} -if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}} -function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});} -function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;} -var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;} -windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;} -if(yScroll35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<1w g="5-b"><1w W="\'+4.1M+\'"><1i g="5-b-A-1t"><1i g="5-b-A-1g"><1w W="\'+4.1W+\'">\');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r'."\n"; // JQuery print ''."\n"; // Tooltip print ''."\n"; // JNotify - //print ''."\n"; // Lightbox if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)) // jQuery fileupload { print ''."\n"; @@ -903,17 +902,22 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; print ''."\n"; + // CSS forced by modules (relative url starting with /) if (isset($conf->modules_parts['css'])) { - $dircss=(array) $conf->modules_parts['css']; - foreach($dircss as $key => $cssfile) + $arraycss=(array) $conf->modules_parts['css']; + foreach($arraycss as $modcss => $filescss) { - // cssfile is a relative path - print ''."\n"; + $filescss=(array) $filescss; // To be sure filecss is an array + foreach($filescss as $cssfile) + { + // cssfile is a relative path + print ''."\n"; + } } } // CSS forced by page in top_htmlhead call (relative url starting with /) @@ -948,7 +952,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs else print ''."\n"; print ''."\n"; print ''."\n"; - //print ''."\n"; // jQuery Layout if (! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT) || defined('REQUIRE_JQUERY_LAYOUT')) { @@ -1044,12 +1047,19 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print ''."\n"; // JS forced by modules (relative url starting with /) - $dirjs=(array) $conf->modules_parts['js']; - foreach($dirjs as $key => $jsfile) - { - // jsfile is a relative path - print ''."\n"; - } + if (isset($conf->modules_parts['js'])) // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) + { + $arrayjs=(array) $conf->modules_parts['js']; + foreach($arrayjs as $modjs => $filesjs) + { + $filesjs=(array) $filesjs; // To be sure filejs is an array + foreach($filesjs as $jsfile) + { + // jsfile is a relative path + print ''."\n"; + } + } + } // JS forced by page in top_htmlhead (relative url starting with /) if (is_array($arrayofjs)) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index aff8a64e7fc..69667f086a8 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2593,23 +2593,6 @@ class Product extends CommonObject $pdirthumb = $pdir.'thumbs/'; $return =''."\n"; - /*$return.="\n"; - */ $nbphoto=0; $dir_osencoded=dol_osencode($dir); @@ -2647,7 +2630,7 @@ class Product extends CommonObject if ($nbbyrow) $return.= ''; $return.= "\n"; - $return.= ''; + $return.= ''; // Show image (width height=$maxHeight) // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine From 2620abc6a0eff98475bc50a8962d234af181a745 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Aug 2012 20:46:50 +0200 Subject: [PATCH 17/18] Use different class for a and img --- ChangeLog | 3 ++- htdocs/product/class/product.class.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 57263615ebb..bddd25d5dd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,7 +45,8 @@ For developers: - New: Can add a link on title field of added dictionnary. - New: Uniformize code. - New: Add option WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER and - WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER + WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER. +- New: A module can add several css and js. - New: removed deprecated methods ldap::connect, formadmin::select_lang, html::select_tva diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 69667f086a8..cc671d254d0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2630,7 +2630,7 @@ class Product extends CommonObject if ($nbbyrow) $return.= ''; $return.= "\n"; - $return.= ''; + $return.= ''; // Show image (width height=$maxHeight) // Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine From 32a1301a9257d6f48d6f1be4dac4f3b4ef2f6234 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Aug 2012 22:11:08 +0200 Subject: [PATCH 18/18] Fix: Use correct object --- htdocs/product/canvas/product/actions_card_product.class.php | 2 +- htdocs/product/canvas/service/actions_card_service.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 617e477c0fd..37b48c7be00 100755 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -106,7 +106,7 @@ class ActionsCardProduct $this->tpl['description'] = nl2br($this->description); // Statut - $this->tpl['status'] = $this->getLibStatut(2); + $this->tpl['status'] = $this->object->getLibStatut(2); // Note $this->tpl['note'] = nl2br($this->note); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index d665e175c27..3e27cd968dc 100755 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -105,7 +105,7 @@ class ActionsCardService $this->tpl['description'] = nl2br($this->description); // Statut - $this->tpl['status'] = $this->getLibStatut(2); + $this->tpl['status'] = $this->object->getLibStatut(2); // Note $this->tpl['note'] = nl2br($this->note);