diff --git a/ChangeLog b/ChangeLog index bad1a44529da242c69c906a1b49f31ae55129111..1aab93c272641abd9388ecc59edbdf6da9d2cf6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.0 compared to 2.9 ***** For users: +- New: Can choose third party to use in point of sale module during logon. - New: A lot of enhancements into ECM module: Directories can contains special characters, Speed enhancements, diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index 1da5730b0165499bb940acfac37bbe94d6bd89e1..6c3fc93ee61e201954f3b0a1eb332b28dd27ab91 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -40,7 +40,7 @@ if (!$user->admin) accessforbidden(); $langs->load("admin"); -$langs->load("@cashdesk"); +$langs->load("cashdesk"); /* @@ -91,7 +91,7 @@ print "</tr>\n"; $var=!$var; print '<tr '.$bc[$var].'><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>'; print '<td colspan="2">'; -print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','',1,1); +print $form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client=1',1,1); print '</td></tr>'; if ($conf->banque->enabled) { diff --git a/htdocs/cashdesk/affIndex.php b/htdocs/cashdesk/affIndex.php index 0d9190aa5b21e8886612fb0f01f80c56c99575b5..576e85e631a45fd2190edef95aa5edeb10e9ba3b 100644 --- a/htdocs/cashdesk/affIndex.php +++ b/htdocs/cashdesk/affIndex.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> - * Copyright (C) 2008 Laurent Destailleur <eldy@uers.sourceforge.net> + * Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr> * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php index 482299c4d934df8a98f495b13134b4a9a397df44..ac519330746fa41b4d09dc2f199b1fb8d34009b0 100644 --- a/htdocs/cashdesk/facturation_dhtml.php +++ b/htdocs/cashdesk/facturation_dhtml.php @@ -98,7 +98,7 @@ if ( dol_strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length a } else { - $langs->load("cashdesk@cashdesk"); + $langs->load("cashdesk"); print '<ul class="dhtml_bloc">'; print '<li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>'; diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index f898cd54acd4f8c1e8f29d868e4d7d4245f9a93e..b907e30eaba51ae15b26cf400dd0527188c71781 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -29,29 +29,19 @@ $conf_db_pass = $dolibarr_main_db_pass; $conf_db_base = $dolibarr_main_db_name; // Identifiant unique correspondant au tiers generique pour la vente -$conf_fksoc = $conf->global->CASHDESK_ID_THIRDPARTY; +$conf_fksoc = (! empty($_SESSION["CASHDESK_ID_THIRDPARTY"]))?$_SESSION["CASHDESK_ID_THIRDPARTY"]:($conf->global->CASHDESK_ID_THIRDPARTY>0?$conf->global->CASHDESK_ID_THIRDPARTY:0); +// Identifiant unique correspondant a l'entrepot a utiliser +$conf_fkentrepot = (! empty($_SESSION["CASHDESK_ID_WAREHOUSE"]))?$_SESSION["CASHDESK_ID_WAREHOUSE"]:($conf->global->CASHDESK_ID_WAREHOUSE>0?$conf->global->CASHDESK_ID_WAREHOUSE:0); + // Identifiant unique correspondant au compte caisse / liquide $conf_fkaccount_cash = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CASH>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CASH:0); // Identifiant unique correspondant au compte cheque $conf_fkaccount_cheque = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE:0); // Identifiant unique correspondant au compte cb $conf_fkaccount_cb = (! empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]))?$_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]:($conf->global->CASHDESK_ID_BANKACCOUNT_CB>0?$conf->global->CASHDESK_ID_BANKACCOUNT_CB:0); -// Identifiant unique correspondant a l'entrepot a utiliser -$conf_fkentrepot = (! empty($_SESSION["CASHDESK_ID_WAREHOUSE"]))?$_SESSION["CASHDESK_ID_WAREHOUSE"]:($conf->global->CASHDESK_ID_WAREHOUSE>0?$conf->global->CASHDESK_ID_WAREHOUSE:0); //var_dump($_SESSION); -// Check if setup ok -$error = ''; -if (empty($conf_fksoc)) -{ - $error.= '<div class="error">Setup of CashDesk module not complete. Third party not defined</div>'; -} -if ($conf->banque->enabled && (empty($conf_fkaccount_cash) || empty($conf_fkaccount_cheque) || empty($conf_fkaccount_cb))) -{ - $error.= '<div class="error">Setup of CashDesk module not complete. Bank account not defined</div>'; -} - // Parametres d'affichage $conf_taille_listes = 200; // Nombre max de lignes a afficher dans les listes $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index f191ba0ce9814e8ee2cd3353a3d4076616bed107..059d7b74191d74e6eeffda950cb66c2e8305209a 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -26,6 +26,10 @@ // Set and init common variables // This include will set: config file variable $dolibarr_xxx, $conf, $langs and $mysoc objects require_once("../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); + +$langs->load("admin"); +$langs->load("cashdesk"); // Test if user logged if ( $_SESSION['uid'] > 0 ) @@ -35,24 +39,16 @@ if ( $_SESSION['uid'] > 0 ) } -require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); +/* + * View + */ +$form=new Form($db); $formproduct=new FormProduct($db); +$arrayofcss=array(DOL_URL_ROOT.'/cashdesk/css/style.css'); +top_htmlhead('','',0,0,'',$arrayofcss); ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html> -<head> -<title>Point of Sale login</title> -<meta name="robots" content="none" /> -<meta name="author" content="Jeremie Ollivier - jeremie.o@laposte.net" /> -<meta name="Generator" content="Kwrite, Gimp, Inkscape" /> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<meta http-equiv="Content-Style-Type" content="text/css" /> -<link href="<?php echo DOL_URL_ROOT.'/cashdesk/css/style.css'; ?>" rel="stylesheet" type="text/css" media="screen" /> -</head> <body> <div class="conteneur"> @@ -68,7 +64,7 @@ $formproduct=new FormProduct($db); <div class="principal_login"> <?php if (! empty($_GET["err"])) print $_GET["err"]."<br><br>\n"; ?> <fieldset class="cadre_facturation"><legend class="titre1">Identification</legend> -<form class="formulaire_login" id="frmLogin" method="post" action="index_verif.php"> +<form id="frmLogin" method="post" action="index_verif.php"> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <table> @@ -82,6 +78,16 @@ $formproduct=new FormProduct($db); <td><input name="pwdPassword" class="texte_login" type="password" value="" /></td> </tr> <?php +print "<tr>"; +print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>'; +print '<td>'; +$disabled=0; +if (! empty($conf->global->CASHDESK_ID_THIRDPARTY)) $disabled=1; // If a particular third party is defined, we disable choice +$form->select_societes($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client=1',!$disabled,$disabled,1); +//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />'; +print '</td>'; +print "</tr>\n"; + if ($conf->stock->enabled) { $langs->load("stocks"); @@ -93,12 +99,12 @@ if ($conf->stock->enabled) $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled); //print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />'; print '</td>'; - print "</tr>"; + print "</tr>\n"; } ?> </table> -<span class="bouton_login"><input name="sbmtConnexion" type="submit" value="Connexion" /></span> +<center><span class="bouton_login"><input name="sbmtConnexion" type="submit" value="Connexion" /></span></center> </form> </fieldset> diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 3beefafa6ecef879cc4ebc750cc4d07396a432cb..72f7612cd68e6c9ca1114d2ddfb7ce621d4fda9a 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -25,11 +25,15 @@ require_once(DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'); require_once(DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php'); $langs->load("main"); +$langs->load("admin"); +$langs->load("cashdesk"); $username = $_POST['txtUsername']; $password = $_POST['pwdPassword']; -$warehouseid = isset($_POST['warehouseid'])?$_POST['warehouseid']:0; +$thirdpartyid = isset($_POST['socid'])?$_POST['socid']:$conf->global->CASHDESK_ID_THIRDPARTY; +$warehouseid = isset($_POST['warehouseid'])?$_POST['warehouseid']:$conf->global->CASHDESK_ID_WAREHOUSE; +$error = ''; // Check username if (empty($username)) @@ -38,6 +42,13 @@ if (empty($username)) header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username); exit; } +// Check third party id +if (! ($thirdpartyid > 0)) +{ + $retour=$langs->trans("ErrorFieldRequired",$langs->transnoentities("CashDeskThirdPartyForSell")); + header ('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username); + exit; +} // If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished. if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($warehouseid > 0)) @@ -47,6 +58,14 @@ if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_BILL && ! ($wareh exit; } +if (! empty($_POST['txtUsername']) && $conf->banque->enabled && (empty($conf_fkaccount_cash) || empty($conf_fkaccount_cheque) || empty($conf_fkaccount_cb))) +{ +// $error.= '<div class="error"></div>'; + header("Location: index.php?err=".urlencode('Setup of Point of Sale module not complete. Bank account not defined').'&user='.$username); + exit; +} + + // Check password $auth = new Auth($db); @@ -75,8 +94,9 @@ if ( $retour >= 0 ) $_SESSION['uname'] = $username; $_SESSION['nom'] = $tab['name']; $_SESSION['prenom'] = $tab['firstname']; - $_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid; - //var_dump($_SESSION); + $_SESSION['CASHDESK_ID_THIRDPARTY'] = $thirdpartyid; + $_SESSION['CASHDESK_ID_WAREHOUSE'] = $warehouseid; + //var_dump($_SESSION);exit; header ('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menu=facturation&id=NOUV'); exit; diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 0ac3189a50c1ef888e6c6df6e65cbc9732a218f2..265c23ace6068c2822eee49ae95385ce1fde9464 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -1,7 +1,7 @@ <?php $langs->load("main"); $langs->load("bills"); -$langs->load("@cashdesk"); +$langs->load("cashdesk"); ?> <!-- Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> diff --git a/htdocs/cashdesk/tpl/liste_articles.tpl.php b/htdocs/cashdesk/tpl/liste_articles.tpl.php index 38324955f0fe121267d68d3ceac64f7d0e05f969..962d9deb3dce0ef03b9b441a819d726785dc32b7 100644 --- a/htdocs/cashdesk/tpl/liste_articles.tpl.php +++ b/htdocs/cashdesk/tpl/liste_articles.tpl.php @@ -1,7 +1,7 @@ <?php $langs->load("main"); $langs->load("bills"); -$langs->load("@cashdesk"); +$langs->load("cashdesk"); ?> <!--Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net> diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 54a0a9ed238f7b5ecd82739f85a5efaa7f26434b..7d13d066c6bcb24fd9503ae259ee4ff20a271f6c 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -22,10 +22,10 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'); include_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'); include_once(DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'); -if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) +if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) { $company=new Societe($db); - $company->fetch($conf->global->CASHDESK_ID_THIRDPARTY); + $company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); $companyLink = $company->getNomUrl(1); } if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH)) @@ -55,7 +55,7 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && $conf->stock->enabled) } -$langs->load("@cashdesk"); +$langs->load("cashdesk"); $langs->load("main"); $logout='<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png">'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 030d7612634bb7537f887aead194df2aafa7fc5d..0184642ae5233624e6ae68a81783406b83d6ad26 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -773,13 +773,13 @@ function top_httphead() /** - * \brief Show HTML header - * \param head Optionnal head lines - * \param title Web page title - * \param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) - * \param disablehead Do not output head section - * \param arrayofjs Array of js files to add in header - * \param arrayofcss Array of css files to add in header + * Show HTML header + * @param head Optionnal head lines + * @param title Web page title + * @param disablejs Do not output links to js (Ex: qd fonction utilisee par sous formulaire Ajax) + * @param disablehead Do not output head section + * @param arrayofjs Array of js files to add in header + * @param arrayofcss Array of css files to add in header */ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='') { @@ -960,7 +960,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $menutop = new MenuTop($db); $menutop->atarget=$target; $menutop->showmenu(); - + // Select entity if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { @@ -1030,7 +1030,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $logouttext.=' alt="'.dol_escape_htmltag($langs->trans("Logout")).'" title=""'; $logouttext.='>'; } - + print $html->textwithtooltip('',$loginhtmltext,2,1,$logintext); print $html->textwithtooltip('',$logouthtmltext,2,1,$logouttext); diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index ba01899019c59c821f7516ab87188020f49c9308..674f4d7f1f6d70040454afb0c1a52f272962e4e4 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -52,7 +52,7 @@ dol_syslog(join(',',$_GET)); // Generation liste des societes -if (! empty($_GET['newcompany']) || ! empty($_GET['socid']) || ! empty($_GET['id_fourn'])) +if (GETPOST('newcompany') || GETPOST('socid') || GETPOST('id_fourn')) { $return_arr = array(); @@ -103,10 +103,14 @@ if (! empty($_GET['newcompany']) || ! empty($_GET['socid']) || ! empty($_GET['id echo json_encode($return_arr); } + else + { + echo json_encode(array('nom'=>'Error','label'=>'Error','key'=>'Error','value'=>'Error')); + } } else { - + echo json_encode(array('nom'=>'ErrorBadParameter','label'=>'ErrorBadParameter','key'=>'ErrorBadParameter','value'=>'ErrorBadParameter')); } ?>