Merge branch 'develop' into PDF_Propal_frame_option

This commit is contained in:
Laurent Destailleur 2021-08-17 18:30:37 +02:00 committed by GitHub
commit e8646c7919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
150 changed files with 2063 additions and 5968 deletions

View File

@ -3,7 +3,7 @@
*Please:*
- *only keep the "Fix", "Close" or "New" section*
- *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)*
- *replace the bracket enclosed textswith meaningful informations*
- *replace the bracket enclosed texts with meaningful information*
# Fix #[*issue_number Short description*]

View File

@ -12,6 +12,9 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
***** ChangeLog for 14.0.0 compared to 13.0.0 *****

View File

@ -79,7 +79,7 @@ If you don't have time to install it yourself, you can try some commercial 'read
## UPGRADING
Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
- At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).

View File

@ -1307,7 +1307,9 @@ class AccountancyExport
/**
* Export format : LD Compta version 10 & higher
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
* Last review for this format : 08-15-2021 Alexandre Spangaro (aspangaro@open-dsi.fr)
*
* Help : http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
*
* @param array $objectLines data
*
@ -1470,14 +1472,14 @@ class AccountancyExport
print $date_lim_reglement.$separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if (($line->debit - $line->credit) > 0) {
if (($line->amount) < 0) { // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign.
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if (($line->debit - $line->credit) < 0) {
$nature_piece = 'AC';
if (($line->amount) < 0) {
$nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign.
} else {
$nature_piece = 'FC';
}

View File

@ -729,7 +729,10 @@ class BookKeeping extends CommonObject
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation,";
$sql .= " t.date_export,";
// In llx_accounting_bookkeeping_tmp, field date_export doesn't exist
if ($mode != "_tmp") {
$sql .= " t.date_export,";
}
$sql .= " t.date_validated as date_validation";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t';
$sql .= ' WHERE 1 = 1';
@ -1024,6 +1027,12 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} elseif ($key == 't.code_journal' && !empty($value)) {
if (is_array($value)) {
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
} else {
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
}
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
@ -1622,7 +1631,11 @@ class BookKeeping extends CommonObject
global $conf;
$sql = "SELECT piece_num, doc_date,code_journal, journal_label, doc_ref, doc_type,";
$sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation";
$sql .= " date_creation, tms as date_modification, date_validated as date_validation";
// In llx_accounting_bookkeeping_tmp, field date_export doesn't exist
if ($mode != "_tmp") {
$sql .= ", date_export";
}
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
@ -1699,7 +1712,11 @@ class BookKeeping extends CommonObject
$sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,";
$sql .= " numero_compte, label_compte, label_operation, debit, credit,";
$sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num,";
$sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation";
$sql .= " date_creation, tms as date_modification, date_validated as date_validation";
// In llx_accounting_bookkeeping_tmp, field date_export doesn't exist
if ($mode != "_tmp") {
$sql .= ", date_export";
}
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";

View File

@ -47,7 +47,7 @@ $error = 0;
*/
// Action to update or add a constant
if ($action == 'settemplates') {
if ($action == 'settemplates' && $user->admin) {
$db->begin();
if (!$error && is_array($_POST)) {
@ -192,7 +192,8 @@ print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("NotificationEMailFrom").'</td>';
print '<td>';
print '<input size="32" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
print img_picto('', 'email', 'class="pictofixedwidth"');
print '<input class="width300" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) {
print ' '.img_warning($langs->trans("ErrorBadEMail"));
}
@ -270,7 +271,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
}
$helptext = '';
form_constantes($constantes, 3, $helptext);
form_constantes($constantes, 3, $helptext, 'EmailTemplate');
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
} else {
@ -316,15 +324,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '</td></tr>';
print '</table>';
}
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
print '<div class="opacitymedium">';
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
if (!empty($conf->societe->enabled)) {
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
}
print '</div>';
}
print '</div>';
print '</form>';
@ -335,6 +342,7 @@ print '<br><br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setfixednotif">';
print '<input type="hidden" name="page_y" value="">';
print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', '');
@ -376,6 +384,12 @@ foreach ($listofnotifiedevents as $notifiedevent) {
$elementLabel = $langs->trans('ExpenseReport');
}
$labelfortrigger = 'AmountHT';
$codehasnotrigger = 0;
if (preg_match('/^HOLIDAY/', $notifiedevent['code'])) {
$codehasnotrigger++;
}
print '<tr class="oddeven">';
print '<td>';
print img_picto('', $elementPicto, 'class="pictofixedwidth"');
@ -384,6 +398,7 @@ foreach ($listofnotifiedevents as $notifiedevent) {
print '<td>'.$notifiedevent['code'].'</td>';
print '<td><span class="opacitymedium">'.$label.'</span></td>';
print '<td>';
$inputfieldalreadyshown = 0;
// Notification with threshold
foreach ($conf->global as $key => $val) {
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) {
@ -407,24 +422,35 @@ foreach ($listofnotifiedevents as $notifiedevent) {
}
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
print '<br>';
$inputfieldalreadyshown++;
}
// New entry input fields
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
if (empty($inputfieldalreadyshown) || !$codehasnotrigger) {
$s = '<input type="text" size="32" name="NOTIF_'.$notifiedevent['code'].'_new_key" value="">'; // Do not use type="email" here, we must be able to enter a list of email with , separator.
print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'<br>'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2);
}
print '</td>';
print '<td>';
// Notification with threshold
$inputfieldalreadyshown = 0;
foreach ($conf->global as $key => $val) {
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) {
continue;
}
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
if (!$codehasnotrigger) {
print $langs->trans($labelfortrigger).' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_amount" value="'.dol_escape_htmltag($reg[1]).'">';
print '<br>';
$inputfieldalreadyshown++;
}
}
// New entry input fields
print $langs->trans("AmountHT").' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
if (!$codehasnotrigger) {
print $langs->trans($labelfortrigger).' >= <input type="text" size="4" name="NOTIF_'.$notifiedevent['code'].'_new_amount" value="">';
}
print '</td>';
print '<td>';
@ -437,7 +463,7 @@ print '</table>';
print '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
print '<div class="center"><input type="submit" class="button button-save reposition" value="'.$langs->trans("Save").'"></div>';
print '</form>';

View File

@ -68,6 +68,8 @@ if ($action == 'update') {
if (GETPOSTISSET('MAIN_PDF_NO_SENDER_FRAME')) dolibarr_set_const($db, "MAIN_PDF_NO_SENDER_FRAME", GETPOST("MAIN_PDF_NO_SENDER_FRAME"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_NO_RECIPENT_FRAME')) dolibarr_set_const($db, "MAIN_PDF_NO_RECIPENT_FRAME", GETPOST("MAIN_PDF_NO_RECIPENT_FRAME"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_HIDE_SENDER_NAME')) dolibarr_set_const($db, "MAIN_PDF_HIDE_SENDER_NAME", GETPOST("MAIN_PDF_HIDE_SENDER_NAME"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", GETPOST("MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_TVAINTRA_NOT_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", GETPOST("MAIN_TVAINTRA_NOT_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
@ -92,6 +94,8 @@ if ($action == 'update') {
if (GETPOSTISSET('MAIN_DOCUMENTS_LOGO_HEIGHT')) dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_INVERT_SENDER_RECIPIENT')) dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_USE_ISO_LOCATION')) dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_NO_CUSTOMER_CODE')) dolibarr_set_const($db, "MAIN_PDF_NO_CUSTOMER_CODE", GETPOST("MAIN_PDF_NO_CUSTOMER_CODE"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS')) dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PDF_MAIN_HIDE_SECOND_TAX')) dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", GETPOST("MAIN_PDF_MAIN_HIDE_SECOND_TAX"), 'chaine', 0, '', $conf->entity);
@ -275,6 +279,36 @@ if ($conf->use_javascript_ajax) {
print $form->selectarray("MAIN_PDF_NO_RECIPENT_FRAME", $arrval, $conf->global->MAIN_PDF_NO_RECIPENT_FRAME);
}
// Show sender name
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
} else {
print $form->selectyesno('MAIN_PDF_HIDE_SENDER_NAME', (!empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) ? $conf->global->MAIN_PDF_HIDE_SENDER_NAME : 0, 1);
}
print '</td></tr>';
//Invert sender and recipient
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT');
} else {
print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1);
}
print '</td></tr>';
// Place customer adress to the ISO location
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION');
} else {
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1);
}
print '</td></tr>';
print '</table>';
print '</div>';
@ -345,6 +379,18 @@ print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Use 2 languages into PDF
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
//if (! empty($conf->global->MAIN_MULTILANGS))
//{
$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0);
print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
//} else {
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
//}
print '</td></tr>';
// Height of logo
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'</td><td>';
print '<input type="text" class="maxwidth50" name="MAIN_DOCUMENTS_LOGO_HEIGHT" value="'.(!empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT) ? $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT : 20).'">';
@ -361,38 +407,18 @@ if (!empty($conf->projet->enabled)) {
print '</td></tr>';
}
//Invert sender and recipient
//
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_CUSTOMER_CODE");
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT');
print ajax_constantonoff('MAIN_PDF_HIDE_CUSTOMER_CODE');
} else {
print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MAIN_PDF_HIDE_CUSTOMER_CODE", $arrval, $conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE);
}
print '</td></tr>';
// Place customer adress to the ISO location
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION');
} else {
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1);
}
print '</td></tr>';
// Use 2 languages into PDF
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
//if (! empty($conf->global->MAIN_MULTILANGS))
//{
$selected = GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) ? $conf->global->PDF_USE_ALSO_LANGUAGE_CODE : 0);
print $formadmin->select_language($selected, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
//} else {
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
//}
print '</td></tr>';
// Ref
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';

View File

@ -54,15 +54,15 @@ if ($cancel) {
if ($action == 'update') {
if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) {
dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
}
dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTMODE')) {
dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
}
dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTMODE", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTMODE"), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')) {
dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
}
dolibarr_set_const($db, "MAIN_GENERATE_PROPOSALS_WITH_PICTURE", GETPOST("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), 'chaine', 0, '', $conf->entity);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");

View File

@ -91,15 +91,21 @@ $workflowcodes = array(
),
// Automatic classification of order
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array(
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated
'family'=>'classify_order',
'position'=>40,
'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)),
'picto'=>'order'
),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array(
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed
'family'=>'classify_order',
'position'=>41,
'enabled'=>(!empty($conf->expedition->enabled) && !empty($conf->commande->enabled)),
'picto'=>'order'
),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array(
'family'=>'classify_order',
'position'=>42,
'enabled'=>(!empty($conf->facture->enabled) && !empty($conf->commande->enabled)),
'picto'=>'order',
'warning'=>''

View File

@ -79,7 +79,10 @@ $form = new Form($db);
$block_static = new BlockedLog($db);
$block_static->loadTrackedEvents();
llxHeader('', $langs->trans("BlockedLogSetup"));
$title = $langs->trans("BlockedLogSetup");
$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
llxHeader('', $title, $help_url);
$linkback = '';
if ($withtab) {

View File

@ -275,8 +275,9 @@ if (GETPOST('withtab', 'alpha')) {
} else {
$title = $langs->trans("BrowseBlockedLog");
}
$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
llxHeader('', $langs->trans("BrowseBlockedLog"));
llxHeader('', $title, $help_url);
$MAXLINES = 10000;

View File

@ -325,7 +325,7 @@ foreach ($search as $key => $val) {
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || $search[$key] === '0') {
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
$search[$key] = '';
}
$mode_search = 2;

View File

@ -40,7 +40,7 @@ $action = GETPOST("action", "alpha");
$title = (string) GETPOST("title", "alpha");
$url = (string) GETPOST("url", "alpha");
$urlsource = GETPOST("urlsource", "alpha");
$target = GETPOST("target", "alpha");
$target = GETPOST("target", "int");
$userid = GETPOST("userid", "int");
$position = GETPOST("position", "int");
$backtopage = GETPOST('backtopage', 'alpha');
@ -169,7 +169,7 @@ if ($action == 'create') {
// Target
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
print $form->selectarray('target', $liste, 1);
print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1);
print '</td><td class="hideonsmartphone"><span class="opacitymedium">'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'</span></td></tr>';
// Owner

View File

@ -1,191 +0,0 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/admin/cashdesk.php
* \ingroup cashdesk
* \brief Setup page for cashdesk module
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
// If socid provided by ajax company selector
if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY_id'])) {
$_GET['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_POST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
$_REQUEST['CASHDESK_ID_THIRDPARTY'] = GETPOST('CASHDESK_ID_THIRDPARTY_id', 'alpha');
}
// Security check
if (!$user->admin) {
accessforbidden();
}
// Load translation files required by the page
$langs->loadLangs(array("admin", "cashdesk"));
/*
* Actions
*/
if (GETPOST('action', 'alpha') == 'set') {
$db->begin();
if (GETPOST('socid', 'int') < 0) {
$_POST["socid"] = '';
}
$res = dolibarr_set_const($db, "CASHDESK_ID_THIRDPARTY", (GETPOST('socid', 'int') > 0 ? GETPOST('socid', 'int') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CASH", (GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CASH', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CHEQUE", (GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CHEQUE', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_CB", (GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_CB', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE", (GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE', 'alpha') : ''), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", GETPOST('CASHDESK_NO_DECREASE_STOCK', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "CASHDESK_DOLIBAR_RECEIPT_PRINTER", GETPOST('CASHDESK_DOLIBAR_RECEIPT_PRINTER', 'alpha'), 'chaine', 0, '', $conf->entity);
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
if (!($res > 0)) {
$error++;
}
if (!$error) {
$db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$form = new Form($db);
$formproduct = new FormProduct($db);
llxHeader('', $langs->trans("CashDeskSetup"));
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("CashDeskSetup").' (SimplePOS)', $linkback, 'title_setup');
print '<br>';
// Mode
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';
if (!empty($conf->service->enabled)) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("CashdeskShowServices");
print '<td colspan="2">';
print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1);
print "</td></tr>\n";
print '</table>';
print '<br>';
}
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Terminal").' 0</td><td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td colspan="2">';
print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client in (1,3) AND s.status = 1)', 1, 0, 0, array(), 0);
print '</td></tr>';
if (!empty($conf->banque->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
print '<td colspan="2">';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
print '<td colspan="2">';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE, 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", 1);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>';
print '<td colspan="2">';
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB, 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", 1);
print '</td></tr>';
}
if (!empty($conf->stock->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
print '<td colspan="2">';
if (empty($conf->productbatch->enabled)) {
print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK', $conf->global->CASHDESK_NO_DECREASE_STOCK, 1);
} else {
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK", 1, 'chaine', 0, '', $conf->entity);
}
print $langs->trans("Yes").'<br>';
print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';
}
print '</td></tr>';
$disabled = $conf->global->CASHDESK_NO_DECREASE_STOCK;
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskIdWareHouse").'</td>'; // Force warehouse (this is not a default value)
print '<td colspan="2">';
if (!$disabled) {
print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE, 'CASHDESK_ID_WAREHOUSE', '', 1, $disabled);
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">('.$langs->trans("Create").')</a>';
} else {
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
}
print '</td></tr>';
}
// Use Dolibarr Receipt Printer
if (!empty($conf->receiptprinter->enabled)) {
print '<tr class="oddeven"><td>';
print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')';
print '<td colspan="2">';
print $form->selectyesno("CASHDESK_DOLIBAR_RECEIPT_PRINTER", $conf->global->CASHDESK_DOLIBAR_RECEIPT_PRINTER, 1);
print "</td></tr>\n";
}
print '</table>';
print '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
print "</form>\n";
// End of page
llxFooter();
$db->close();

View File

@ -1,100 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/affContenu.php
* \ingroup cashdesk
* \brief Include to show main page for cashdesk module
*/
require_once 'class/Facturation.class.php';
// Si nouvelle vente, reinitialisation des donnees (destruction de l'objet et vidage de la table contenant la liste des articles)
if (GETPOST('id', 'int') == 'NOUV') {
unset($_SESSION['serObjFacturation']);
unset($_SESSION['poscart']);
}
// Recuperation, s'il existe, de l'objet contenant les infos de la vente en cours ...
if (isset($_SESSION['serObjFacturation'])) {
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
} else {
// ... sinon, c'est une nouvelle vente
$obj_facturation = new Facturation();
}
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
// $obj_facturation contains data for all invoice total + selection of current product
$obj_facturation->calculTotaux(); // Redefine prix_total_ttc, prix_total_ht et montant_tva from $_SESSION['poscart']
$total_ttc = $obj_facturation->amountWithTax();
/*var_dump($obj_facturation);
var_dump($_SESSION['poscart']);
var_dump($total_ttc);
exit;*/
// Left area with selected articles (area for article, amount and payments)
print '<div class="inline-block" style="vertical-align: top">';
print '<div class="principal">';
$page = GETPOST('menutpl', 'alpha');
if (empty($page)) {
$page = 'facturation';
}
if (in_array(
$page,
array(
'deconnexion',
'index', 'index_verif', 'facturation', 'facturation_verif', 'facturation_dhtml',
'validation', 'validation_ok', 'validation_ticket', 'validation_verif',
)
)) {
include $page.'.php';
} else {
dol_print_error('', 'menu param '.$page.' is not inside allowed list');
}
print '</div>';
print '</div>';
// Right area with selected articles (shopping cart)
print '<div class="inline-block" style="vertical-align: top">';
print '<div class="liste_articles">';
require 'tpl/liste_articles.tpl.php';
print '</div>';
print '</div>';
$_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -1,78 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/affIndex.php
* \ingroup cashdesk
* \brief First page of point of sale module
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php';
$error = GETPOST('error');
// Test if already logged
if ($_SESSION['uid'] <= 0) {
header('Location: index.php');
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("companies", "compta", "cashdesk"));
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
$arrayofjs = array();
$arrayofcss = array('/cashdesk/css/style.css');
top_htmlhead($head, $langs->trans("CashDesk"), 0, 0, $arrayofjs, $arrayofcss);
print '<body>'."\n";
if (!empty($error)) {
dol_htmloutput_events();
}
print '<div class="conteneur">'."\n";
print '<div class="conteneur_img_gauche">'."\n";
print '<div class="conteneur_img_droite">'."\n";
print '<div class="menu_principal">'."\n";
include_once 'tpl/menu.tpl.php';
print '</div>'."\n";
print '<div class="contenu">'."\n";
include_once 'affContenu.php';
print '</div>'."\n";
include_once 'affPied.php';
print '</div></div></div>'."\n";
print '</body></html>'."\n";

View File

@ -1,52 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/affPied.php
* \ingroup cashdesk
* \brief Bottom of main page of point of sale module
*/
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
?>
<!-- affPied.php -->
<div class="pied">
<?php
// Wrapper to show tooltips
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_no_mouse_hover)) {
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
print '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".classfortooltip").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 },
tooltipClass: "mytooltip",
content: function () {
return $(this).prop(\'title\'); /* To force to get title as is */
}
});
});
</script>' . "\n";
}
printCommonFooter('private');
?>
</div>

