diff --git a/ChangeLog b/ChangeLog index 40e427bae1b..1bb297bae79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -121,6 +121,7 @@ NEW: When emailing is not sent completely, show progression. For developers: +NEW: Add a css class style called 'reposition', so when clicking on a link with this class will move scrollbarr to be placed at same page location. NEW: TimeZone can be supplied to mktime NEW: hook in shipment card NEW: Deprecated Societe::set_prospect_level, Societe::set_commnucation_level, Societe::set_OutstandingBill functions diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index f0013632b53..b1836836e84 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -138,7 +138,7 @@ if ($action == 'display' || $action == 'delete') { if(!empty($obj)){ foreach ( $obj as $cpt ) { $var = ! $var; - print ""; + print ''; print '' . length_accountg($cpt->account_number) . ''; print '' . $cpt->label . ''; print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j); diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 0dc560aa62e..720f3a4f012 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -138,7 +138,7 @@ if ($result) { while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; - print ""; + print ''; print ''; print $objp->accounting; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 80ed3f6fb47..63060e1ed60 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -328,10 +328,10 @@ if ($result) { $product_static = new Product($db); - print ""; + print ''; print ""; - print ""; + print ''; // Ref produit as link $product_static->ref = $obj->ref; $product_static->id = $obj->rowid; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e89799d765e..736aec48644 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -223,7 +223,7 @@ else { if(empty($description)){ $link = '' . img_edit_add() .''; } - print ""; + print ''; print '' . length_accountg($line->numero_compte) . ''; print '' . $description . ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 5421a4a350d..7293797ecc6 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -346,7 +346,7 @@ if ($action == 'create') { foreach ( $book->linesmvt as $line ) { $var = ! $var; - print ""; + print ''; $total_debit += $line->debit; $total_credit += $line->credit; @@ -400,7 +400,7 @@ if ($action == 'create') { if ($action == "" || $action == 'add') { $var = ! $var; - print ""; + print ''; print ''; print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 557143164a9..cb5d7caf006 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -368,7 +368,7 @@ foreach ( $object->lines as $line ) { $total_debit += $line->debit; $total_credit += $line->credit; - print ""; + print ''; print '' . $line->piece_num . ''; print '' . dol_print_date($line->doc_date, 'day') . ''; diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index 10640c1887a..23eeb79621a 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -269,7 +269,7 @@ $var = True; foreach ( $object->lines as $line ) { $var = ! $var; - print ""; + print ''; print '' . $line->piece_num . '' . "\n"; print '' . $line->doc_type . '' . "\n"; print '' . dol_print_date($line->doc_date) . ''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 292b52b5863..3549651cbd6 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -288,7 +288,7 @@ if ($result) { $var = ! $var; $codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte; - print ""; + print ''; // Ref Invoice $facture_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 438eb30c621..167f558d830 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -302,7 +302,7 @@ if ($result) { if ($objp->code_sell_l != $objp->code_sell_p) $code_sell_p_l_differ = 'color:red'; - print ""; + print ''; // Ref Invoice $facture_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index 48d587b575b..72a4d6e96b2 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -127,7 +127,7 @@ if(!empty($cats)) $resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); $sommes[$code]['NP'] += $resultNP; $sommes[$code]['N'] += $resultN; - print ""; + print ''; print '' . $cpt['account_number'] . ''; print '' . $cpt['name_cpt'] . ''; print '' . price($resultNP) . ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 6ab2cf589a6..a0b2365350f 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -236,7 +236,7 @@ if ($result) { $var = ! $var; $codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label; - print ""; + print ''; // Ref Invoice $facturefournisseur_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 8685cb7d5d4..c98ba050222 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -314,7 +314,7 @@ if ($result) { if ($objp->code_buy_l != $objp->code_buy_p) $code_buy_p_l_differ = 'color:red'; - print ""; + print ''; // Ref Invoice $facturefourn_static->ref = $objp->ref; diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 6f5d1de5c87..a23c1f40def 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -200,7 +200,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) print ''; print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL"); print ''; - print ''; + print ''; print "\n"; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 66de3be2cc5..bec4156dbe0 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -253,7 +253,8 @@ if (empty($reshook)) } $lastname=$_POST["lastname"]; $firstname=$_POST["firstname"]; - $morphy=$morphy=$_POST["morphy"]; + $morphy=$_POST["morphy"]; + $login=$_POST["login"]; if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); @@ -264,7 +265,19 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); } - + if ($morphy == 'mor' && empty($societe)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); + } + // Test si le login existe deja + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + if (empty($login)) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + } + } // Create new object if ($result > 0 && ! $error) { @@ -506,6 +519,11 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors'); } } + if ($morphy == 'mor' && empty($societe)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); + } if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 5fc39432c8e..9209542a9c0 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -272,7 +272,7 @@ if ($action == 'create') '; print load_fiche_titre($langs->trans("NewMenu"),'','title_setup'); - + print '
'; print ''; @@ -284,7 +284,7 @@ if ($action == 'create') $parent_rowid = $_GET['menuId']; if ($_GET['menuId']) { - $sql = "SELECT m.rowid, m.mainmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId']; + $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId']; $res = $db->query($sql); if ($res) { @@ -293,6 +293,7 @@ if ($action == 'create') { $parent_rowid = $menu['rowid']; $parent_mainmenu = $menu['mainmenu']; + $parent_leftmenu = $menu['leftmenu']; $parent_langs = $menu['langs']; $parent_level = $menu['level']; } @@ -343,7 +344,9 @@ if ($action == 'create') { print ''; } - print ''.$langs->trans('DetailMenuIdParent').''; + print ''.$langs->trans('DetailMenuIdParent'); + print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; + print ''; // Title print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; @@ -423,9 +426,10 @@ elseif ($action == 'edit') // MenuId Parent print ''.$langs->trans('MenuIdParent').''; - print ''; - //$menu_handler - //print ''; + $valtouse=$menu->fk_menu; + if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; + if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; + print ''; print ''.$langs->trans('DetailMenuIdParent').''; // Niveau diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 28d8d353905..cba8d45c8f3 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -289,17 +289,18 @@ if ($conf->use_javascript_ajax) - la chaine a afficher ie: data[]= array (index, index parent, chaine ) */ + //il faut d'abord declarer un element racine de l'arbre - $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); - + $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); + //puis tous les elements enfants - $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu"; + $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; $sql.= " WHERE menu_handler = '".$menu_handler_to_search."'"; $sql.= " AND entity = ".$conf->entity; - $sql.= " AND fk_menu >= 0"; + //$sql.= " AND fk_menu >= 0"; $sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same) $res = $db->query($sql); @@ -314,9 +315,10 @@ if ($conf->use_javascript_ajax) $titre = $langs->trans($menu['titre']); $data[] = array( 'rowid'=>$menu['rowid'], + 'module'=>$menu['module'], 'fk_menu'=>$menu['fk_menu'], 'title'=>$titre, - 'mainmenu'=>$menu['mainmenu'], + 'mainmenu'=>$menu['mainmenu'], 'leftmenu'=>$menu['leftmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'], @@ -334,17 +336,54 @@ if ($conf->use_javascript_ajax) } } + global $tree_recur_alreadyadded; // This var was def into tree_recur + // Appelle de la fonction recursive (ammorce) // avec recherche depuis la racine. //var_dump($data); - tree_recur($data,$data[0],0); + tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine' + print ''; - + print ''; - + print ''; - + + + // Process remaining records (records that are not linked to root by any path) + $remainingdata = array(); + foreach($data as $datar) + { + if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; + $remainingdata[] = $datar; + } + + if (count($remainingdata)) + { + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + + print ''; + + print '
'.$langs->trans("NotTopTreeMenuPersonalized").'
'; + + foreach($remainingdata as $datar) + { + $father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>''); + //print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'
'."\n"; + tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1); + } + + print '
'; + } print ''; diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index bd49265436d..530f3bff5b7 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -77,20 +77,20 @@ if (preg_match('/del_(.*)/',$action,$reg)) if ($action == 'add_currency') { - $code = GETPOST('code', 'alpha'); - $name = GETPOST('name', 'alpha'); - $rate = GETPOST('rate', 'alpha'); + $langs->loadCacheCurrencies(''); + $code = GETPOST('code', 'alpha'); + $rate = GETPOST('rate', 'alpha'); $currency = new MultiCurrency($db); $currency->code = $code; - $currency->name = $name; + $currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code; if ($currency->create($user) > 0) { if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array()); else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors'); } - else setEventMessages($langs->trans('ErrorAddCurrencyFail'), array()); + else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors'); } elseif ($action == 'update_currency') { @@ -182,6 +182,7 @@ print ''.$langs->trans("Parameters").''."\n"; print ' '; print ''.$langs->trans("Value").''."\n"; +/* TODO uncomment when the functionality will integrated $var=!$var; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_useRateOnInvoiceDate").''; @@ -194,6 +195,7 @@ print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_INVOICE_DATE",$conf->global- print ''; print '
'; print ''; +*/ $var=!$var; print ''; @@ -208,6 +210,7 @@ print '' print ''; print ''; +/* TODO uncomment when the functionality will integrated $var=!$var; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").''; @@ -220,7 +223,9 @@ print $form->selectyesno("MULTICURRENCY_BUY_PRICE_IN_CURRENCY",$conf->global->MU print ''; print ''; print ''; +*/ +/* TODO uncomment when the functionality will integrated $var=!$var; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").''; @@ -234,71 +239,75 @@ print '' print ''; print ''; -print ''; -print '
'; - -$var=false; -print ''; -print ''; -print ''."\n"; -print ''; -print ''; - - -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -/* This property seems not used in code, so i comment it -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -$var=!$var; -print ''; -print ''; -print ''; -print ''; */ print '
'.$langs->trans("CurrencyLayerAccount").' '; -print '
'; -print ''; -print ''; -print $langs->trans("Value").' '; -print '
'; -print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").' '; -print '
'; -print ''; -print ''; -print ' '; -print ''; -print '
'; -print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").' '; -print '
'; -print ''; -print ''; -print ' '; // Default: USD -print ''; -print '
'; -print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").' '; -print '
'; -print ''; -print ''; -print ' '; // Example: EUR -print ''; -print '
'; -print '
'; print '
'; +if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) +{ + $var=false; + print ''; + print ''; + print ''."\n"; + print ''; + print ''; + + + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + print '
'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).' '; + print '
'; + print ''; + print ''; + print $langs->trans("Value").' '; + print '
'; + print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").' '; + print '
'; + print ''; + print ''; + print ' '; + print ''; + print '
'; + print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").' '; + print '
'; + print ''; + print ''; + print ' '; // Default: USD + print ''; + print '
'; + print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").' '; + print '
'; + print ''; + print ''; + print ' '; // Example: EUR + print ''; + print '
'; + print '
'; + print '
'; +} + + print ''; print ''; -print ''."\n"; +print ''."\n"; print ''; print ''."\n"; @@ -307,7 +316,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) { @@ -422,7 +424,8 @@ if ($mode == 'template' && $user->admin) print ''; print ''; print "\n"; - for ($tag=0; $tag < count($printer->tags); $tag++) { + $max = count($printer->tags); + for ($tag=0; $tag < $max; $tag++) { $var = !$var; print ''; print ''; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 1f597ffeddc..4cae6d5c4d0 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -199,7 +199,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR ( if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")"; + if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } @@ -368,7 +368,7 @@ if ($resql) $actionstatic->type_code=$obj->type_code; $actionstatic->type_label=$obj->type_label; $actionstatic->label=$obj->label; - print $actionstatic->getNomUrl(1,28); + print $actionstatic->getNomUrl(1,36); print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 82988dfcb0d..f3ebd32fe95 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1433,7 +1433,7 @@ if ($action == 'create') print ''; print ''; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 56c3839dcb6..1ff75f2b661 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2570,7 +2570,7 @@ class Propal extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; $response->img = img_object($langs->trans("Propals"),"propal"); // This assignment in condition is not a bug. It allows walking the results. @@ -2674,9 +2674,12 @@ class Propal extends CommonObject $line->remise_percent=00; } - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; - + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 40d71775a08..e0c3c00adad 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2974,7 +2974,7 @@ class Commande extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); - $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; + $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; $response->img=img_object($langs->trans("Orders"),"order"); $generic_commande = new Commande($this->db); @@ -3278,9 +3278,12 @@ class Commande extends CommonOrder $line->total_tva=19.6; $line->remise_percent=0; } - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; - + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 1ab418a9daa..e38097e4e3a 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -206,7 +206,7 @@ class CommandeStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid"; $sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'"; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 1968caf2544..98e931db9f8 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -46,7 +46,16 @@ foreach($linkedObjectBlock as $key => $objectlink) echo price($objectlink->total_ht); } ?> - + 0) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -2036,7 +2036,7 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - $absolute_discount = $soc->getAvailableDiscounts(); + if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); if (! empty($conf->use_javascript_ajax)) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a19605ee5b..f1cae70fec5 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -666,7 +666,7 @@ class FactureRec extends CommonInvoice $facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice $facture->type = self::TYPE_STANDARD; $facture->brouillon = 1; - $facture->date = $now; + $facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->socid = $facturerec->socid; $invoiceidgenerated = $facture->create($user); // This will also update fields of recurring invoice @@ -962,6 +962,7 @@ class FactureRec extends CommonInvoice if ($this->db->query($sql)) { $this->date_when = $date; + if ($increment_nb_gen_done>0) $_facrec->nb_gen_done++; return 1; } else diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6e46ead1da5..d4c616d09ac 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -309,13 +309,12 @@ class Facture extends CommonInvoice $forceduedate = $this->calculate_date_lim_reglement(); - // Update date and number of last generation of recurring template invoice, before inserting new invoice + // For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { - $_facrec->nb_gen_done++; $next_date = $_facrec->getNextDate(); // Calculate next date $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date'); - $_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); + //$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1. $_facrec->setNextDate($next_date,1); } } @@ -3465,7 +3464,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); - $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1'; + $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills'; $response->img=img_object($langs->trans("Bills"),"bill"); $generic_facture = new Facture($this->db); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index b826e4f266d..8118cbea1ac 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1256,8 +1256,13 @@ else print '
'; + // Frequencry/Recurring section if ($object->frequency > 0) { + if (empty($conf->cron->enabled)) + { + print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); + } print '
'.$langs->trans("Currencies").''.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).' '.$langs->trans("Rate").'
- '.$form->selectCurrency('', 'code').' '; print ' '; diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 87fce1f6087..b86023aa49a 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -377,7 +378,8 @@ if ($mode == 'template' && $user->admin) if ($ret > 0) { setEventMessages($printer->error, $printer->errors, 'errors'); } else { - for ($line=0; $line < count($printer->listprinterstemplates); $line++) { + $max = count($printer->listprinterstemplates); + for ($line=0; $line < $max; $line++) { $var = !$var; print '
'.$langs->trans("Tag").''.$langs->trans("Description").'
<'.$printer->tags[$tag].'>'.$langs->trans(strtoupper($printer->tags[$tag])).''.fieldLabel('Currency','multicurrency_code').''; $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); - print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 1); + print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print '
getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink")); ?> + element != 'shipping') { + ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + +
'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 68eb4240226..c6651b4810d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -182,7 +182,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // Both test are required to be compatible with all browsers { $search_user=''; $search_sale=''; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index f0a8c82df1b..719953204f9 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2015-2016 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Marcos García @@ -877,7 +877,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,"; - $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur"; + $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement"; $sql.= " ORDER BY ff.date_lim_reglement ASC"; $resql=$db->query($sql); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8f3c87725fa..d2c094fb025 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2147,8 +2147,11 @@ class Contrat extends CommonObject $line->total_ht=90; $line->total_ttc=107.64; // 90 * 1.196 $line->total_tva=17.64; - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } $this->lines[$xnbp]=$line; $xnbp++; } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 11d05c60a49..4c181d5c147 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -256,7 +256,7 @@ if ($resql) print ''; print ''; print ''; print '
'; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 997e27adb20..f1352f8e933 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -240,7 +240,10 @@ if ($section) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $useglobalvars=1; $form = new Form($db); - $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile')); + $formquestion=array( + 'urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'), + 'section'=>array('type'=>'hidden','value'=>$section,'name'=>'section') + ); print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0)); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3287ac5d4b7..c26251f2312 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -744,7 +744,8 @@ abstract class CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql.= " WHERE element_id = ".$this->id; - $sql.= " AND fk_c_type_contact IN (".$listId.")"; + if ($listId) + $sql.= " AND fk_c_type_contact IN (".$listId.")"; dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8d61733e138..283d189377c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1133,7 +1133,7 @@ class ExtraFields if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) { $object = new $InfoFieldList[0]($this->db); - $object->fetch($value); + if (!empty($value)) $object->fetch($value); $valuetoshow=$object->ref; if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique $out.=''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 64d1538578b..175bc8873e1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2329,7 +2329,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; - $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; + $sql.= " WHERE p.entity IN (".getEntity('productprice', 1).")"; $sql.= " AND p.tobuy = 1"; $sql.= " AND s.fournisseur = 1"; $sql.= " AND p.rowid = ".$productid; @@ -3812,7 +3812,7 @@ class Form print ''; print ''; print ''; print ''; print '
'; - print $this->selectMultiCurrency($selected, $htmlname, 1); + print $this->selectMultiCurrency($selected, $htmlname, 0); print '
'; @@ -4091,7 +4091,7 @@ class Form $out=''; $out.= '