diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index efe0ffc92464b..f6efe232c86b2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1881,6 +1881,7 @@ CashDeskYouDidNotDisableStockDecease=You did not disable stock decrease when mak CashDeskForceDecreaseStockLabel=Stock decrease for batch products was forced. CashDeskForceDecreaseStockDesc=Decrease first by the oldest eatby and sellby dates. CashDeskReaderKeyCodeForEnter=Key ASCII code for "Enter" defined in barcode reader (Example: 13) +CashDeskDefaultProject=Assign all future sales to this project ##### Bookmark ##### BookmarkSetup=Bookmark module setup BookmarkDesc=This module allows you to manage bookmarks. You can also add shortcuts to any Dolibarr pages or external web sites on your left menu. diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index b8ef980318770..01a496bdbf9a2 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -75,7 +75,7 @@ $res = dolibarr_set_const($db, "TAKEPOS_TERMINAL_NAME_".$terminaltouse, (!empty(GETPOST('terminalname'.$terminaltouse, 'restricthtml')) ? GETPOST('terminalname'.$terminaltouse, 'restricthtml') : $langs->trans("TerminalName", $terminaltouse)), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY".$terminaltouse, (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity); - + $res = dolibarr_set_const($db, "CASHDESK_ID_PROJECT".$terminaltouse, (GETPOST('projectid', 'int') > 0 ? GETPOST('projectid', 'int') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); @@ -157,6 +157,17 @@ print 'trans("TerminalName", $terminal)).'" >'; print ''; +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + $formproject = new FormProjets($db); + print ''.$langs->trans("CashDeskDefaultProject").''; + print img_picto('', 'project', 'class="pictofixedwidth"'); + // select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '', $morefilter = '') + $projectid = getDolGlobalInt('CASHDESK_ID_PROJECT'.$terminaltouse); + print $formproject->select_projects(-1, $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 1, 'maxwidth500 widthcentpercentminusxx'); + print ''; +} + print ''.$langs->trans("CashDeskThirdPartyForSell").''; print ''; print img_picto('', 'company', 'class="pictofixedwidth"'); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 7d00ff1207645..cab39a1517762 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -81,6 +81,7 @@ } } +$takeposterminal = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''; /** * Abort invoice creation with a given error message @@ -135,13 +136,13 @@ function fail($message) if ($invoiceid > 0) { $ret = $invoice->fetch($invoiceid); } else { - $ret = $invoice->fetch('', '(PROV-POS'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '') .'-'.$place.')'); + $ret = $invoice->fetch('', '(PROV-POS'.$takeposterminal.'-'.$place.')'); } if ($ret > 0) { $placeid = $invoice->id; } -$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'. (isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); +$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$takeposterminal; $soc = new Societe($db); if ($invoice->socid > 0) { @@ -150,6 +151,11 @@ function fail($message) $soc->fetch(getDolGlobalString($constforcompanyid)); } +// Assign a default project, if relevant +if (isModEnabled('project') && getDolGlobalInt("CASHDESK_ID_PROJECT".$takeposterminal)) { + $invoice->fk_project = getDolGlobalInt("CASHDESK_ID_PROJECT".$takeposterminal); +} + // Change the currency of invoice if it was modified if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"])) { if ($invoice->multicurrency_code != $_SESSION["takeposcustomercurrency"]) {