View File

@ -1,144 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@uers.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Class ot manage authentication for pos module (cashdesk)
*/
class Auth
{
protected $db;
private $login;
private $passwd;
private $reponse;
public $sqlQuery;
/**
* Enter description here ...
*
* @param DoliDB $db Database handler
* @return void
*/
public function __construct($db)
{
$this->db = $db;
$this->reponse(null);
}
/**
* Enter description here ...
*
* @param string $aLogin Login
* @return void
*/
public function login($aLogin)
{
$this->login = $aLogin;
}
/**
* Enter description here ...
*
* @param string $aPasswd Password
* @return void
*/
public function passwd($aPasswd)
{
$this->passwd = $aPasswd;
}
/**
* Enter description here ...
*
* @param string $aReponse Response
* @return void
*/
public function reponse($aReponse)
{
$this->reponse = $aReponse;
}
/**
* Validate login/pass
*
* @param string $aLogin Login
* @param string $aPasswd Password
* @return int 0 or 1
*/
public function verif($aLogin, $aPasswd)
{
global $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_auto_user;
$ret = -1;
$login = '';
$test = true;
// Authentication mode
if (empty($dolibarr_main_authentication)) {
$dolibarr_main_authentication = 'http,dolibarr';
}
// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
$dolibarr_auto_user = 'auto';
}
// Set authmode
$authmode = explode(',', $dolibarr_main_authentication);
// No authentication mode
if (!count($authmode)) {
$langs->load('main');
dol_print_error('', $langs->trans("ErrorConfigParameterNotDefined", 'dolibarr_main_authentication'));
exit;
}
$usertotest = $aLogin;
$passwordtotest = $aPasswd;
$entitytotest = $conf->entity;
// Validation tests user / password
// If ok, the variable will be initialized login
// If error, we will put error message in session under the name dol_loginmesg
$goontestloop = false;
if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) {
$goontestloop = true;
}
if (isset($aLogin) || GETPOST('openid_mode', 'alpha', 1)) {
$goontestloop = true;
}
if ($test && $goontestloop) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode);
if ($login) {
$this->login($aLogin);
$this->passwd($aPasswd);
$ret = 0;
} else {
$ret = -1;
}
}
return $ret;
}
}

View File

@ -1,558 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
/**
* Class to manage invoices for pos module (cashdesk)
*/
class Facturation
{
/**
* Attributs "volatiles" : reinitialises apres chaque traitement d'un article
* <p>Attributs "volatiles" : reinitialises apres chaque traitement d'un article</p>
* int $id => 'rowid' du produit dans llx_product
* string $ref => 'ref' du produit dans llx_product
* int $qte => Quantite pour le produit en cours de traitement
* int $stock => Stock theorique pour le produit en cours de traitement
* int $remise_percent => Remise en pourcent sur le produit en cours
* int $montant_remise => Remise en pourcent sur le produit en cours
* int $prix => Prix HT du produit en cours
* int $tva => 'rowid' du taux de tva dans llx_c_tva
*/
/**
* @var int ID
*/
public $id;
protected $ref;
protected $qte;
protected $stock;
protected $remise_percent;
protected $montant_remise;
protected $prix;
protected $tva;
/**
* Attributs persistants : utilises pour toute la duree de la vente (jusqu'a validation ou annulation)
* string $num_facture => Numero de la facture (de la forme FAYYMM-XXXX)
* string $mode_reglement => Mode de reglement (ESP, CB ou CHQ)
* int $montant_encaisse => Montant encaisse en cas de reglement en especes
* int $montant_rendu => Monnaie rendue en cas de reglement en especes
* int $paiement_le => Date de paiement en cas de paiement differe
*
* int $prix_total_ht => Prix total hors taxes
* int $montant_tva => Montant total de la TVA, tous taux confondus
* int $prix_total_ttc => Prix total TTC
*/
protected $num_facture;
protected $mode_reglement;
protected $montant_encaisse;
protected $montant_rendu;
protected $paiement_le;
protected $prix_total_ht;
protected $montant_tva;
protected $prix_total_ttc;
/**
* Constructor
*/
public function __construct()
{
$this->raz();
$this->razPers();
}
// Data processing methods
/**
* Add a product into cart
*
* @return void
*/
public function ajoutArticle()
{
global $conf, $db, $mysoc;
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$product = new Product($db);
$product->fetch($this->id);
$vatrowid = $this->tva();
$tmp = getTaxesFromId($vatrowid);
$txtva = $tmp['rate'].(empty($tmp['code']) ? '' : ' ('.$tmp['code'].')');
$vat_npr = $tmp['npr'];
$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);
// Clean vat code
$reg = array();
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $txtva, $reg)) {
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Define part of HT, VAT, TTC
$resultarray = calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $vat_npr, $product->type, $mysoc, $localtaxarray);
// Calculation of total HT without discount
$total_ht = $resultarray[0];
$total_vat = $resultarray[1];
$total_ttc = $resultarray[2];
$total_localtax1 = $resultarray[9];
$total_localtax2 = $resultarray[10];
// Calculation of the discount amount
if ($this->remisePercent()) {
$remise_percent = $this->remisePercent();
} else {
$remise_percent = 0;
}
$montant_remise_ht = ($resultarray[6] - $resultarray[0]);
$this->amountDiscount($montant_remise_ht);
$newcartarray = $_SESSION['poscart'];
$i = 0;
if (!is_null($newcartarray) && !empty($newcartarray)) {
$i = count($newcartarray);
}
$newcartarray[$i]['id'] = $i;
$newcartarray[$i]['ref'] = $product->ref;
$newcartarray[$i]['label'] = $product->label;
$newcartarray[$i]['price'] = $product->price;
$newcartarray[$i]['price_ttc'] = $product->price_ttc;
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
if (isset($product->multiprices[$societe->price_level])) {
$newcartarray[$i]['price'] = $product->multiprices[$societe->price_level];
$newcartarray[$i]['price_ttc'] = $product->multiprices_ttc[$societe->price_level];
}
}
$newcartarray[$i]['fk_article'] = $this->id;
$newcartarray[$i]['qte'] = $this->qte();
$newcartarray[$i]['fk_tva'] = $this->tva(); // Vat rowid
$newcartarray[$i]['remise_percent'] = $remise_percent;
$newcartarray[$i]['remise'] = price2num($montant_remise_ht);
$newcartarray[$i]['total_ht'] = price2num($total_ht, 'MT');
$newcartarray[$i]['total_ttc'] = price2num($total_ttc, 'MT');
$newcartarray[$i]['total_vat'] = price2num($total_vat, 'MT');
$newcartarray[$i]['total_localtax1'] = price2num($total_localtax1, 'MT');
$newcartarray[$i]['total_localtax2'] = price2num($total_localtax2, 'MT');
$_SESSION['poscart'] = $newcartarray;
$this->raz();
}
/**
* Remove a product from panel
*
* @param int $aArticle Id of line into cart to remove
* @return void
*/
public function supprArticle($aArticle)
{
$poscart = $_SESSION['poscart'];
$j = 0;
$newposcart = array();
foreach ($poscart as $key => $val) {
if ($poscart[$key]['id'] != $aArticle) {
$newposcart[$j] = $poscart[$key];
$newposcart[$j]['id'] = $j;
$j++;
}
}
unset($poscart);
//var_dump($poscart);exit;
$_SESSION['poscart'] = $newposcart;
}
/**
* Calculation of total HT, total TTC and VAT amounts
*
* @return int Total
*/
public function calculTotaux()
{
global $db;
$total_ht = 0;
$total_ttc = 0;
$total_vat = 0;
$total_localtax1 = 0;
$total_localtax2 = 0;
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
$tab_size = count($tab);
for ($i = 0; $i < $tab_size; $i++) {
// Total HT
$remise = $tab[$i]['remise'];
$total_ht += ($tab[$i]['total_ht']);
$total_vat += ($tab[$i]['total_vat']);
$total_ttc += ($tab[$i]['total_ttc']);
$total_localtax1 += ($tab[$i]['total_localtax1']);
$total_localtax2 += ($tab[$i]['total_localtax2']);
}
$this->prix_total_ttc = $total_ttc;
$this->prix_total_ht = $total_ht;
$this->prix_total_vat = $total_vat;
$this->prix_total_localtax1 = $total_localtax1;
$this->prix_total_localtax2 = $total_localtax2;
$this->montant_tva = $total_ttc - $total_ht;
//print 'total: '.$this->prix_total_ttc; exit;
}
/**
* Reset attributes
*
* @return void
*/
public function raz()
{
$this->id('RESET');
$this->ref('RESET');
$this->qte('RESET');
$this->stock('RESET');
$this->remisePercent('RESET');
$this->amountDiscount('RESET');
$this->prix('RESET');
$this->tva('RESET');
}
/**
* Resetting persistent attributes
*
* @return void
*/
private function razPers()
{
$this->numInvoice('RESET');
$this->getSetPaymentMode('RESET');
$this->amountCollected('RESET');
$this->amountReturned('RESET');
$this->paiementLe('RESET');
$this->amountWithoutTax('RESET');
$this->amountVat('RESET');
$this->amountWithTax('RESET');
}
// Methods for modifying protected attributes
/**
* Getter for id
*
* @param int $aId Id
* @return int Id
*/
public function id($aId = null)
{
if (!$aId) {
return $this->id;
} elseif ($aId == 'RESET') {
$this->id = null;
} else {
$this->id = $aId;
}
}
/**
* Getter for ref
*
* @param string $aRef Ref
* @return string Ref
*/
public function ref($aRef = null)
{
if (is_null($aRef)) {
return $this->ref;
} elseif ($aRef == 'RESET') {
$this->ref = null;
} else {
$this->ref = $aRef;
}
}
/**
* Getter for qte
*
* @param int $aQte Qty
* @return int Qty
*/
public function qte($aQte = null)
{
if (is_null($aQte)) {
return $this->qte;
} elseif ($aQte == 'RESET') {
$this->qte = null;
} else {
$this->qte = $aQte;
}
}
/**
* Getter for stock
*
* @param string $aStock Stock
* @return string Stock
*/
public function stock($aStock = null)
{
if (is_null($aStock)) {
return $this->stock;
} elseif ($aStock == 'RESET') {
$this->stock = null;
} else {
$this->stock = $aStock;
}
}
/**
* Getter for remise_percent
*
* @param string $aRemisePercent Discount
* @return string Discount
*/
public function remisePercent($aRemisePercent = null)
{
if (is_null($aRemisePercent)) {
return $this->remise_percent;
} elseif ($aRemisePercent == 'RESET') {
$this->remise_percent = null;
} else {
$this->remise_percent = $aRemisePercent;
}
}
/**
* Getter for montant_remise
*
* @param int $aMontantRemise Amount
* @return string Amount
*/
public function amountDiscount($aMontantRemise = null)
{
if (is_null($aMontantRemise)) {
return $this->montant_remise;
} elseif ($aMontantRemise == 'RESET') {
$this->montant_remise = null;
} else {
$this->montant_remise = $aMontantRemise;
}
}
/**
* Getter for prix
*
* @param int $aPrix Price
* @return string Stock
*/
public function prix($aPrix = null)
{
if (is_null($aPrix)) {
return $this->prix;
} elseif ($aPrix == 'RESET') {
$this->prix = null;
} else {
$this->prix = $aPrix;
}
}
/**
* Getter for tva
*
* @param int $aTva Vat
* @return int Vat
*/
public function tva($aTva = null)
{
if (is_null($aTva)) {
return $this->tva;
} elseif ($aTva == 'RESET') {
$this->tva = null;
} else {
$this->tva = $aTva;
}
}
/**
* Get num invoice
*
* @param string $aNumFacture Invoice ref
* @return string Invoice ref
*/
public function numInvoice($aNumFacture = null)
{
if (is_null($aNumFacture)) {
return $this->num_facture;
} elseif ($aNumFacture == 'RESET') {
$this->num_facture = null;
} else {
$this->num_facture = $aNumFacture;
}
}
/**
* Get payment mode
*
* @param int $aModeReglement Payment mode
* @return int Payment mode
*/
public function getSetPaymentMode($aModeReglement = null)
{
if (is_null($aModeReglement)) {
return $this->mode_reglement;
} elseif ($aModeReglement == 'RESET') {
$this->mode_reglement = null;
} else {
$this->mode_reglement = $aModeReglement;
}
}
/**
* Get amount
*
* @param int $aMontantEncaisse Amount
* @return int Amount
*/
public function amountCollected($aMontantEncaisse = null)
{
if (is_null($aMontantEncaisse)) {
return $this->montant_encaisse;
} elseif ($aMontantEncaisse == 'RESET') {
$this->montant_encaisse = null;
} else {
$this->montant_encaisse = $aMontantEncaisse;
}
}
/**
* Get amount
*
* @param int $aMontantRendu Amount
* @return int Amount
*/
public function amountReturned($aMontantRendu = null)
{
if (is_null($aMontantRendu)) {
return $this->montant_rendu;
} elseif ($aMontantRendu == 'RESET') {
$this->montant_rendu = null;
} else {
$this->montant_rendu = $aMontantRendu;
}
}
/**
* Get payment date
*
* @param integer $aPaiementLe Date
* @return integer Date
*/
public function paiementLe($aPaiementLe = null)
{
if (is_null($aPaiementLe)) {
return $this->paiement_le;
} elseif ($aPaiementLe == 'RESET') {
$this->paiement_le = null;
} else {
$this->paiement_le = $aPaiementLe;
}
}
/**
* Get total HT
*
* @param int $aTotalHt Total amount
* @return int Total amount
*/
public function amountWithoutTax($aTotalHt = null)
{
if (is_null($aTotalHt)) {
return $this->prix_total_ht;
} elseif ($aTotalHt == 'RESET') {
$this->prix_total_ht = null;
} else {
$this->prix_total_ht = $aTotalHt;
}
}
/**
* Get amount vat
*
* @param int $aMontantTva Amount vat
* @return int Amount vat
*/
public function amountVat($aMontantTva = null)
{
if (is_null($aMontantTva)) {
return $this->montant_tva;
} elseif ($aMontantTva == 'RESET') {
$this->montant_tva = null;
} else {
$this->montant_tva = $aMontantTva;
}
}
/**
* Get total TTC
*
* @param int $aTotalTtc Amount ttc
* @return int Amount ttc
*/
public function amountWithTax($aTotalTtc = null)
{
if (is_null($aTotalTtc)) {
return $this->prix_total_ttc;
} elseif ($aTotalTtc == 'RESET') {
$this->prix_total_ttc = null;
} else {
$this->prix_total_ttc = $aTotalTtc;
}
}
}

View File

@ -1,455 +0,0 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
body {
background: #fff;
color: #333;
margin: 0;
padding: 0;
}
p {
margin: 0;
}
.conteneur {
background: #fff;
text-align: left;
/*max-width: 770px;*/
/*margin: 10px auto;
border: 2px solid #000;*/
}
.conteneur_img_gauche {
/* background: url("../img/bg_conteneur_gauche.png") top left repeat-y; */
}
.conteneur_img_droite {
/* background: url("../img/bg_conteneur_droite.png") top right repeat-y; */
}
.contenu {
width: 100%;
text-align: center;
padding-top: 20px;
}
.logo {
text-align: center;
}
.logopos {
padding-top: 20px;
max-height: 40px;
}
/* ------------------- Header ------------------- */
.entete {
height: 15px;
margin: 0;
/* background: url('../img/bg_entete.png') no-repeat left top; */
}
.entete span {
display: none;
}
.principal_login td.label1 {
width: 50%;
}
/* ------------------- Menu ------------------- */
.menu_principal {
margin: 0;
font-size: 14px;
height: 84px;
background: #CCCCCC;
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(40,40,40,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(40,40,40,.3)) );
}
.menu_bloc {
margin-left: 12px;
}
.menu {
margin: 0;
list-style-type: none;
padding: 8px 0 0;
}
.menu li {
float: left;
padding-right: 10px;
}
.menu_choix0 {
font-size: 10px;
text-align: right;
font-style: italic;
font-weight: normal;
display: block;
color: #333;
text-decoration: none;
padding-right: 5px;
}
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
.menu_choix0 {
max-width: 180px;
}
}
.menu_choix0 a {
font-weight: normal;
text-decoration: none;
}
li.menu_choix0 {
float: right;
}
/* ------------------- Remind of products ------------------- */
.liste_articles {
min-width: 215px;
float: right;
margin-top: 8px;
margin-right: 20px;
border: 1px dotted #5ca64d;
padding-bottom: 10px;
vertical-align: middle;
}
p.titre {
margin: 0 0 20px;
text-align: center;
font-weight: bold;
font-size: 1.4em;
color: #5ca64d;
border-bottom: 1px dotted;
}
.cadre_article {
width: 180px;
text-align: center;
margin: 0 auto 10px;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
.cadre_article p {
color: #5ca64d;
}
.cadre_article p a {
color: #333;
font-size: 1.1em;
text-decoration: none;
padding-right: 25px;
background: url('../img/basket_delete.png') top right no-repeat;
}
.cadre_article p a:hover {
color: #6d3f6d;
}
.cadre_aucun_article {
text-align: center;
font-style: italic;
}
.cadre_prix_total {
text-align: center;
font-weight: bold;
font-size: 1.4em;
color: #6d3f6d;
padding-top: 10px;
padding-bottom: 10px;
margin-left: 20px;
margin-right: 20px;
border: 1px dotted #6d3f6d;
}
/* ------------------- Contenu ------------------- */
.principal_login {
margin: 10px;
padding: 0;
max-width: 800px;
text-align: left;
}
.formulaire_login {
text-align: center;
}
.formulaire_login table {
padding-left: 60px;
margin: 0 auto 20px;
background: url('../img/login.png') bottom left no-repeat;
}
.formulaire_login table tr {
height: 30px;
}
.texte_login {
padding-left: 2px;
padding-right: 2px;
background: #fff;
border: 1px solid #6d3f6d;
}
.principal {
float: left;
margin: 0 15px;
padding: 0;
max-width: 900px;
}
.blocksellfinished {
min-width: 215px;
margin-top: 8px;
}
.titre1 {
font-weight: bold;
color: #ff9900;
margin: 0;
font-size: 1.4em;
}
.label1 {
color: #333;
font-size: 1.1em;
}
.cadre_facturation {
border: 2px solid #ddd;
margin-bottom: 15px;
}
.principal p {
padding-left: 10px;
padding-right: 10px;
}
.lien1 {
color: #333;
font-size: 1.1em;
text-decoration: underline;
}
.lien1:hover {
color: #6d3f6d;
}
/* Formulaires */
.formulaire1 {
padding: 0;
}
/* --------------------- Combo lists ------------------- */
.select_design {
overflow: auto;
}
.select_design select {
border: 1px solid #6d3f6d;
font: 12px verdana,arial,helvetica;
background: #fff;
}
.select_tva select {
width: 60px;
border: 1px solid #6d3f6d;
background: #fff;
}
.top_liste {
font-style: italic;
text-align: center;
color: #aaa;
}
/* --------------- Champs texte ---------------- */
.texte_ref,.texte1,.texte1_off,.texte2,.texte2_off,.textarea_note {
padding-left: 2px;
padding-right: 2px;
}
.texte_ref,.texte1,.texte2,.textarea_note {
background: #fff;
border: 1px solid #6d3f6d;
}
.texte1_off,.texte2_off {
color: #000;
border: 1px solid #eee;
background: #eee;
}
.texte_ref {
min-width: 150px;
}
.texte1,.texte1_off {
width: 60px;
}
.texte2,.texte2_off {
width: 140px;
}
/* ------------------- */
.textarea_note {
width: 100%;
height: 50px;
padding: 2px 2px;
}
/* -------------- Buttons for SimplePOS --------------------- */
.bouton_ajout_article {
margin-top: 10px;
width: 60%;
height: 40px;
}
.bouton_mode_reglement, .bouton_mode_reglement_disabled {
width: 150px;
height: 40px;
}
.bouton_validation { /* width: 80px; */
margin-left: 10px;
margin-top: 20px;
margin-bottom: 10px;
}
.formulaire2 {
padding: 0;
width: 100%;
}
.table_resume {
width: 100%;
}
.table_resume tr {
background: #eee;
}
.table_resume td {
padding-left: 8px;
}
.resume_label,.note_label {
min-width: 200px;
font-weight: bold;
font-size: 1.1em;
}
.note_label {
padding-top: 20px;
}
/* ------------------- Pied de page ------------------- */
.pied {
clear: both;
height: 15px;
/* background: url('../img/bg_pied.png') no-repeat bottom left; */
}
/* ------------------- Param<61>tres communs (messages d'erreur, informations, etc...) ------------------- */
.msg_err1 {
color: #c00;
}
/* Messages d'erreur */
.cadre_err1 {
margin-right: 10px;
margin-bottom: 10px;
padding: 10px 10px;
border: 1px solid #c00;
background: #feffac;
color: #c00;
}
/* Titre */
.err_titre {
font-weight: bold;
margin: 0 0 10px;
padding: 0;
}
/* Description */
.err_desc {
margin: 0;
padding: 0;
}
/* Messages d'information */
.cadre_msg1 {
margin-right: 10px;
margin-bottom: 10px;
padding: 10px 10px;
border: 1px solid #070;
background: #e8f8da;
color: #070;
}
/* Titre */
.msg_titre {
font-weight: bold;
margin: 0 0 10px;
padding: 0;
}
/* Description */
.msg_desc {
margin: 0;
padding: 0;
}
/* Affichage de la liste des resultats */
.dhtml_bloc {
margin: 0;
padding: 3px;
font-size: 13px;
font-family: arial, sans-serif;
border: 1px solid #000;
z-index: 1;
width: 455px;
max-height: 500px;
overflow: auto;
position: absolute;
background-color: white;
}
.dhtml_defaut {
list-style-type: none;
display: block;
height: 16px;
overflow: hidden;
}
.dhtml_selection {
background-color: #3366cc;
color: white ! important;
}

View File

@ -1,61 +0,0 @@
/*
* TPV ticket.css
*/
body {
font-size: 1.5em;
position: relative;
}
.entete { /* position: relative; */
}
.address { /* float: left; */
font-size: 12px;
}
.date_heure {
position: absolute;
top: 0;
right: 0;
font-size: 16px;
}
.infos {
position: relative;
}
.liste_articles {
width: 100%;
border-bottom: 1px solid #000;
text-align: center;
}
.liste_articles tr.titres th {
border-bottom: 1px solid #000;
}
.liste_articles td.total {
text-align: right;
}
.totaux {
margin-top: 20px;
width: 30%;
float: right;
text-align: right;
}
.lien {
position: absolute;
top: 0;
left: 0;
display: none;
}
@media print {
.lien {
display: none;
}
}

View File

@ -1,48 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/deconnexion.php
* \ingroup cashdesk
* \brief Manage deconnexion for point of sale module
*/
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Uncomment creates pb to relogon after a disconnect
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
require_once '../main.inc.php';
// This destroy tag that say "Point of Sale session is on".
unset($_SESSION['uid']);
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php');
exit;

View File

@ -1,159 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Adolfo Segura <adolfo.segura@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/facturation.php
* \ingroup cashdesk
* \brief Include to show main page for cashdesk module
*/
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if (GETPOST('filtre', 'alpha')) {
// Avec filtre
$ret = array(); $i = 0;
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx, p.fk_product_type";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
if (!$conf->global->CASHDESK_SERVICES) {
$sql .= " AND p.fk_product_type = 0";
}
$sql .= " AND (";
$sql .= "p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (!empty($conf->barcode->enabled)) {
$filtre = GETPOST('filtre', 'alpha');
//If the barcode looks like an EAN13 format and the last digit is included in it,
//then whe look for the 12-digit too
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
if (strlen($filtre) == 13) {
$crit_12digit = substr($filtre, 0, 12);
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
} else {
$sql .= " OR p.barcode LIKE '%".$db->escape($filtre)."%'";
}
}
$sql .= ")";
$sql .= " ORDER BY label";
dol_syslog("facturation.php", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$nbr_enreg = $db->num_rows($resql);
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) {
foreach ($tab as $cle => $valeur) {
$ret[$i][$cle] = $valeur;
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
$tab_designations = $ret;
} else {
// Sans filtre
$ret = array();
$i = 0;
$sql = "SELECT p.rowid, ref, label, tva_tx, p.fk_product_type";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
if (!$conf->global->CASHDESK_SERVICES) {
$sql .= " AND p.fk_product_type = 0";
}
$sql .= " ORDER BY p.label";
dol_syslog($sql);
$resql = $db->query($sql);
if ($resql) {
$nbr_enreg = $db->num_rows($resql);
while ($i < $conf_taille_listes && $tab = $db->fetch_array($resql)) {
foreach ($tab as $cle => $valeur) {
$ret[$i][$cle] = $valeur;
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
$tab_designations = $ret;
}
//$nbr_enreg = count($tab_designations);
if ($nbr_enreg > 1) {
if ($nbr_enreg > $conf_taille_listes) {
$top_liste_produits = '----- '.$conf_taille_listes.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----';
} else {
$top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----';
}
} elseif ($nbr_enreg == 1) {
$top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound").' -----';
} else {
$top_liste_produits = '----- '.$langs->transnoentitiesnoconv("NoProductFound").' -----';
}
// Recuperation des taux de tva
global $mysoc;
$ret = array();
$i = 0;
// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
$obj_facturation->getSetPaymentMode('RESET');
$obj_facturation->amountCollected('RESET');
$obj_facturation->amountReturned('RESET');
$obj_facturation->paiementLe('RESET');
// Affichage des templates
require 'tpl/facturation1.tpl.php';

View File

@ -1,129 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/facturation_dhtml.php
* \ingroup cashdesk
* \brief This page is called each time we press a key in the code search form to show product combo list.
*/
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', '1');
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1');
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
// Change this following line to use the correct relative path (../, ../../, etc)
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
top_httphead('text/html');
$search = GETPOST("code", "alpha");
// Search from criteria
if (dol_strlen($search) >= 0) { // If search criteria is on char length at least
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = '".$db->escape($conf_fkentrepot)."'";
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
$sql .= " AND p.tosell = 1";
$sql .= " AND p.fk_product_type = 0";
// Add criteria on ref/label
if (!empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) {
$sql .= " AND (p.ref LIKE '".$db->escape($search)."%' OR p.label LIKE '".$db->escape($search)."%'";
if (!empty($conf->barcode->enabled)) {
$sql .= " OR p.barcode LIKE '".$db->escape($search)."%'";
}
$sql .= ")";
} else {
$sql .= " AND (p.ref LIKE '%".$db->escape($search)."%' OR p.label LIKE '%".$db->escape($search)."%'";
if (!empty($conf->barcode->enabled)) {
$sql .= " OR p.barcode LIKE '%".$db->escape($search)."%'";
}
$sql .= ")";
}
$sql .= " ORDER BY label";
dol_syslog("facturation_dhtml.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
if ($nbr = $db->num_rows($result)) {
$resultat = '<ul class="dhtml_bloc">';
$ret = array(); $i = 0;
while ($tab = $db->fetch_array($result)) {
foreach ($tab as $cle => $valeur) {
$ret[$i][$cle] = $valeur;
}
$i++;
}
$tab = $ret;
$tab_size = count($tab);
for ($i = 0; $i < $tab_size; $i++) {
$resultat .= '
<li class="dhtml_defaut" title="'.$tab[$i]['ref'].'"
onMouseOver="javascript: this.className = \'dhtml_selection\';"
onMouseOut="javascript: this.className = \'dhtml_defaut\';"
>'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</li>
';
}
$resultat .= '</ul>';
print $resultat;
} else {
$langs->load("cashdesk");
print '<ul class="dhtml_bloc">';
print '<li class="dhtml_defaut">'.$langs->trans("NoResults").'</li>';
print '</ul>';
}
}
}

View File

@ -1,225 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/facturation_verif.php
* \ingroup cashdesk
* \brief facturation_verif.php
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$action = GETPOST('action', 'aZ09');
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
switch ($action) {
default:
if (GETPOST('hdnSource') != 'NULL') {
$sql = "SELECT p.rowid, p.ref, p.price, p.tva_tx, p.default_vat_code, p.recuperableonly";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= ", ps.reel";
}
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON p.rowid = ps.fk_product AND ps.fk_entrepot = ".((int) $conf_fkentrepot);
}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
// Recuperation des donnees en fonction de la source (liste deroulante ou champ texte) ...
if ($_POST['hdnSource'] == 'LISTE') {
$sql .= " AND p.rowid = ".((int) GETPOST('selProduit', 'int'));
} elseif ($_POST['hdnSource'] == 'REF') {
$sql .= " AND p.ref = '".$db->escape(GETPOST('txtRef', 'alpha'))."'";
}
$result = $db->query($sql);
if ($result) {
// ... et enregistrement dans l'objet
if ($db->num_rows($result)) {
$ret = array();
$tab = $db->fetch_array($result);
foreach ($tab as $key => $value) {
$ret[$key] = $value;
}
// Here $ret['tva_tx'] is vat rate of product but we want to not use the one into table but found by function
$productid = $ret['rowid'];
$product = new Product($db);
$product->fetch($productid);
$prod = $product;
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
// Update if prices fields are defined
$tva_tx = get_default_tva($mysoc, $societe, $product->id);
$tva_npr = get_default_npr($mysoc, $societe, $product->id);
if (empty($tva_tx)) {
$tva_npr = 0;
}
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
$price_base_type = $prod->price_base_type;
// multiprix
if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($societe->price_level)) {
$pu_ht = $prod->multiprices[$societe->price_level];
$pu_ttc = $prod->multiprices_ttc[$societe->price_level];
$price_min = $prod->multiprices_min[$societe->price_level];
$price_base_type = $prod->multiprices_base_type[$societe->price_level];
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
if (isset($prod->multiprices_tva_tx[$societe->price_level])) {
$tva_tx = $prod->multiprices_tva_tx[$societe->price_level];
}
if (isset($prod->multiprices_recuperableonly[$societe->price_level])) {
$tva_npr = $prod->multiprices_recuperableonly[$societe->price_level];
}
}
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $societe->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result >= 0) {
if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines[0]->price);
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
}
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
if (empty($tva_tx)) {
$tva_npr = 0;
}
}
} else {
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
}
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx));
$tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx));
// if price ht is forced (ie: calculated by margin rate and cost price). TODO Why this ?
if (!empty($price_ht)) {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif ($tmpvat != $tmpprodvat) {
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($price_base_type != 'HT') {
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
} else {
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
}
}
$obj_facturation->id($ret['rowid']);
$obj_facturation->ref($ret['ref']);
$obj_facturation->stock($ret['reel']);
//$obj_facturation->prix($ret['price']);
$obj_facturation->prix($pu_ht);
$vatrate = $tva_tx;
$obj_facturation->vatrate = $vatrate; // Save vat rate (full text vat with code)
// Definition du filtre pour n'afficher que le produit concerne
if (GETPOST('hdnSource') == 'LISTE') {
$filtre = $ret['ref'];
} elseif (GETPOST('hdnSource') == 'REF') {
$filtre = GETPOST('txtRef');
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.urlencode($filtre);
} else {
$obj_facturation->raz();
if (GETPOST('hdnSource') == 'REF') {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&filtre='.urlencode(GETPOST('txtRef'));
} else {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
}
}
} else {
dol_print_error($db);
}
} else {
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
}
break;
case 'change_thirdparty': // We have clicked on button "Modify" a thirdparty
$newthirdpartyid = GETPOST('CASHDESK_ID_THIRDPARTY', 'int');
if ($newthirdpartyid > 0) {
$_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid;
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
case 'ajout_article':
if (!empty($obj_facturation->id)) { // A product was previously selected and stored in session, so we can add it
dol_syslog("facturation_verif save vat ".GETPOST('selTva'));
$obj_facturation->qte(GETPOST('txtQte'));
$obj_facturation->tva(GETPOST('selTva')); // id of vat. Saved so we can use it for next product
$obj_facturation->remisePercent(GETPOST('txtRemise'));
$obj_facturation->ajoutArticle(); // This add an entry into $_SESSION['poscart']
// We update prixTotalTtc
}
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
case 'suppr_article':
$obj_facturation->supprArticle(GETPOST('suppr_id'));
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation';
break;
}
// We saved object obj_facturation
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
//var_dump($_SESSION['serObjFacturation']);
header('Location: '.$redirection);
exit;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,50 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2009-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// This file initializes more variables to already initialized variables with main.inc.php
// So include of this file must be always done after include to main.inc.php
$conf_db_type = $dolibarr_main_db_type;
// Parametres de connexion a la base
$conf_db_host = $dolibarr_main_db_host;
$conf_db_user = $dolibarr_main_db_user;
$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 = (!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);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 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);
//var_dump($_SESSION);
// View parameters
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes

View File

@ -1,56 +0,0 @@
<?php
/* Copyright (C) 2014 Charles-FR BENKE <charles.fr@benke.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Return a string to output a keypad
*
* @param string $keypadname Key pad name
* @param string $formname Form name
* @return string HTML code to show a js keypad.
*/
function genkeypad($keypadname, $formname)
{
global $conf;
if (empty($conf->global->CASHDESK_SHOW_KEYPAD)) {
return '';
}
// défine the font size of button
$btnsize = 32;
$sz = '<input type="button" id="closekeypad'.$keypadname.'" value="X" style="display:none;" onclick="closekeypad(\''.$keypadname.'\')"/>'."\n";
$sz .= '<input type="button" value="..." id="openkeypad'.$keypadname.'" onclick="openkeypad(\''.$keypadname.'\')"/><br>'."\n";
$sz .= '<div id="keypad'.$keypadname.'" style="position:absolute;z-index:90;display:none; background:#AAA; vertical-align:top;">'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 7 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',7);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 8 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',8);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 9 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',9);"/><br>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 4 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',4);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 5 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',5);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 6 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',6);"/><br>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 1 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',1);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 2 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',2);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 3 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',3);"/><br>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value=" 0 " onclick="addvalue(\''.$keypadname.'\',\''.$formname.'\',0);"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value="&larr;" ';
$sz .= ' onclick="document.getElementById(\''.$keypadname.'\').value=document.getElementById(\''.$keypadname.'\').value.substr(0,document.getElementById(\''.$keypadname.'\').value.length-1);modif();"/>'."\n";
$sz .= '<input type="button" style="font-size:'.$btnsize.'px;" value="CE" onclick="document.getElementById(\''.$keypadname.'\').value=0;modif();"/>'."\n";
$sz .= '</div>';
return $sz;
}

View File

@ -1,232 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/index.php
* \ingroup cashdesk
* \brief File to login to point of sales
*/
// 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';
// Load translation files required by the page
$langs->loadLangs(array("admin", "cashdesk"));
// Test if user logged
if ($_SESSION['uid'] > 0) {
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php');
exit;
}
$usertxt = GETPOST('user', '', 1);
$err = GETPOST("err");
// Instantiate hooks of thirdparty module only if not already define
$hookmanager->initHooks(array('cashdeskloginpage'));
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
$formproduct = new FormProduct($db);
$arrayofcss = array('/cashdesk/css/style.css');
top_htmlhead('', '', 0, 0, '', $arrayofcss);
// Execute hook getLoginPageOptions (for table)
$parameters = array('entity' => GETPOST('entity', 'int'));
$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
} else {
$morelogincontent = $hookmanager->resPrint;
}
?>
<body>
<div class="conteneur">
<div class="conteneur_img_gauche">
<div class="conteneur_img_droite">
<div class="menu_principal hideonsmartphone">
<div class="logo">
<?php
if (!empty($mysoc->logo_small)) {
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
} else {
print '<div class="logopos">'.$mysoc->name.'</div>';
}
?>
</div>
</div>
<div class="contenu">
<div class="inline-block" style="vertical-align: top">
<div class="principal_login">
<?php if ($err) {
print dol_escape_htmltag($err)."<br><br>\n";
} ?>
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Identification"); ?></legend>
<form id="frmLogin" method="POST" action="index_verif.php">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<table>
<tr>
<td class="label1"><?php echo $langs->trans("Login"); ?></td>
<td><input name="txtUsername" class="texte_login maxwidth150onsmartphoneimp" type="text" value="<?php echo $usertxt; ?>" /></td>
</tr>
<tr>
<td class="label1"><?php echo $langs->trans("Password"); ?></td>
<td><input name="pwdPassword" class="texte_login maxwidth150onsmartphoneimp" type="password" value="" /></td>
</tr>
<?php
if (!empty($morelogincontent)) {
if (is_array($morelogincontent)) {
foreach ($morelogincontent as $format => $option) {
if ($format == 'table') {
echo '<!-- Option by hook -->';
echo $option;
}
}
} else {
echo '<!-- Option by hook -->';
echo $morelogincontent;
}
}
?>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<?php
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskThirdPartyForSell").'</td>';
print '<td>';
$disabled = 0;
$langs->load("companies");
if (!empty($conf->global->CASHDESK_ID_THIRDPARTY)) {
$disabled = 1; // If a particular third party is defined, we disable choice
}
print $form->select_company(GETPOST('socid', 'int') ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.client IN (1,3) AND s.status = 1)', !$disabled, $disabled, 0, array(), 0, 'maxwidth300');
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
print '</td>';
print "</tr>\n";
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$langs->load("stocks");
print "<tr>";
print '<td class="label1">'.$langs->trans("Warehouse").'</td>';
print '<td>';
$disabled = 0;
if ($conf->global->CASHDESK_ID_WAREHOUSE > 0) {
$disabled = 1; // If a particular stock is defined, we disable choice
}
print $formproduct->selectWarehouses((GETPOST('warehouseid') ?GETPOST('warehouseid', 'int') : (empty($conf->global->CASHDESK_ID_WAREHOUSE) ? 'ifone' : $conf->global->CASHDESK_ID_WAREHOUSE)), 'warehouseid', '', !$disabled, $disabled);
print '</td>';
print "</tr>\n";
}
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForSell").'</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) && $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0) {
$defaultknown = 1; // If a particular stock is defined, we disable choice
}
$form->select_comptes(((GETPOST('bankid_cash') > 0) ?GETPOST('bankid_cash') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH), 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", ($defaultknown ? 0 : 2));
print '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE) && $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0) {
$defaultknown = 1; // If a particular stock is defined, we disable choice
}
$form->select_comptes(((GETPOST('bankid_cheque') > 0) ?GETPOST('bankid_cheque') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE), 'CASHDESK_ID_BANKACCOUNT_CHEQUE', 0, "courant=1", ($defaultknown ? 0 : 2));
print '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="label1">'.$langs->trans("CashDeskBankAccountForCB").'</td>';
print '<td>';
$defaultknown = 0;
if (!empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB) && $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0) {
$defaultknown = 1; // If a particular stock is defined, we disable choice
}
$form->select_comptes(((GETPOST('bankid_cb') > 0) ?GETPOST('bankid_cb') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB), 'CASHDESK_ID_BANKACCOUNT_CB', 0, "courant=1", ($defaultknown ? 0 : 2));
print '</td>';
print "</tr>\n";
?>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
</table>
<br>
<div align="center"><span class="bouton_login"><input class="button" type="submit" value="<?php echo dol_escape_htmltag($langs->trans("Connection")); ?>" /></span></div>
</form>
</fieldset>
<?php
if ($_GET['err'] < 0) {
echo ('<script type="text/javascript">');
echo (' document.getElementById(\'frmLogin\').pwdPassword.focus();');
echo ('</script>');
} else {
echo ('<script type="text/javascript">');
echo (' document.getElementById(\'frmLogin\').txtUsername.focus();');
echo ('</script>');
}
?>
</div>
</div>
</div>
<?php include 'affPied.php'; ?></div>
</div>
</div>
</body>
<?php
print '</html>';

View File

@ -1,126 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This page is called after submission of login page.
* We set here login choices into session.
*/
/**
* \file htdocs/cashdesk/index_verif.php
* \ingroup cashdesk
* \brief index_verif.php
*/
include '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "cashdesk"));
$username = GETPOST("txtUsername");
$password = GETPOST("pwdPassword");
$thirdpartyid = (GETPOST('socid', 'int') > 0) ?GETPOST('socid', 'int') : $conf->global->CASHDESK_ID_THIRDPARTY;
$warehouseid = (GETPOST("warehouseid") > 0) ?GETPOST("warehouseid", 'int') : $conf->global->CASHDESK_ID_WAREHOUSE;
$bankid_cash = (GETPOST("CASHDESK_ID_BANKACCOUNT_CASH") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CASH", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
$bankid_cheque = (GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CHEQUE", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
$bankid_cb = (GETPOST("CASHDESK_ID_BANKACCOUNT_CB") > 0) ?GETPOST("CASHDESK_ID_BANKACCOUNT_CB", 'int') : $conf->global->CASHDESK_ID_BANKACCOUNT_CB;
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
// Check username
if (empty($username)) {
$retour = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Login"));
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
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.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
// If we setup stock module to ask movement on invoices, we must not allow access if required setup not finished.
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !($warehouseid > 0)) {
$retour = $langs->trans("CashDeskYouDidNotDisableStockDecease");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
// If stock decrease on bill validation, check user has stock edit permissions
if (!empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK) && !empty($username)) {
$testuser = new User($db);
$testuser->fetch(0, $username);
$testuser->getrights('stock');
if (empty($testuser->rights->stock->creer)) {
$retour = $langs->trans("UserNeedPermissionToEditStockToUsePos");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb);
exit;
}
}
// Check password
$auth = new Auth($db);
$retour = $auth->verif($username, $password);
if ($retour >= 0) {
$return = array();
$sql = "SELECT rowid, lastname, firstname";
$sql .= " FROM ".MAIN_DB_PREFIX."user";
$sql .= " WHERE login = '".$db->escape($username)."'";
$sql .= " AND entity IN (0,".$conf->entity.")";
$result = $db->query($sql);
if ($result) {
$tab = $db->fetch_array($res);
foreach ($tab as $key => $value) {
$return[$key] = $value;
}
$_SESSION['uid'] = $tab['rowid'];
$_SESSION['uname'] = $username;
$_SESSION['lastname'] = $tab['lastname'];
$_SESSION['firstname'] = $tab['firstname'];
$_SESSION['CASHDESK_ID_THIRDPARTY'] = ($thirdpartyid > 0 ? $thirdpartyid : '');
$_SESSION['CASHDESK_ID_WAREHOUSE'] = ($warehouseid > 0 ? $warehouseid : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] = ($bankid_cash > 0 ? $bankid_cash : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] = ($bankid_cheque > 0 ? $bankid_cheque : '');
$_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] = ($bankid_cb > 0 ? $bankid_cb : '');
//var_dump($_SESSION);exit;
header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV');
exit;
} else {
dol_print_error($db);
}
} else {
// Load translation files required by the page
$langs->loadLangs(array("other", "errors"));
$retour = $langs->trans("ErrorBadLoginPassword");
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid);
exit;
}

View File

@ -1,73 +0,0 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Instanciation et initialisation de l'objet xmlhttprequest
function file(fichier) {
// Instanciation de l'objet pour Mozilla, Konqueror, Opera, Safari, etc ...
if (window.XMLHttpRequest) {
xhr_object = new XMLHttpRequest ();
// ... ou pour IE
} else if (window.ActiveXObject) {
xhr_object = new ActiveXObject ("Microsoft.XMLHTTP");
} else {
return (false);
}
xhr_object.open ("GET", fichier, false);
xhr_object.send (null);
if (xhr_object.readyState == 4) {
return (xhr_object.responseText);
} else {
return (false);
}
}
// aCible : id du bloc de destination; aCode : argument a passer a la page php chargee du traitement et de l'affichage
function verifResultat(aCible, aCode, iLimit) {
if (aCode != '' && aCode.length >= iLimit) {
if (texte = file('facturation_dhtml.php?code='+escape(aCode))) {
document.getElementById(aCible).innerHTML = texte;
} else
document.getElementById(aCible).innerHTML = '';
}
}
// Change dynamiquement la classe de l'element ayant l'id aIdElement pour aClasse
function setStyle(aIdElement, aClasse) {
aIdElement.className = aClasse;
}

View File

@ -1,175 +0,0 @@
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Calcul et affichage en temps reel des informations sur le produit en cours
function modif() {
var prix_unit = parseFloat ( document.getElementById('frmQte').txtPrixUnit.value );
var qte = parseFloat ( document.getElementById('frmQte').txtQte.value );
var _index = parseFloat ( document.getElementById('frmQte').selTva.selectedIndex );
var tva = parseFloat ( document.getElementById('frmQte').selTva.options[_index].text );
var remise = parseInt ( document.getElementById('frmQte').txtRemise.value );
var stock = document.getElementById('frmQte').txtStock.value;
// // On s'assure que la quantitee tapee ne depasse pas le stock
// if ( qte > stock ) {
//
// qte = stock;
// document.getElementById('frmQte').txtQte.value = qte;
//
// }
//
// if ( qte < 1 ) {
//
// qte = 1;
// document.getElementById('frmQte').txtQte.value = qte;
//
// }
//
// if ( !stock || stock <= 0 ) {
//
// qte = 0;
// document.getElementById('frmQte').txtQte.value = qte;
//
// }
// Calcul du total HT, sans remise
var total_ht = Math.round ( (prix_unit * qte) * 100 ) / 100;
// Calcul du montant de la remise, apres s'etre assure que cette derniere ne soit pas negative
if ( remise <= 0 ) {
document.getElementById('frmQte').txtRemise.value = 0;
montant_remise = 0;
} else {
var montant_remise = total_ht * remise / 100;
}
// Recalcul du montant total, avec la remise
var total = Math.round ( (total_ht - montant_remise) *100 ) / 100;
// Affichage du resultat dans le formulaire
document.getElementById('frmQte').txtTotal.value = total.toFixed(2);
}
// Affecte la source de la requete (liste deroulante ou champ texte 'ref') au champ cache
function setSource(aSrc) {
document.getElementById('frmFacturation').hdnSource.value = aSrc;
document.getElementById('frmFacturation').submit();
}
// Verification de la coherence des informations saisies dans le formulaire de choix du nombre d'articles
function verifSaisie() {
if ( document.getElementById('frmQte').txtQte.value ) {
return true;
} else {
document.getElementById('frmQte').txtQte.focus();
return false;
}
}
// Verification de la coherence des informations saisies dans le formulaire de calcul de la difference
function verifDifference() {
var du = parseFloat ( document.getElementById('frmDifference').txtDu.value );
var encaisse = parseFloat ( document.getElementById('frmDifference').txtEncaisse.value );
if (encaisse > du) {
resultat = Math.round ( (encaisse - du) * 100 ) / 100;
document.getElementById('frmDifference').txtRendu.value = resultat.toFixed(2);
} else if (encaisse == du) {
document.getElementById('frmDifference').txtRendu.value = '0';
} else {
document.getElementById('frmDifference').txtRendu.value = '-';
}
}
// Affecte le moyen de paiement (ESP, CB ou CHQ) au champ cache en fonction du bouton clique
function verifClic(aChoix) {
document.getElementById('frmDifference').hdnChoix.value = aChoix;
}
// Determination du moyen de paiement, et validation du formulaire si les donnees sont coherentes
function verifReglement() {
var choix = document.getElementById('frmDifference').hdnChoix.value;
var du = parseFloat (document.getElementById('frmDifference').txtDu.value);
var encaisse = parseFloat (document.getElementById('frmDifference').txtEncaisse.value);
if ( du > 0 ) {
if ( choix == 'ESP' ) {
if ( encaisse != 0 && encaisse >= du ) {
return true;
} else {
document.getElementById('frmDifference').txtEncaisse.select();
document.getElementById('frmDifference').txtEncaisse.focus();
return false;
}
} else if ( choix == 'DIF' ) {
if ( document.getElementById('frmDifference').txtDatePaiement.value ) {
return true;
} else {
document.getElementById('frmDifference').txtDatePaiement.select();
document.getElementById('frmDifference').txtDatePaiement.focus();
return false;
}
} else {
return true;
}
} else {
return false;
}
}

View File

@ -1,36 +0,0 @@
/* Copyright (C) 2014 Charles-FR BENKE <charles.fr@benke.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
function closekeypad(keypadname)
{
document.getElementById('keypad'+keypadname).style.display='none';
document.getElementById('closekeypad'+keypadname).style.display='none';
document.getElementById('openkeypad'+keypadname).style.display='inline-block';
}
function openkeypad(keypadname)
{
document.getElementById('keypad'+keypadname).style.display='inline-block';
document.getElementById('closekeypad'+keypadname).style.display='inline-block';
document.getElementById('openkeypad'+keypadname).style.display='none';
}
function addvalue(keypadname, formname, valueToAdd)
{
myform=document.forms[formname];
if (myform.elements[keypadname].value=="0")
myform.elements[keypadname].value="";
myform.elements[keypadname].value+=valueToAdd;
modif();
}

View File

@ -1,225 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "cashdesk"));
// Object $form must de defined
?>
<script type="text/javascript" src="javascript/facturation1.js"></script>
<script type="text/javascript" src="javascript/dhtml.js"></script>
<script type="text/javascript" src="javascript/keypad.js"></script>
<!-- ========================= Cadre "Article" ============================= -->
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Article"); ?></legend>
<form id="frmFacturation" class="formulaire1" method="post" action="facturation_verif.php" autocomplete="off">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<input type="hidden" name="hdnSource" value="NULL" />
<table class="center">
<tr><th class="label1"><?php echo $langs->trans("FilterRefOrLabelOrBC"); ?></th><th class="label1"><?php echo $langs->trans("Designation"); ?></th></tr>
<tr>
<!-- Affichage de la reference et de la designation -->
<!-- Suppression de l'attribut onkeyup qui causait un probleme d'emulation avec les douchettes -->
<td><input class="texte_ref" type="text" id ="txtRef" name="txtRef" value="<?php echo $obj_facturation->ref() ?>"
onchange="javascript: setSource('REF');"
onfocus="javascript: this.select();" />
</td>
<td class="select_design maxwidthonsmartphone">
<select id="selProduit" class="maxwidthonsmartphone" name="selProduit" onchange="javascript: setSource('LISTE');">
<?php
print '<option value="0">'.$top_liste_produits.'</option>'."\n";
$id = $obj_facturation->id();
// Si trop d'articles ont ete trouves, on n'affiche que les X premiers (defini dans le fichier de configuration) ...
$nbtoshow = $nbr_enreg;
if (!empty($conf_taille_listes) && $nbtoshow > $conf_taille_listes) {
$nbtoshow = $conf_taille_listes;
}
for ($i = 0; $i < $nbtoshow; $i++) {
if ($id == $tab_designations[$i]['rowid']) {
$selected = 'selected';
} else {
$selected = '';
}
$label = $tab_designations[$i]['label'];
print '<option '.$selected.' value="'.$tab_designations[$i]['rowid'].'">'.dol_trunc($tab_designations[$i]['ref'], 16).' - '.dol_trunc($label, 35, 'middle');
if (!empty($conf->stock->enabled) && !empty($conf_fkentrepot) && $tab_designations[$i]['fk_product_type'] == 0) {
print ' ('.$langs->trans("CashDeskStock").': '.(empty($tab_designations[$i]['reel']) ? 0 : $tab_designations[$i]['reel']).')';
}
print '</option>'."\n";
}
?>
</select>
</td>
</tr>
</table>
</form>
<form id="frmQte" class="formulaire1" method="post" action="facturation_verif.php?action=ajout_article" onsubmit ="javascript: return verifSaisie();">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<table class="center">
<tr>
<th><?php echo $langs->trans("Qty"); ?></th>
<th><?php echo $langs->trans("PriceUHT"); ?></th>
<th><?php echo $langs->trans("Discount"); ?> (%)</th>
<th><?php echo $langs->trans("VATRate"); ?></th>
<th></th>
</tr>
<tr>
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtQte", "frmQte"); ?>
</td>
<!-- Show unit price -->
<?php // TODO Remove the disabled and use this value when adding product into cart ?>
<td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
<!-- Choix de la remise -->
<td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
<?php print genkeypad("txtRemise", "frmQte"); ?>
</td>
<!-- Choix du taux de TVA -->
<td class="select_tva center">
<?php
$vatrate = $obj_facturation->vatrate; // To get vat rate we just have selected
$buyer = new Societe($db);
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) {
$buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
}
echo $form->load_tva('selTva', (GETPOSTISSET("selTva") ? GETPOST("selTva", 'alpha', 2) : $vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
?>
</td>
<td></td>
</tr>
<tr>
<!-- Affichage du stock pour l'article courant -->
<tr>
<td><?php echo $langs->trans("Stock"); ?></td>
<td>
<input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
</td>
<td><?php echo $langs->trans("TotalHT"); ?></td>
<!-- Affichage du total HT -->
<td colspan="2"><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
</tr>
</table>
<input class="button bouton_ajout_article" type="submit" id="sbmtEnvoyer" value="<?php echo $langs->trans("AddThisArticle"); ?>" />
</form>
</fieldset>
<!-- ========================= Cadre "Amount" ============================= -->
<form id="frmDifference" class="formulaire1" method="post" onsubmit="javascript: return verifReglement()" action="validation_verif.php?action=validate_sell">
<input type="hidden" name="hdnChoix" value="" />
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
<table class="centpercent">
<tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr>
<tr>
<!-- Affichage du montant du -->
<td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->amountWithTax(), 'MT'); ?>" disabled /></td>
<!-- Choix du montant encaisse -->
<td><input class="texte2 maxwidth100onsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtEncaisse", "frmDifference"); ?>
</td>
<!-- Affichage du montant rendu -->
<td><input class="texte2_off maxwidth100onsmartphone" type="text" name="txtRendu" value="0" disabled /></td>
</tr>
<tr>
</table>
</fieldset>
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("PaymentMode"); ?></legend>
<div class="inline-block">
<?php
print '<div class="inline-block" style="margin: 6px;">';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0) {
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
} else {
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
}
print '</div>';
print '<div class="inline-block" style="margin: 6px;">';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) {
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
} else {
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
}
print '</div>';
print '<div class="inline-block" style="margin: 6px;">';
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) {
$langs->load("errors");
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete"), $langs->transnoentitiesnoconv("CashDesk")).'" />';
} else {
print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
}
print '</div>';
print '<div class="clearboth">';
print '<div class="inline-block" style="margin: 6px;">';
?>
<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
<?php
print $langs->trans("DateDue").' :';
print $form->selectDate(-1, 'txtDatePaiement', 0, 0, 0, 'paymentmode', 1, 0);
print '</div>';
?>
</div>
</fieldset>
</form>
<script type="text/javascript">
/* Calendar.setup ({
inputField : "txtDatePaiement",
ifFormat : "%Y-%m-%d",
button : "btnCalendrier"
});
*/
if (document.getElementById('frmFacturation').txtRef.value) {
modif();
document.getElementById('frmQte').txtQte.focus();
document.getElementById('frmQte').txtQte.select();
} else {
document.getElementById('frmFacturation').txtRef.focus();
}
</script>

View File

@ -1,73 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "cashdesk"));
?>
<div class="liste_articles_haut">
<div class="liste_articles_bas">
<p class="titre"><?php echo $langs->trans("ShoppingCart"); ?></p>
<?php
/** add Ditto for MultiPrix*/
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
/** end add Ditto */
$tab = (!empty($_SESSION['poscart']) ? $_SESSION['poscart'] : array());
$tab_size = count($tab);
if ($tab_size <= 0) {
print '<div class="center">'.$langs->trans("NoArticle").'</div><br>';
} else {
for ($i = 0; $i < $tab_size; $i++) {
echo ('<div class="cadre_article">'."\n");
echo ('<p><a href="facturation_verif.php?action=suppr_article&suppr_id='.$tab[$i]['id'].'" title="'.$langs->trans("DeleteArticle").'">'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</a></p>'."\n");
if ($tab[$i]['remise_percent'] > 0) {
$remise_percent = ' -'.$tab[$i]['remise_percent'].'%';
} else {
$remise_percent = '';
}
$remise = $tab[$i]['remise'];
echo ('<p>'.$tab[$i]['qte'].' x '.price2num($tab[$i]['price'], 'MT').$remise_percent.' = '.price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT").' ('.price(price2num($tab[$i]['total_ttc'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC").')</p>'."\n");
echo ('</div>'."\n");
}
}
echo ('<p class="cadre_prix_total">'.$langs->trans("Total").' : '.price(price2num($total_ttc, 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'<br></p>'."\n");
?></div>
</div>

View File

@ -1,90 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
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($_SESSION["CASHDESK_ID_THIRDPARTY"]))
{
$company=new Societe($db);
$company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
$companyLink = $company->getNomUrl(1);
}*/
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$bankcash = new Account($db);
$bankcash->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"]);
$bankcash->label = $bankcash->ref;
$bankcashLink = $bankcash->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$bankcb = new Account($db);
$bankcb->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"]);
$bankcbLink = $bankcb->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$bankcheque = new Account($db);
$bankcheque->fetch($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"]);
$bankchequeLink = $bankcheque->getNomUrl(1);
}
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled)) {
$warehouse = new Entrepot($db);
$warehouse->fetch($_SESSION["CASHDESK_ID_WAREHOUSE"]);
$warehouseLink = $warehouse->getNomUrl(1);
}
// Load translation files required by the page
$langs->loadLangs(array("main", "cashdesk"));
print "\n".'<!-- menu.tpl.php -->'."\n";
print '<div class="menu_bloc">';
print '<ul class="menu">';
// Link to new sell
print '<li class="menu_choix1"><a href="affIndex.php?menutpl=facturation&id=NOUV"><span class="hideonsmartphone">'.$langs->trans("NewSell").'</span></a></li>';
// Open new tab on backoffice (this is not a disconnect from POS)
print '<li class="menu_choix2"><a href=".." target="backoffice"><span class="hideonsmartphone">'.$langs->trans("BackOffice").'</span></a></li>';
// Disconnect
print '<li class="menu_choix0"><div class="cashdeskloginuser marginbottomonly valignmiddle"><div class="inline-block valignmiddle">'.$langs->trans("User").': '.$_SESSION['firstname'].' '.$_SESSION['lastname'].'</div>';
print '<div class="inline-block valignmiddle"> <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a></div></div>';
print '<form id="frmThirdparty" class="formulaire1 inline-block" method="post" action="facturation_verif.php?action=change_thirdparty">';
print $langs->trans("CashDeskThirdParty").': ';
print $form->select_company($_SESSION["CASHDESK_ID_THIRDPARTY"], 'CASHDESK_ID_THIRDPARTY', '(s.client IN (1,3) AND s.status = 1)', '', 0, 0, null, 0, 'valignmiddle inline-block');
print '<input class="button bouton_change_thirdparty inline-block valignmiddle" type="submit" id="bouton_change_thirdparty" value="'.$langs->trans("Modify").'">';
//print $companyLink;
print '<br>';
print '</form>';
/*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/
print '<div class="clearboth">';
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && !empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
}
print '</div></li></ul>';
print '</div>';
print "\n".'<!-- menu.tpl.php end -->'."\n";

View File

@ -1,119 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page
$langs->loadLangs(array("main", "cashdesk"));
top_httphead('text/html');
$facid = GETPOST('facid', 'int');
$object = new Facture($db);
$object->fetch($facid);
?>
<html>
<head>
<title><?php echo $langs->trans('PrintTicket') ?></title>
<link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT; ?>/cashdesk/css/ticket.css">
</head>
<body>
<div class="entete">
<div class="logo">
<?php print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">'; ?>
</div>
<div class="infos">
<p class="address"><?php echo $mysoc->name; ?><br>
<?php print dol_nl2br(dol_format_address($mysoc)); ?><br>
</p>
<p class="date_heure"><?php
// Recuperation et affichage de la date et de l'heure
$now = dol_now();
print dol_print_date($now, 'dayhourtext').'<br>';
print $object->ref;
?></p>
</div>
</div>
<br>
<table class="liste_articles">
<thead>
<tr class="titres">
<th><?php print $langs->trans("Code"); ?></th>
<th><?php print $langs->trans("Label"); ?></th>
<th><?php print $langs->trans("Qty"); ?></th>
<th><?php print $langs->trans("Discount").' (%)'; ?></th>
<th><?php print $langs->trans("TotalHT"); ?></th>
</tr>
</thead>
<tbody>
<?php
$tab = array();
$tab = $_SESSION['poscart'];
$tab_size = count($tab);
for ($i = 0; $i < $tab_size; $i++) {
$remise = $tab[$i]['remise'];
?>
<tr>
<td><?php echo $tab[$i]['ref']; ?></td>
<td><?php echo $tab[$i]['label']; ?></td>
<td><?php echo $tab[$i]['qte']; ?></td>
<td><?php echo $tab[$i]['remise_percent']; ?></td>
<td class="total"><?php echo price(price2num($tab[$i]['total_ht'], 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<table class="totaux">
<tr>
<th class="nowrap"><?php echo $langs->trans("TotalHT"); ?></th>
<td class="nowrap"><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
<tr>
<th class="nowrap"><?php echo $langs->trans("TotalVAT").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountVat(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
<tr>
<th class="nowrap"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="nowrap">'.price(price2num($obj_facturation->amountWithTax(), 'MT'), '', $langs, 0, -1, -1, $conf->currency)."\n"; ?></td>
</tr>
</table>
<script type="text/javascript">
window.print();
</script>
<a class="lien" href="#" onclick="javascript: window.close(); return(false);"><?php echo $langs->trans("Close"); ?></a>
</body>
</html>

View File

@ -1,118 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("main", "bills", "banks"));
// Object $form must de defined
?>
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Summary"); ?></legend>
<table class="table_resume">
<tr><td class="resume_label"><?php echo $langs->trans("Invoice"); ?></td><td><?php echo $obj_facturation->numInvoice(); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("TotalHT"); ?></td><td><?php echo price(price2num($obj_facturation->amountWithoutTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<?php
// Affichage de la tva par taux
if ($obj_facturation->amountVat()) {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price(price2num($obj_facturation->amountVat(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.$langs->trans("NoVAT").'</td></tr>');
}
?>
<tr><td class="resume_label"><?php echo $langs->trans("TotalTTC"); ?> </td><td><?php echo price(price2num($obj_facturation->amountWithTax(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency); ?></td></tr>
<tr><td class="resume_label"><?php echo $langs->trans("PaymentMode"); ?> </td><td>
<?php
switch ($obj_facturation->getSetPaymentMode()) {
case 'ESP':
echo $langs->trans("Cash");
$filtre = 'courant=2';
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
}
break;
case 'CB':
echo $langs->trans("CreditCard");
$filtre = 'courant=1';
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
}
break;
case 'CHQ':
echo $langs->trans("Cheque");
$filtre = 'courant=1';
if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) {
$selected = $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
}
break;
case 'DIF':
echo $langs->trans("Reported");
$filtre = 'courant=1 OR courant=2';
$selected = '';
break;
default:
$filtre = 'courant=1 OR courant=2';
$selected = '';
}
?>
</td></tr>
<?php
// Affichage des infos en fonction du mode de paiement
if ($obj_facturation->getsetPaymentMode() == 'DIF') {
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
} else {
echo ('<tr><td class="resume_label">'.$langs->trans("Received").'</td><td>'.price(price2num($obj_facturation->amountCollected(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
// Affichage du montant rendu (reglement en especes)
if ($obj_facturation->amountReturned()) {
echo ('<tr><td class="resume_label">'.$langs->trans("Change").'</td><td>'.price(price2num($obj_facturation->amountReturned(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
}
?>
</table>
<form id="frmValidation" class="formulaire2" method="post" action="validation_verif.php?action=validate_invoice">
<input type="hidden" name="token" value="<?php echo newToken(); ?>" />
<p class="note_label">
<?php
echo $langs->trans("BankToPay")."<br>";
$form->select_comptes($selected, 'cashdeskbank', 0, $filtre);
?>
</p>
<p class="note_label"><?php echo $langs->trans("Notes"); ?><br><textarea class="textarea_note" name="txtaNotes"></textarea></p>
<div class="center"><input class="button" type="submit" name="btnValider" value="<?php echo $langs->trans("ValidateInvoice"); ?>" /><br>
<br><a class="lien1" href="affIndex.php?menutpl=facturation"><?php echo $langs->trans("RestartSelling"); ?></a>
</div>
</form>
</fieldset>

View File

@ -1,57 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
// Protection to avoid direct call of template
if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit;
}
// Load translation files required by the page
$langs->loadLangs(array("main", "bills"));
?>
<div class="blocksellfinished">
<div class="cadre_facturation">
<h3 class="titre1"><?php echo $langs->trans("SellFinished"); ?></h3><br>
<script type="text/javascript">
function popupTicket(id,name)
{
largeur = 600;
hauteur = 500;
opt = 'width='+largeur+', height='+hauteur+', left='+(screen.width - largeur)/2+', top='+(screen.height-hauteur)/2+'';
window.open('validation_ticket.php?facid='+id,name, opt);
}
popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>');
</script>
<p><a class="lien1" href="<?php echo DOL_URL_ROOT ?>/compta/facture/card.php?action=builddoc&facid=<?php echo GETPOST('facid', 'int'); ?>" target="_blank"><?php echo $langs->trans("ShowInvoice"); ?></a></p>
<br>
<p><a class="lien1" href="#" onclick="Javascript: popupTicket(<?php echo GETPOST('facid', 'int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>'); return(false);"><?php echo $langs->trans("PrintTicket"); ?></a></p>
</div>
</div>
<br>

View File

@ -1,27 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation.php
* \ingroup cashdesk
* \brief validation.php
*/
$form = new Form($db);
// Affichage des templates
require 'tpl/validation1.tpl.php';

View File

@ -1,25 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation_ok.php
* \ingroup cashdesk
* \brief validation_ok.php
*/
// Affichage des templates
require 'tpl/validation2.tpl.php';

View File

@ -1,50 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation_ticket.php
* \ingroup cashdesk
* \brief validation_ticket.php
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* Actions
*/
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
$hookmanager->initHooks(array('cashdeskTplTicket'));
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $obj_facturation);
if (empty($reshook)) {
require 'tpl/ticket.tpl.php';
}
$_SESSION['serObjFacturation'] = serialize($obj_facturation);

View File

@ -1,361 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/cashdesk/validation_verif.php
* \ingroup cashdesk
* \brief validation_verif.php
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
$action = GETPOST('action', 'aZ09');
$bankaccountid = GETPOST('cashdeskbank');
if (empty($user->rights->cashdesk->run)) {
accessforbidden();
}
/*
* Actions
*/
switch ($action) {
default:
$redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=validation';
break;
case 'validate_sell':
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$company = new Societe($db);
$company->fetch($thirdpartyid);
$invoice = new Facture($db);
$invoice->date = dol_now();
$invoice->type = Facture::TYPE_STANDARD;
// To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here
// and restore values just after
$sav_FACTURE_ADDON = '';
if (!empty($conf->global->POS_ADDON)) {
$sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
$conf->global->FACTURE_ADDON = $conf->global->POS_ADDON;
// To force prefix only for POS with terre module
if (!empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) {
$conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
}
// To force prefix only for POS with mars module
if (!empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) {
$conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
}
// To force rule only for POS with mercure
//...
}
$num = $invoice->getNextNumRef($company);
// Restore save values
if (!empty($sav_FACTURE_ADDON)) {
$conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
}
$obj_facturation->numInvoice($num);
$obj_facturation->getSetPaymentMode($_POST['hdnChoix']);
// Si paiement autre qu'en especes, montant encaisse = prix total
$mode_reglement = $obj_facturation->getSetPaymentMode();
if ($mode_reglement != 'ESP') {
$montant = $obj_facturation->amountWithTax();
} else {
$montant = $_POST['txtEncaisse'];
}
if ($mode_reglement != 'DIF') {
$obj_facturation->amountCollected($montant);
//Determination de la somme rendue
$total = $obj_facturation->amountWithTax();
$encaisse = $obj_facturation->amountCollected();
$obj_facturation->amountReturned($encaisse - $total);
} else {
//$txtDatePaiement=$_POST['txtDatePaiement'];
$datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']);
$txtDatePaiement = dol_print_date($datePaiement, 'dayrfc');
$obj_facturation->paiementLe($txtDatePaiement);
}
$redirection = 'affIndex.php?menutpl=validation';
break;
case 'retour':
$redirection = 'affIndex.php?menutpl=facturation';
break;
case 'validate_invoice':
$now = dol_now();
// Recuperation de la date et de l'heure
$date = dol_print_date($now, 'day');
$heure = dol_print_date($now, 'hour');
$note = '';
if (!is_object($obj_facturation)) {
dol_print_error('', 'Empty context');
exit;
}
switch ($obj_facturation->getSetPaymentMode()) {
case 'DIF':
$mode_reglement_id = 0;
//$cond_reglement_id = dol_getIdFromCode($db,'RECEP','cond_reglement','code','rowid')
$cond_reglement_id = 0;
break;
case 'ESP':
$mode_reglement_id = dol_getIdFromCode($db, 'LIQ', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
$note .= $langs->trans("Cash")."\n";
$note .= $langs->trans("Received").' : '.$obj_facturation->amountCollected()." ".$conf->currency."\n";
$note .= $langs->trans("Rendu").' : '.$obj_facturation->amountReturned()." ".$conf->currency."\n";
$note .= "\n";
$note .= '--------------------------------------'."\n\n";
break;
case 'CB':
$mode_reglement_id = dol_getIdFromCode($db, 'CB', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
break;
case 'CHQ':
$mode_reglement_id = dol_getIdFromCode($db, 'CHQ', 'c_paiement', 'code', 'id', 1);
$cond_reglement_id = 0;
break;
}
if (empty($mode_reglement_id)) {
$mode_reglement_id = 0; // If mode_reglement_id not found
}
if (empty($cond_reglement_id)) {
$cond_reglement_id = 0; // If cond_reglement_id not found
}
$note .= GETPOST('txtaNotes', 'alphanohtml');
dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
$error = 0;
$db->begin();
$user->fetch($_SESSION['uid']);
$user->getrights();
$thirdpartyid = $_SESSION['CASHDESK_ID_THIRDPARTY'];
$societe = new Societe($db);
$societe->fetch($thirdpartyid);
$invoice = new Facture($db);
// Get content of cart
$tab_liste = $_SESSION['poscart'];
// Loop on each line into cart
$tab_liste_size = count($tab_liste);
for ($i = 0; $i < $tab_liste_size; $i++) {
$tmp = getTaxesFromId($tab_liste[$i]['fk_tva']);
$vat_rate = $tmp['rate'];
$vat_npr = $tmp['npr'];
$vat_src_code = $tmp['code'];
$invoiceline = new FactureLigne($db);
$invoiceline->fk_product = $tab_liste[$i]['fk_article'];
$invoiceline->desc = $tab_liste[$i]['label'];
$invoiceline->qty = $tab_liste[$i]['qte'];
$invoiceline->remise_percent = $tab_liste[$i]['remise_percent'];
$invoiceline->price = $tab_liste[$i]['price'];
$invoiceline->subprice = $tab_liste[$i]['price'];
$invoiceline->tva_tx = empty($vat_rate) ? 0 : $vat_rate; // works even if vat_rate is ''
$invoiceline->info_bits = empty($vat_npr) ? 0 : $vat_npr;
$invoiceline->vat_src_code = $vat_src_code;
$invoiceline->total_ht = $tab_liste[$i]['total_ht'];
$invoiceline->total_ttc = $tab_liste[$i]['total_ttc'];
$invoiceline->total_tva = $tab_liste[$i]['total_vat'];
$invoiceline->total_localtax1 = $tab_liste[$i]['total_localtax1'];
$invoiceline->total_localtax2 = $tab_liste[$i]['total_localtax2'];
$invoice->lines[] = $invoiceline;
}
$invoice->socid = $conf_fksoc;
$invoice->date_creation = $now;
$invoice->date = $now;
$invoice->date_lim_reglement = 0;
$invoice->total_ht = $obj_facturation->amountWithoutTax();
$invoice->total_tva = $obj_facturation->amountVat();
$invoice->total_ttc = $obj_facturation->amountWithTax();
$invoice->note_private = $note;
$invoice->cond_reglement_id = $cond_reglement_id;
$invoice->mode_reglement_id = $mode_reglement_id;
$invoice->module_source = 'cashdesk';
$invoice->pos_source = '0';
//print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit;
// Si paiement differe ...
if ($obj_facturation->getSetPaymentMode() == 'DIF') {
$resultcreate = $invoice->create($user, 0, dol_stringtotime($obj_facturation->paiementLe()));
if ($resultcreate > 0) {
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
}
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
if ($warehouseidtodecrease > 0) {
// Decrease
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
// Loop on each line
$cpt = count($invoice->lines);
for ($i = 0; $i < $cpt; $i++) {
if ($invoice->lines[$i]->fk_product > 0) {
$mouvP = new MouvementStock($db);
$mouvP->origin = &$invoice;
// We decrease stock for product
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
$result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
} else {
$result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
}
if ($result < 0) {
$error++;
}
}
}
}
} else {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
$id = $invoice->id;
} else {
$resultcreate = $invoice->create($user, 0, 0);
if ($resultcreate > 0) {
$warehouseidtodecrease = (isset($_SESSION["CASHDESK_ID_WAREHOUSE"]) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$warehouseidtodecrease = 0; // If a particular stock is defined, we disable choice
}
$resultvalid = $invoice->validate($user, $obj_facturation->numInvoice(), 0);
if ($warehouseidtodecrease > 0) {
// Decrease
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
$langs->load("agenda");
// Loop on each line
$cpt = count($invoice->lines);
for ($i = 0; $i < $cpt; $i++) {
if ($invoice->lines[$i]->fk_product > 0) {
$mouvP = new MouvementStock($db);
$mouvP->origin = &$invoice;
// We decrease stock for product
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) {
$result = $mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
} else {
$result = $mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos", $invoice->newref));
}
if ($result < 0) {
setEventMessages($mouvP->error, $mouvP->errors, 'errors');
$error++;
}
}
}
}
$id = $invoice->id;
// Add the payment
$payment = new Paiement($db);
$payment->datepaye = $now;
$payment->amounts[$invoice->id] = $obj_facturation->amountWithTax();
$payment->note_public = $langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice();
$payment->paiementid = $invoice->mode_reglement_id;
$payment->num_paiement = '';
$payment->num_payment = '';
$paiement_id = $payment->create($user);
if ($paiement_id > 0) {
if (!$error) {
$result = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccountid, '', '');
if (!$result > 0) {
$errmsg = $paiement->error;
$error++;
}
}
if (!$error) {
if ($invoice->total_ttc == $obj_facturation->amountWithTax()
&& $obj_facturation->getSetPaymentMode() != 'DIFF') {
// We set status to paid
$result = $invoice->setPaid($user);
//print 'set paid';exit;
}
}
} else {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
} else {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++;
}
}
if (!$error) {
$db->commit();
$redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
} else {
$db->rollback();
$redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
}
break;
// End of case: validate_invoice
}
unset($_SESSION['serObjFacturation']);
$_SESSION['serObjFacturation'] = serialize($obj_facturation);
header('Location: '.$redirection);
exit;

View File

@ -261,7 +261,7 @@ class ActionComm extends CommonObject
/**
* @var int socpeople id linked to action
*/
public $contactid;
public $contact_id;
/**
* @var Societe|null Company linked to action (optional)
@ -273,7 +273,7 @@ class ActionComm extends CommonObject
/**
* @var Contact|null Contact linked to action (optional)
* @deprecated
* @see $contactid
* @see $contact_id
*/
public $contact;

File diff suppressed because it is too large Load Diff

View File

@ -2579,7 +2579,7 @@ if ($action == 'create') {
}
// Create an invoice and classify billed
if ($object->statut == Propal::STATUS_SIGNED) {
if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) {
if (!empty($conf->facture->enabled) && $usercancreateinvoice) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a>';
}

View File

@ -517,6 +517,12 @@ if ($search_user > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' WHERE p.fk_soc = s.rowid';
$sql .= ' AND p.entity IN ('.getEntity('propal').')';
if (!$user->rights->societe->client->voir && !$socid) { //restriction

View File

@ -187,6 +187,7 @@ $arrayfields = array(
'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105),
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
@ -470,6 +471,12 @@ if ($search_user > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
}
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' WHERE c.fk_soc = s.rowid';
$sql .= ' AND c.entity IN ('.getEntity('commande').')';
if ($search_product_category > 0) {
@ -1180,6 +1187,9 @@ if ($resql) {
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
print '</td>';
}
if (!empty($arrayfields['sale_representative']['checked'])) {
print '<td class="liste_titre"></td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
@ -1338,6 +1348,9 @@ if ($resql) {
if (!empty($arrayfields['u.login']['checked'])) {
print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['sale_representative']['checked'])) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -1715,6 +1728,53 @@ if ($resql) {
}
}
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
print '<td>';
if ($obj->socid > 0) {
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) {
dol_print_error($db);
}
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0) {
$j = 0;
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
$userstatic->email = $val['email'];
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->office_phone = $val['office_phone'];
$userstatic->office_fax = $val['office_fax'];
$userstatic->user_mobile = $val['user_mobile'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook

View File

@ -1519,6 +1519,12 @@ class Account extends CommonObject
*/
public function needIBAN()
{
global $conf;
if (!empty($conf->global->MAIN_IBAN_IS_NEVER_MANDATORY)) {
return 0;
}
$country_code = $this->getCountryCode();
$country_code_in_EEC = array(

View File

@ -251,7 +251,7 @@ foreach ($search as $key => $val) {
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || $search[$key] === '0') {
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
$search[$key] = '';
}
$mode_search = 2;

View File

@ -99,7 +99,7 @@ class CashControl extends CommonObject
'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600),
'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated')),
);
/**

View File

@ -5077,6 +5077,16 @@ if ($action == 'create') {
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.price($resteapayeraffiche).'</td>';
print '<td class="nowrap">&nbsp;</td></tr>';
// Remainder to pay Multicurrency
if ($object->multicurrency_code != $conf->currency || $object->multicurrency_tx != 1) {
print '<tr><td colspan="'.$nbcols.'" class="right">';
print '<span class="opacitymedium">';
print $langs->trans('MulticurrencyRemainderToPay');
print '</span>';
print '</td>';
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">'.(!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency).' '.price(price2num($object->multicurrency_tx*$resteapayeraffiche, 'MT')).'</td>';
}
// Retained warranty : usualy use on construction industry
if (!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty) {
// Billed - retained warranty

View File

@ -3869,7 +3869,7 @@ class Facture extends CommonInvoice
global $conf, $langs;
if ($this->module_source == 'takepos') {
$langs->load('cashdesk@cashdesk');
$langs->load('cashdesk');
$moduleName = 'takepos';
$moduleSourceName = 'Takepos';

View File

@ -234,6 +234,7 @@ $arrayfields = array(
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166),
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>170),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>171),
'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>180),
@ -1257,6 +1258,9 @@ if ($resql) {
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
print '</td>';
}
if (!empty($arrayfields['sale_representative']['checked'])) {
print '<td class="liste_titre"></td>';
}
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
print '<td class="liste_titre" align="right">';
print '</td>';
@ -1449,6 +1453,9 @@ if ($resql) {
if (!empty($arrayfields['u.login']['checked'])) {
print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['sale_representative']['checked'])) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
}
@ -1939,6 +1946,53 @@ if ($resql) {
}
}
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives
print '<td>';
if ($obj->socid > 0) {
$listsalesrepresentatives = $thirdpartystatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) {
dol_print_error($db);
}
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 6) {
// We print only number
print $nbofsalesrepresentative;
} elseif ($nbofsalesrepresentative > 0) {
$j = 0;
foreach ($listsalesrepresentatives as $val) {
$userstatic->id = $val['id'];
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
$userstatic->email = $val['email'];
$userstatic->statut = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
$userstatic->office_phone = $val['office_phone'];
$userstatic->office_fax = $val['office_fax'];
$userstatic->user_mobile = $val['user_mobile'];
$userstatic->job = $val['job'];
$userstatic->gender = $val['gender'];
//print '<div class="float">':
print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) {
print ' ';
}
//print '</div>';
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");
} else {
print '&nbsp;';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields['f.retained_warranty']['checked'])) {
print '<td align="right amount">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : '&nbsp;').'</td>';
}

View File

@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
// Load translation files required by the page
$langs->loadLangs(array('products', 'contracts', 'companies'));
$optioncss = GETPOST('optioncss', 'aZ09');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
@ -58,7 +60,6 @@ $search_name = GETPOST("search_name", 'alpha');
$search_contract = GETPOST("search_contract", 'alpha');
$search_service = GETPOST("search_service", 'alpha');
$search_status = GETPOST("search_status", 'alpha');
$statut = GETPOST('statut', 'int') ?GETPOST('statut', 'int') : 1;
$search_product_category = GETPOST('search_product_category', 'int');
$socid = GETPOST('socid', 'int');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractservicelist'.$mode;
@ -412,16 +413,16 @@ if (!empty($filter_op2) && $filter_op2 != -1) {
if (!empty($filter_opcloture) && $filter_opcloture != -1) {
$param .= '&amp;filter_opcloture='.urlencode($filter_opcloture);
}
if ($filter_dateouvertureprevue != '') {
if ($filter_dateouvertureprevue_start != '') {
$param .= '&amp;opouvertureprevueday='.$opouvertureprevueday.'&amp;opouvertureprevuemonth='.$opouvertureprevuemonth.'&amp;opouvertureprevueyear='.$opouvertureprevueyear;
}
if ($filter_date1 != '') {
if ($filter_date1_start != '') {
$param .= '&amp;op1day='.$op1day.'&amp;op1month='.$op1month.'&amp;op1year='.$op1year;
}
if ($filter_date2 != '') {
if ($filter_date2_start != '') {
$param .= '&amp;op2day='.$op2day.'&amp;op2month='.$op2month.'&amp;op2year='.$op2year;
}
if ($filter_datecloture != '') {
if ($filter_datecloture_start != '') {
$param .= '&amp;opclotureday='.$op2day.'&amp;opcloturemonth='.$op2month.'&amp;opclotureyear='.$op2year;
}
if ($optioncss != '') {

View File

@ -1201,11 +1201,12 @@ abstract class CommonDocGenerator
* get extrafield content for pdf writeHtmlCell compatibility
* usage for PDF line columns and object note block
*
* @param object $object common object
* @param string $extrafieldKey the extrafield key
* @param object $object Common object
* @param string $extrafieldKey The extrafield key
* @param Translate $outputlangs The output langs (if value is __(XXX)__ we use it to translate it).
* @return string
*/
public function getExtrafieldContent($object, $extrafieldKey)
public function getExtrafieldContent($object, $extrafieldKey, $outputlangs = null)
{
global $hookmanager;
@ -1341,7 +1342,7 @@ abstract class CommonDocGenerator
$field = new stdClass();
$field->rank = intval($extrafields->attributes[$object->table_element]['pos'][$key]);
$field->content = $this->getExtrafieldContent($object, $key);
$field->content = $this->getExtrafieldContent($object, $key, $outputlangs);
$field->label = $outputlangs->transnoentities($label);
$field->type = $extrafields->attributes[$object->table_element]['type'][$key];

View File

@ -3022,6 +3022,7 @@ abstract class CommonObject
*/
public function updateRangOfLine($rowid, $rang)
{
global $hookmanager;
$fieldposition = 'rang'; // @todo Rename 'rang' into 'position'
if (in_array($this->table_element_line, array('bom_bomline', 'ecm_files', 'emailcollector_emailcollectoraction'))) {
$fieldposition = 'position';
@ -3034,6 +3035,9 @@ abstract class CommonObject
if (!$this->db->query($sql)) {
dol_print_error($this->db);
}
$parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
$action='';
$reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -4117,7 +4121,7 @@ abstract class CommonObject
$sql .= " SET ".$fieldstatus." = ".((int) $status);
// If status = 1 = validated, update also fk_user_valid
if ($status == 1 && $elementTable == 'expensereport') {
$sql .= ", fk_user_valid = ".$user->id;
$sql .= ", fk_user_valid = ".((int) $user->id);
}
$sql .= " WHERE rowid=".((int) $elementId);

View File

@ -4724,7 +4724,7 @@ class Form
$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
foreach ($formquestion as $key => $input) {
if (is_array($input) && !empty($input)) {
$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : '');
$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');

View File

@ -515,7 +515,7 @@ class Notify
case 'SHIPPING_VALIDATE':
$link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
$dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
$object_type = 'expedition';
$object_type = 'shipping';
$labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE;
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
break;

View File

@ -214,13 +214,14 @@ interface Database
/**
* Execute a SQL request and return the resultset
*
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param int $result_mode Result mode
* @return resource Resultset of answer
*/
public function query($query, $usesavepoint = 0, $type = 'auto');
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0);
/**
* Connexion to server
@ -493,8 +494,8 @@ interface Database
/**
* Returns the current line (as an object) for the resultset cursor
*
* @param resource $resultset Cursor of the desired request
* @return Object Object result line or false if KO or end of cursor
* @param resource $resultset Cursor of the desired request
* @return Object Object result line or false if KO or end of cursor
*/
public function fetch_object($resultset);
// phpcs:enable

View File

@ -262,9 +262,10 @@ class DoliDBMysqli extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param int $result_mode Result mode
* @return bool|mysqli_result Resultset of answer
*/
public function query($query, $usesavepoint = 0, $type = 'auto')
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0)
{
global $conf, $dolibarr_main_db_readonly;
@ -289,9 +290,9 @@ class DoliDBMysqli extends DoliDB
if (!$this->database_name) {
// Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
$ret = $this->db->query($query);
$ret = $this->db->query($query, $result_mode);
} else {
$ret = $this->db->query($query);
$ret = $this->db->query($query, $result_mode);
}
if (!preg_match("/^COMMIT/i", $query) && !preg_match("/^ROLLBACK/i", $query)) {
@ -316,7 +317,7 @@ class DoliDBMysqli extends DoliDB
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
* Returns the current line (as an object) for the resultset cursor
*
* @param mysqli_result $resultset Curseur de la requete voulue
* @return object|null Object result line or null if KO or end of cursor

View File

@ -494,9 +494,10 @@ class DoliDBPgsql extends DoliDB
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param int $result_mode Result mode (not used with pgsql)
* @return false|resource Resultset of answer
*/
public function query($query, $usesavepoint = 0, $type = 'auto')
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0)
{
global $conf, $dolibarr_main_db_readonly;
@ -570,7 +571,7 @@ class DoliDBPgsql extends DoliDB
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
* Returns the current line (as an object) for the resultset cursor
*
* @param resource $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor

View File

@ -393,9 +393,10 @@ class DoliDBSqlite3 extends DoliDB
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param int $result_mode Result mode (not used with sqlite)
* @return SQLite3Result Resultset of answer
*/
public function query($query, $usesavepoint = 0, $type = 'auto')
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0)
{
global $conf, $dolibarr_main_db_readonly;
@ -504,7 +505,7 @@ class DoliDBSqlite3 extends DoliDB
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
* Returns the current line (as an object) for the resultset cursor
*
* @param SQLite3Result $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor

View File

@ -1528,10 +1528,11 @@ function complete_elementList_with_modules(&$elementList)
* @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label)
* where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended)
* @param string $helptext Help
* @param string $helptext Tooltip help to use for the column name of values
* @param string $text Text to use for the column name of values
* @return void
*/
function form_constantes($tableau, $strictw3c = 0, $helptext = '')
function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Value')
{
global $db, $langs, $conf, $user;
global $_Avery_Labels;
@ -1552,7 +1553,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
print '<tr class="liste_titre">';
print '<td class="">'.$langs->trans("Description").'</td>';
print '<td>';
$text = $langs->trans("Value");
$text = $langs->trans($text);
print $form->textwithpicto($text, $helptext, 1, 'help', '', 0, 2, 'idhelptext');
print '</td>';
if (empty($strictw3c)) {

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/core/lib/barcode.lib.php
* \brief Set of functions used for barcode generation
* \brief Set of functions used for barcode generation (internal lib, also code 'phpbarcode')
* \ingroup core
*/
@ -69,7 +69,7 @@ if (defined('PHP-BARCODE_PATH_COMMAND')) {
* Print barcode
*
* @param string $code Code
* @param string $encoding Encoding
* @param string $encoding Encoding ('EAN13', 'ISBN', 'C128', 'UPC', 'CBR', 'QRCODE', 'DATAMATRIX', 'ANY'...)
* @param integer $scale Scale
* @param string $mode 'png' or 'jpg' ...
* @return array|string $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) or string with error message
@ -149,12 +149,10 @@ function barcode_encode($code, $encoding)
dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
$bars = barcode_encode_genbarcode($code, $encoding);
} else {
print "barcode_encode needs an external programm for encodings other then EAN/ISBN (code=".$code.", encoding=".$encoding.")<BR>\n";
print "barcode_encode needs an external program for encodings other then EAN/ISBN (code=".dol_escape_htmltag($code).", encoding=".dol_escape_htmltag($encoding).")<BR>\n";
print "<UL>\n";
print "<LI>download gnu-barcode from <A href=\"https://www.gnu.org/software/barcode/\">www.gnu.org/software/barcode/</A>\n";
print "<LI>compile and install them\n";
print "<LI>download genbarcode from <A href=\"http://www.ashberg.de/bar/\">www.ashberg.de/bar/</A>\n";
print "<LI>compile and install them\n";
print "<LI>specify path the genbarcode in barcode module setup\n";
print "</UL>\n";
print "<BR>\n";

View File

@ -6860,6 +6860,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if ($onlykey) {
$substitutionarray['__ID__'] = '__ID__';
$substitutionarray['__REF__'] = '__REF__';
$substitutionarray['__NEWREF__'] = '__NEWREF__';
$substitutionarray['__REF_CLIENT__'] = '__REF_CLIENT__';
$substitutionarray['__REF_SUPPLIER__'] = '__REF_SUPPLIER__';
$substitutionarray['__NOTE_PUBLIC__'] = '__NOTE_PUBLIC__';
@ -6940,6 +6941,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
} else {
$substitutionarray['__ID__'] = $object->id;
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__NEWREF__'] = $object->newref;
$substitutionarray['__REF_CLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null));
$substitutionarray['__REF_SUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null);
$substitutionarray['__NOTE_PUBLIC__'] = (isset($object->note_public) ? $object->note_public : null);
@ -7183,6 +7185,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
if (is_object($object) && $object->element == 'supplier_proposal') {
$substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id;
}
if (is_object($object) && $object->element == 'shipping') {
$substitutionarray['__URL_SHIPMENT__'] = DOL_MAIN_URL_ROOT."/expedition/card.php?id=".$object->id;
}
}
if (is_object($object) && $object->element == 'action') {

View File

@ -1357,12 +1357,15 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
}
// Description short of product line
$libelleproduitservice = $label;
if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) {
$libelleproduitservice = '<b>'.$libelleproduitservice.'</b>';
if (empty($conf->global->PDF_HIDE_PRODUCT_LABEL_IN_SUPPLIER_LINES)) {
// Description short of product line
$libelleproduitservice = $label;
if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) {
$libelleproduitservice = '<b>'.$libelleproduitservice.'</b>';
}
}
// Add ref of subproducts
if (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) {
$prodser->get_sousproduits_arbo();

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/core/modules/barcode/doc/phpbarcode.modules.php
* \ingroup barcode
* \brief File with class to generate barcode images using php barcode generator
* \brief File with class to generate barcode images using php internal lib barcode generator
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php';
@ -126,7 +126,7 @@ class modPhpbarcode extends ModeleBarCode
*
* @param string $code Value to encode
* @param string $encoding Mode of encoding
* @param string $readable Code can be read
* @param string $readable Code can be read (What is this ? is this used ?)
* @param integer $scale Scale
* @param integer $nooutputiferror No output if error
* @return int <0 if KO, >0 if OK
@ -163,7 +163,7 @@ class modPhpbarcode extends ModeleBarCode
if (!is_array($result)) {
$this->error = $result;
if (empty($nooutputiferror)) {
print $this->error;
print dol_escape_htmltag($this->error);
}
return -1;
}

View File

@ -100,7 +100,7 @@ class modTcpdfbarcode extends ModeleBarCode
*
* @param string $code Value to encode
* @param string $encoding Mode of encoding
* @param string $readable Code can be read
* @param string $readable Code can be read (What is this ? is this used ?)
* @param integer $scale Scale (not used with this engine)
* @param integer $nooutputiferror No output if error (not used with this engine)
* @return int <0 if KO, >0 if OK

View File

@ -1356,7 +1356,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1420,10 +1420,12 @@ class pdf_einstein extends ModelePDFCommandes
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -726,7 +726,7 @@ class pdf_eratosthene extends ModelePDFCommandes
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey);
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
}
@ -1538,7 +1538,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
if (!empty($conf->global->DOC_SHOW_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1606,10 +1606,12 @@ class pdf_eratosthene extends ModelePDFCommandes
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -657,7 +657,7 @@ class pdf_strato extends ModelePDFContract
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_contrat, "day", false, $outputlangs, true), '', 'R');
if ($object->thirdparty->code_client) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -695,11 +695,13 @@ class pdf_strato extends ModelePDFContract
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetFont('', '', $default_font_size - 1);

View File

@ -539,7 +539,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey);
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
}

View File

@ -665,7 +665,7 @@ class pdf_espadon extends ModelePdfExpedition
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey);
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
}
@ -1021,7 +1021,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R');
}
if (!empty($object->thirdparty->code_client)) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1099,10 +1099,12 @@ class pdf_espadon extends ModelePdfExpedition
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -127,7 +127,7 @@ class pdf_rouget extends ModelePdfExpedition
$this->db = $db;
$this->name = "rouget";
$this->description = $langs->trans("DocumentModelStandardPDF");
$this->description = $langs->trans("DocumentModelStandardPDF").' ('.$langs->trans("OldImplementation").')';
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
$this->type = 'pdf';
@ -971,7 +971,7 @@ class pdf_rouget extends ModelePdfExpedition
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery, "day", false, $outputlangs, true), '', 'R');
}
if (!empty($object->thirdparty->code_client)) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && !empty($object->thirdparty->code_client)) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1049,10 +1049,12 @@ class pdf_rouget extends ModelePdfExpedition
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -1803,7 +1803,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R');
}
if ($object->thirdparty->code_client) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1862,10 +1862,12 @@ class pdf_crabe extends ModelePDFFactures
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -766,7 +766,7 @@ class pdf_sponge extends ModelePDFFactures
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey);
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
}
@ -2041,7 +2041,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->date_lim_reglement, "day", false, $outputlangs, true), '', 'R');
}
if ($object->thirdparty->code_client) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 3;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -2100,10 +2100,12 @@ class pdf_sponge extends ModelePDFFactures
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -613,7 +613,7 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->datec, "day", false, $outputlangs, true), '', 'R');
if ($object->thirdparty->code_client) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -651,11 +651,13 @@ class pdf_soleil extends ModelePDFFicheinter
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetFont('', '', $default_font_size - 1);

View File

@ -1,145 +0,0 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \defgroup pos Module points of sale
* \brief Module to manage points of sale
* \file htdocs/core/modules/modCashDesk.class.php
* \ingroup pos
* \brief Description and activation file for the module Point Of Sales
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
/**
* Class to describe and enable module Point Of Sales
*/
class modCashDesk extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
$this->numero = 50100;
// Key text used to identify module (for permission, menus, etc...)
$this->rights_class = 'cashdesk';
$this->family = "portal";
$this->module_position = '59';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "CashDesk module";
$this->version = 'deprecated';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->picto = 'cash-register';
// Data directories to create when module is enabled
$this->dirs = array();
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = array("cashdesk.php@cashdesk");
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array('always'=>"modBanque", 'always'=>"modFacture", 'always'=>"modProduct", 'FR'=>'modBlockedLog'); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(5, 6); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2, 4); // Minimum version of Dolibarr required by module
$this->langfiles = array("cashdesk");
$this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
//$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
// Constants
$this->const = array();
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array();
$r = 0;
$r++;
$this->rights[$r][0] = 50101;
$this->rights[$r][1] = 'Use Point of sale';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
// Main menu entries
$this->menus = array(); // List of menus to add
$r = 0;
// This is to declare the Top Menu entry:
$this->menu[$r] = array('fk_menu'=>0, // Put 0 if this is a top menu
'type'=>'top', // This is a Top menu entry
'titre'=>'PointOfSaleShort',
'mainmenu'=>'cashdesk',
'leftmenu'=>'',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
'url'=>'/cashdesk/index.php?user=__USER_LOGIN__',
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>900,
'enabled'=>'$conf->cashdesk->enabled',
'perms'=>'$user->rights->cashdesk->run', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'pointofsale',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
$r++;
// This is to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the top menu entry
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'Title left menu',
// 'mainmenu'=>'mymodule',
// 'url'=>'/comm/action/index2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'$user->rights->mymodule->level1->level2', // Use 'perms'=>'1' if you want your menu with no permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
public function init($options = '')
{
$sql = array();
// Remove permissions and default values
$this->remove($options);
return $this->_init($sql, $options);
}
}

View File

@ -87,6 +87,7 @@ class modWorkflow extends DolibarrModules
0=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
1=>array('WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 'chaine', '1', 'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL', 0, 'current', 0),
2=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0),
3=>array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0),
4=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0),
5=>array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0),
6=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),

View File

@ -1523,7 +1523,7 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetTextColor(0, 0, 60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEndPropal")." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R');
if ($object->thirdparty->code_client) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1587,10 +1587,12 @@ class pdf_azur extends ModelePDFPropales
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -737,7 +737,7 @@ class pdf_cyan extends ModelePDFPropales
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey);
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
}
@ -1634,7 +1634,7 @@ class pdf_cyan extends ModelePDFPropales
}
$pdf->MultiCell($w, 3, $title." : ".dol_print_date($object->fin_validite, "day", false, $outputlangs, true), '', 'R');
if ($object->thirdparty->code_client) {
if (empty($conf->global->MAIN_PDF_HIDE_CUSTOMER_CODE) && $object->thirdparty->code_client) {
$posy += 4;
$pdf->SetXY($posx, $posy);
$pdf->SetTextColor(0, 0, 60);
@ -1701,10 +1701,12 @@ class pdf_cyan extends ModelePDFPropales
}
// Show sender name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
if (empty($conf->global->MAIN_PDF_HIDE_SENDER_NAME)) {
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, $ltrdirection);
$posy = $pdf->getY();
}
// Show sender information
$pdf->SetXY($posx + 2, $posy);

View File

@ -672,7 +672,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
if (!empty($object->lines[$i]->array_options)) {
foreach ($object->lines[$i]->array_options as $extrafieldColKey => $extrafieldValue) {
if ($this->getColumnStatus($extrafieldColKey)) {
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey);
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs);
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue);
$nexY = max($pdf->GetY(), $nexY);
}

View File

@ -65,7 +65,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($
if (is_array($crit)) {
$crit = implode(' ', $crit); // natural_search() expects a string
} elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) {
$sql .= ' AND ('.$extrafieldsobjectprefix.$tmpkey.' = "'.$db->escape($crit).'")';
$sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." = '".$db->escape($crit)."')";
continue;
}
$sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search);

View File

@ -256,15 +256,20 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
if ($action == 'SHIPPING_VALIDATE') {
if (($action == 'SHIPPING_VALIDATE') || ($action == 'SHIPPING_CLOSED')) {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING)) {
if (!empty($conf->commande->enabled) && !empty($conf->expedition->enabled) && !empty($conf->workflow->enabled) &&
(
(!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING) && ($action == 'SHIPPING_VALIDATE')) ||
(!empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED) && ($action == 'SHIPPING_CLOSED'))
)
) {
$qtyshipped = array();
$qtyordred = array();
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
//find all shippement on order origin
// Find all shipments on order origin
$order = new Commande($this->db);
$ret = $order->fetch($object->origin_id);
if ($ret < 0) {
@ -309,15 +314,16 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$diff_array = array_diff_assoc($qtyordred, $qtyshipped);
if (count($diff_array) == 0) {
//No diff => mean everythings is shipped
$ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE');
$ret = $order->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE');
if ($ret < 0) {
$this->error = $object->error;
$this->errors = $object->errors;
$this->error = $order->error;
$this->errors = $order->errors;
return $ret;
}
}
}
}
// classify billed reception
if ($action == 'BILL_SUPPLIER_VALIDATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id, LOG_DEBUG);

View File

@ -288,17 +288,18 @@ class TraceableDB extends DoliDB
/**
* Execute a SQL request and return the resultset
*
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer
* @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @param int $result_mode Result mode
* @return resource Resultset of answer
*/
public function query($query, $usesavepoint = 0, $type = 'auto')
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0)
{
$this->startTracing();
$resql = $this->db->query($query, $usesavepoint, $type);
$resql = $this->db->query($query, $usesavepoint, $type, $result_mode);
$this->endTracing($query, $resql);

View File

@ -116,7 +116,7 @@ class ConferenceOrBoothAttendee extends CommonObject
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>0,'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Valid&eacute;', '9'=>'Annul&eacute;'),),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>0,'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Canceled'),),
);
public $rowid;
public $ref;

View File

@ -480,8 +480,8 @@ foreach ($search as $key => $val) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
if ($search[$key] == '-1' || $search[$key] === '0') {
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
$search[$key] = '';
}
$mode_search = 2;
@ -491,10 +491,10 @@ foreach ($search as $key => $val) {
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";

View File

@ -253,8 +253,8 @@ foreach ($search as $key => $val) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
if ($search[$key] == '-1' || $search[$key] === '0') {
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
$search[$key] = '';
}
$mode_search = 2;
@ -264,10 +264,10 @@ foreach ($search as $key => $val) {
}
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";

View File

@ -471,7 +471,7 @@ class CommandeFournisseur extends CommonOrder
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".$this->socid;
}
$sql .= " WHERE l.fk_commande = ".$this->id;
if ($only_product) {

Some files were not shown because too many files have changed in this diff Show More