merge conflict

This commit is contained in:
jpb 2021-08-18 09:16:28 +02:00
commit fcd485f614
1844 changed files with 33009 additions and 11032 deletions

View File

@ -170,12 +170,6 @@ source_file = htdocs/langs/en_US/hrm.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.intracommreport]
file_filter = htdocs/langs/<lang>/intracommreport.lang
source_file = htdocs/langs/en_US/intracommreport.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.install]
file_filter = htdocs/langs/<lang>/install.lang
source_file = htdocs/langs/en_US/install.lang
@ -188,6 +182,12 @@ source_file = htdocs/langs/en_US/interventions.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.intracommreport]
file_filter = htdocs/langs/<lang>/intracommreport.lang
source_file = htdocs/langs/en_US/intracommreport.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.knowledgemanagement]
file_filter = htdocs/langs/<lang>/knowledgemanagement.lang
source_file = htdocs/langs/en_US/knowledgemanagement.lang
@ -392,18 +392,18 @@ source_file = htdocs/langs/en_US/stripe.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.suppliers]
file_filter = htdocs/langs/<lang>/suppliers.lang
source_file = htdocs/langs/en_US/suppliers.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.supplier_proposal]
file_filter = htdocs/langs/<lang>/supplier_proposal.lang
source_file = htdocs/langs/en_US/supplier_proposal.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.suppliers]
file_filter = htdocs/langs/<lang>/suppliers.lang
source_file = htdocs/langs/en_US/suppliers.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.ticket]
file_filter = htdocs/langs/<lang>/ticket.lang
source_file = htdocs/langs/en_US/ticket.lang

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

@ -50,6 +50,10 @@ then
then
aaupper="SA"
fi
if [ $bb = "IQ" ]
then
aaupper="SA"
fi
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
@ -57,23 +61,29 @@ then
if [ "$aa" != "$bblower" -a "$dirshort" != "en_US" ]
then
reflang="htdocs/langs/"$aa"_"$aaupper
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ]
echo $reflang" "$aa"_"$bb != $aa"_"$aaupper
# If $reflang is a main language to use to sanitize the alternative file
if [ -d $reflang ]
then
echo "***** Search original into "$reflang
echo $dirshort is an alternative language of $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
do f=`cat $fic | wc -l`;
#echo $f lines into file $fic;
if [ $f = 1 ]
then
echo Only one line remainging into file $fic, we delete it;
rm $fic
fi;
done
fi
if [ $aa"_"$bb != $aa"_"$aaupper ]
then
echo "***** Search original into "$reflang
echo $dirshort is an alternative language of $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
do f=`cat $fic | wc -l`;
#echo $f lines into file $fic;
if [ $f = 1 ]
then
echo Only one line remainging into file $fic, we delete it;
rm $fic
fi;
done
fi
fi
fi
done;
fi

View File

@ -177,7 +177,7 @@ foreach ($filesToProcess as $fileToProcess) {
// Start reading and parsing English
$aEnglish = array();
if ($handle = fopen($lEnglishFile, 'r')) {
print "Read English File $lEnglishFile:\n";
$cnt = 0;
@ -246,6 +246,9 @@ foreach ($filesToProcess as $fileToProcess) {
fwrite($oh, "# Dolibarr language file - Source file is en_US - ".(preg_replace('/\.lang$/', '', $fileToProcess))."\n");
$fileFirstFound = array();
$lineFirstFound = array();
$cnt = 0;
while (($line = fgets($handle)) !== false) {
$cnt++;
@ -299,6 +302,7 @@ foreach ($filesToProcess as $fileToProcess) {
}
// String exists in both files and value into alternative language differs from main language but also from english files
// so we keep it.
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key)

View File

@ -257,7 +257,20 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
print '</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '<input type="text" name="pcg_type" list="pcg_type_datalist" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
// autosuggest from existing account types if found
print '<datalist id="pcg_type_datalist">';
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
$sql .= ' WHERE fk_pcg_version = "' . $db->escape($accountsystem->ref) . '"';
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
$sql .= ' LIMIT 50000'; // just as a sanity check
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
print '<option value="' . dol_escape_htmltag($obj->pcg_type) . '">';
}
}
print '</datalist>';
print '</td></tr>';
// Category
@ -320,7 +333,20 @@ if ($action == 'create') {
print $form->textwithpicto($langs->trans("Pcgtype"), $langs->transnoentitiesnoconv("PcgtypeDesc"));
print '</td>';
print '<td>';
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '<input type="text" name="pcg_type" list="pcg_type_datalist" value="'.dol_escape_htmltag(GETPOSTISSET('pcg_type') ? GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
// autosuggest from existing account types if found
print '<datalist id="pcg_type_datalist">';
$sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account';
$sql .= ' WHERE fk_pcg_version = "' . $db->escape($accountsystem->ref) . '"';
$sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy.
$sql .= ' LIMIT 50000'; // just as a sanity check
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
print '<option value="' . dol_escape_htmltag($obj->pcg_type) . '">';
}
}
print '</datalist>';
print '</td></tr>';
// Category

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

@ -535,7 +535,7 @@ if (empty($reshook)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
}
if ($conf->global->ADHERENT_MAIL_REQUIRED && !isValidEMail($email)) {
if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($email)) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
@ -1032,7 +1032,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
// EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<tr><td>'.(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? '<span class="fieldrequired">' : '').$langs->trans("EMail").(!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
// Website

View File

@ -381,12 +381,12 @@ if ($action == 'create') {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
$doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print '</td></tr>';
@ -814,12 +814,12 @@ if ($rowid > 0) {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print "</td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor->Create();
print "</td></tr>";

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

@ -65,6 +65,11 @@ if ($action == 'update') {
if (GETPOSTISSET('MAIN_PROFID5_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
if (GETPOSTISSET('MAIN_PROFID6_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS"), 'chaine', 0, '', $conf->entity);
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);
@ -89,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);
@ -253,6 +260,55 @@ for ($i = 1; $i <= 6; $i++) {
}
}
// Borders on address frame
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_SENDER_FRAME").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_NO_SENDER_FRAME');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("MAIN_PDF_NO_SENDER_FRAME", $arrval, $conf->global->MAIN_PDF_NO_SENDER_FRAME);
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_NO_RECIPENT_FRAME").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_NO_RECIPENT_FRAME');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
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>';
@ -323,14 +379,24 @@ 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>';
// Height of logo
// 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).'">';
print '</td></tr>';
// Show project
if (!empty($conf->projet->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("PDF_SHOW_PROJECT").'</td><td>';
$tmparray = array('no' => 'No', 'showprojectref' => 'RefProject', 'showprojectlabel' => 'ShowProjectLabel');
@ -339,38 +405,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

@ -113,26 +113,6 @@ if ($conf->use_javascript_ajax) {
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTTERM");
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTTERM');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTTERM", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM);
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTMODE");
print '</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTMODE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTMODE", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE);
}
print '</td></tr>';
/*
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
if ($conf->use_javascript_ajax) {

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

@ -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

@ -525,6 +525,7 @@ $viewmode .= '<span class="marginrightonly"></span>'; // To add a space before t
$newcardbutton = '';
$newparam = '';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);

File diff suppressed because it is too large Load Diff

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

@ -471,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) {

View File

@ -67,6 +67,8 @@ $socid = 0;
if ($user->socid) {
$socid = $user->socid;
}
$allowed = 0;
if (!empty($user->rights->accounting->chartofaccount)) {
$allowed = 1; // Dictionary with list of banks accounting account allowed to manager of chart account
}
@ -191,7 +193,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
}
@ -333,12 +335,12 @@ $objecttmp = new Account($db);
$trackid = 'bank'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
}
//if ($sall) {
// foreach ($fieldstosearchall as $key => $val) {
// $fieldstosearchall[$key] = $langs->trans($val);
// }
// print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
//}
$moreforfilter = '';

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

@ -5092,6 +5092,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

@ -376,13 +376,64 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
if ($massaction == 'makepayment_confirm') {
if ($action == 'makepayment_confirm' && $user->rights->facture->paiement) {
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
$arrayofselected = is_array($toselect) ? $toselect : array();
$loc = dol_buildpath('/compta/paiement.php', 2).'?action=create&facids='.implode(',', $arrayofselected);
header('Location: '.$loc);
exit;
if (!empty($arrayofselected)) {
$bankid=GETPOST('bankid', 'int');
$paiementid=GETPOST('paiementid', 'int');
$paiementdate=dol_mktime(12, 0, 0, GETPOST('datepaimentmonth', 'int'), GETPOST('datepaimentday', 'int'), GETPOST('datepaimentyear', 'year'));
foreach ($arrayofselected as $toselectid) {
$errorpayment=0;
$facture = new Facture($db);
$result = $facture->fetch($toselectid);
if ($result < 0) {
setEventMessage($facture->error, 'errors');
$errorpayment++;
} else {
if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == 1 && $facture->paye == 0) {
$paiementAmount = $facture->getSommePaiement();
$totalcreditnotes = $facture->getSumCreditNotesUsed();
$totaldeposits = $facture->getSumDepositsUsed();
$totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits;
$remaintopay = price2num($facture->total_ttc - $totalpay);
if ($remaintopay!=0) {
$resultBank = $facture->setBankAccount($bankid);
if ($resultBank < 0) {
setEventMessage($facture->error, 'errors');
$errorpayment++;
} else {
$paiement = new Paiement($db);
$paiement->datepaye = $paiementdate;
$paiement->amounts[$facture->id] = $remaintopay; // Array with all payments dispatching with invoice id
$paiement->multicurrency_amounts[$facture->id] = $remaintopay;
$paiement->paiementid = $paiementid;
$paiement_id = $paiement->create($user, 1, $facture->thirdparty);
if ($paiement_id < 0) {
setEventMessage($facture->ref . ' ' . $paiement->error, 'errors');
$errorpayment++;
} else {
$result = $paiement->addPaymentToBank($user, 'payment', '', $bankid, '', '');
if ($result < 0) {
setEventMessages($facture->ref . ' ' . $paiement->error, $paiement->errors, 'errors');
$errorpayment++;
}
}
}
} else {
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
$errorpayment++;
}
} else {
setEventMessage($langs->trans('NoPaymentAvailable', $facture->ref), 'warnings');
$errorpayment++;
}
}
if (empty($errorpayment)) {
setEventMessage($langs->trans('RegisterPaymentAndClasiffiedPayedDone', $facture->ref));
}
}
}
} elseif ($massaction == 'withdrawrequest') {
$langs->load("withdrawals");
@ -972,8 +1023,10 @@ if ($resql) {
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
//'makepayment'=>$langs->trans("InvoicePaymentsLimits"),
);
if ($user->rights->facture->paiement) {
$arrayofmassactions['makepayment'] = $langs->trans("RegisterPaymentAndClasiffiedPayed");
}
if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
@ -985,7 +1038,7 @@ if ($resql) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
}
if (in_array($massaction, array('presend', 'predelete'))) {
if (in_array($massaction, array('presend', 'predelete' ,'makepayment'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@ -1007,7 +1060,9 @@ if ($resql) {
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
if (!in_array($massaction, array('makepayment'))) {
print '<input type="hidden" name="action" value="list">';
}
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="search_status" value="'.$search_status.'">';
@ -1021,6 +1076,21 @@ if ($resql) {
$trackid = 'inv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction=='makepayment') {
$formconfirm = '';
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'date', 'name' => 'datepaiment', 'label' => $langs->trans("Date")),
array('type' => 'other', 'name' => 'paiementid', 'label' => $langs->trans("PaymentMode"), 'value' => $form->select_types_paiements(GETPOST('search_paymentmode'), 'paiementid', '', 0, 0, 1, 0, 1, '', 1)),
array('type' => 'other', 'name' => 'bankid', 'label' => $langs->trans("BankAccount"), 'value'=>$form->select_comptes('', 'bankid', 0, '', 0, '', 0, '', 1)),
//array('type' => 'other', 'name' => 'invoicesid', 'label' => '', 'value'=>'<input type="hidden" id="invoicesid" name="invoicesid" value="'.implode('#',GETPOST('toselect','array')).'">'),
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('RegisterPaymentAndClasiffiedPayed'), $langs->trans('RegisterPaymentAndClasiffiedPayed', $object->ref), 'makepayment_confirm', $formquestion, 1, 0, 200, 500, 1);
print $formconfirm;
}
if ($sall) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);

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

@ -53,11 +53,11 @@ if ($action == 'add' && !empty($permissiontoadd)) {
foreach ($object->fields as $key => $val) {
if ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') {
continue; // The field was not submited to be edited
continue; // The field was not submited to be saved
}
} else {
if (!GETPOSTISSET($key)) {
continue; // The field was not submited to be edited
continue; // The field was not submited to be saved
}
}
// Ignore special fields
@ -87,7 +87,11 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$tmparraykey = array_keys($object->param_list);
$value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
} else {
$value = GETPOST($key, 'alphanohtml');
if ($key == 'lang') {
$value = GETPOST($key, 'aZ09');
} else {
$value = GETPOST($key, 'alphanohtml');
}
}
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
$value = ''; // This is an implicit foreign key field
@ -105,6 +109,15 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
// Validation of fields values
if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
if (!$object->validateField($object->fields, $key, $value)) {
$error++;
}
}
}
}
// Fill array 'array_options' with data from add form
@ -143,7 +156,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
// Check if field was submited to be edited
if ($object->fields[$key]['type'] == 'duration') {
if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
continue; // The field was not submited to be edited
continue; // The field was not submited to be saved
}
} elseif ($object->fields[$key]['type'] == 'boolean') {
if (!GETPOSTISSET($key)) {
@ -152,7 +165,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
} else {
if (!GETPOSTISSET($key)) {
continue; // The field was not submited to be edited
continue; // The field was not submited to be saved
}
}
// Ignore special fields
@ -161,7 +174,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
if (!in_array(abs($val['visible']), array(1, 3, 4))) {
continue; // Only 1 and 3 and 4 that are case to update
continue; // Only 1 and 3 and 4, that are cases to update
}
}
@ -190,7 +203,11 @@ if ($action == 'update' && !empty($permissiontoadd)) {
} elseif ($object->fields[$key]['type'] == 'reference') {
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
} else {
$value = GETPOST($key, 'alpha');
if ($key == 'lang') {
$value = GETPOST($key, 'aZ09');
} else {
$value = GETPOST($key, 'alphanohtml');
}
}
if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') {
$value = ''; // This is an implicit foreign key field
@ -204,6 +221,15 @@ if ($action == 'update' && !empty($permissiontoadd)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
// Validation of fields values
if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
if (!$object->validateField($object->fields, $key, $value)) {
$error++;
}
}
}
}
// Fill array 'array_options' with data from add form
@ -273,6 +299,8 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
setEventMessages($object->error, null, 'errors');
}
}
$action = '';
}
// Remove a line
@ -304,11 +332,13 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto
}
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
// Action validate object
@ -344,6 +374,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
// Action close object
@ -374,6 +405,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
// Action setdraft object
@ -384,6 +416,7 @@ if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
// Action reopen object
@ -414,6 +447,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
$action = '';
}
// Action clone object
@ -432,6 +466,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
} else {
$newid = $result;
}
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
exit;
} else {

View File

@ -1544,6 +1544,126 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
}
}
if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $confirm == 'yes')) && $permissiontoapprove) {
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result>0) {
if ($objecttmp->statut == Holiday::STATUS_VALIDATED && $user->id == $objecttmp->fk_validator) {
$objecttmp->oldcopy = dol_clone($objecttmp);
$objecttmp->date_valid = dol_now();
$objecttmp->fk_user_valid = $user->id;
$objecttmp->statut = Holiday::STATUS_APPROVED;
$db->begin();
$verif = $objecttmp->approve($user);
if ($verif <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
}
// If no SQL error, we redirect to the request form
if (!$error) {
// Calculcate number of days consummed
$nbopenedday = num_open_day($objecttmp->date_debut_gmt, $objecttmp->date_fin_gmt, 0, 1, $objecttmp->halfday);
$soldeActuel = $objecttmp->getCpforUser($objecttmp->fk_user, $objecttmp->fk_type);
$newSolde = ($soldeActuel - $nbopenedday);
// The modification is added to the LOG
$result = $objecttmp->addLogCP($user->id, $objecttmp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $objecttmp->fk_type);
if ($result < 0) {
$error++;
setEventMessages(null, $objecttmp->errors, 'errors');
}
// Update balance
$result = $objecttmp->updateSoldeCP($objecttmp->fk_user, $newSolde, $objecttmp->fk_type);
if ($result < 0) {
$error++;
setEventMessages(null, $objecttmp->errors, 'errors');
}
}
if (!$error) {
// To
$destinataire = new User($db);
$destinataire->fetch($objecttmp->fk_user);
$emailTo = $destinataire->email;
if (!$emailTo) {
dol_syslog("User that request leave has no email, so we redirect directly to finished page without sending email");
} else {
// From
$expediteur = new User($db);
$expediteur->fetch($objecttmp->fk_validator);
//$emailFrom = $expediteur->email; Email of user can be an email into another company. Sending will fails, we must use the generic email.
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
// Subject
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$societeName = $conf->global->MAIN_APPLICATION_TITLE;
}
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
$message .= "\n";
$message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($objecttmp->date_debut, 'day'), dol_print_date($objecttmp->date_fin, 'day'))."\n";
$message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$objecttmp->id."\n\n";
$message .= "\n";
$trackid = 'leav'.$objecttmp->id;
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
// Sending email
$result = $mail->sendfile();
if (!$result) {
setEventMessages($mail->error, $mail->errors, 'warnings'); // Show error, but do no make rollback, so $error is not set to 1
$action = '';
}
}
}
if (!$error) {
$db->commit();
$nbok++;
} else {
$db->rollback();
$action = '';
}
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsApproved", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordAproved"), null, 'mesgs');
}
$db->commit();
} else {
$db->rollback();
}
}
$parameters['toselect'] = $toselect;
$parameters['uploaddir'] = $uploaddir;
$parameters['massaction'] = $massaction;

View File

@ -316,7 +316,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
$deliveryreceipt = $_POST['deliveryreceipt'];
if ($action == 'send' || $action == 'relance') {
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('at').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
if ($message) {
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));

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

@ -73,6 +73,11 @@ abstract class CommonObject
*/
public $errors = array();
/**
* @var array To store error results of ->validateField()
*/
public $validateFieldsErrors = array();
/**
* @var string ID to identify managed object
*/
@ -124,13 +129,11 @@ abstract class CommonObject
protected $table_ref_field = '';
/**
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* @var integer
* @var integer 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
*/
public $restrictiononfksoc = 0;
// Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them.
/**
@ -3022,6 +3025,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 +3038,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
@ -6418,6 +6425,16 @@ abstract class CommonObject
$val = $this->fields[$key];
}
// Validation tests and output
$fieldValidationErrorMsg = '';
$validationClass = '';
$fieldValidationErrorMsg = $this->getFieldError($key);
if (!empty($fieldValidationErrorMsg)) {
$validationClass = ' --error'; // the -- is use as class state in css : .--error can't be be defined alone it must be define with another class like .my-class.--error or input.--error
} else {
$validationClass = ' --success'; // the -- is use as class state in css : .--success can't be be defined alone it must be define with another class like .my-class.--success or input.--success
}
$out = '';
$type = '';
$isDependList=0;
@ -6509,6 +6526,11 @@ abstract class CommonObject
}
}
// Add validation state class
if (!empty($validationClass)) {
$morecss.= ' '.$validationClass;
}
if (in_array($type, array('date'))) {
$tmp = explode(',', $size);
$newsize = $tmp[0];
@ -6975,6 +6997,12 @@ abstract class CommonObject
if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
*/
// Display error message for field
if (!empty($fieldValidationErrorMsg) && function_exists('getFieldErrorIcon')) {
$out .= ' '.getFieldErrorIcon($fieldValidationErrorMsg);
}
return $out;
}
@ -7314,6 +7342,228 @@ abstract class CommonObject
return $out;
}
/**
* clear validation message result for a field
*
* @param string $fieldKey Key of attribute to clear
* @return null
*/
public function clearFieldError($fieldKey)
{
$this->error = '';
unset($this->validateFieldsErrors[$fieldKey]);
}
/**
* set validation error message a field
*
* @param string $fieldKey Key of attribute
* @param string $msg the field error message
* @return null
*/
public function setFieldError($fieldKey, $msg = '')
{
global $langs;
if (empty($msg)) { $msg = $langs->trans("UnknowError"); }
$this->error = $this->validateFieldsErrors[$fieldKey] = $msg;
}
/**
* get field error message
*
* @param string $fieldKey Key of attribute
* @return string
*/
public function getFieldError($fieldKey)
{
if (!empty($this->validateFieldsErrors[$fieldKey])) {
return $this->validateFieldsErrors[$fieldKey];
}
return '';
}
/**
* Return validation test result for a field
*
* @param array $val Array of properties of field to show
* @param string $fieldKey Key of attribute
* @param string $fieldValue value of attribute
* @return bool return false if fail true on success, see $this->error for error message
*/
public function validateField($val, $fieldKey, $fieldValue)
{
global $langs;
if (!class_exists('Validate')) { require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; }
$this->clearFieldError($fieldKey);
if (!isset($val[$fieldKey])) {
$this->setFieldError($fieldKey, $langs->trans('FieldNotFoundInObject'));
return false;
}
$param = array();
$param['options'] = array();
$type = $val[$fieldKey]['type'];
$required = false;
if (isset($val[$fieldKey]['notnull']) && $val[$fieldKey]['notnull'] === 1) {
// 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
$required = true;
}
$maxSize = 0;
$minSize = 0;
//
// PREPARE Elements
//
// Convert var to be able to share same code than showOutputField of extrafields
if (preg_match('/varchar\((\d+)\)/', $type, $reg)) {
$type = 'varchar'; // convert varchar(xx) int varchar
$maxSize = $reg[1];
} elseif (preg_match('/varchar/', $type)) {
$type = 'varchar'; // convert varchar(xx) int varchar
}
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
$type = 'select';
}
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
$type = 'link';
}
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
$param['options'] = $val['arrayofkeyval'];
}
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
$type = 'link';
$param['options'] = array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
} elseif (preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4] => 'N');
$type = 'sellist';
} elseif (preg_match('/^sellist:(.*):(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2].':'.$reg[3] => 'N');
$type = 'sellist';
} elseif (preg_match('/^sellist:(.*):(.*)/i', $val['type'], $reg)) {
$param['options'] = array($reg[1].':'.$reg[2] => 'N');
$type = 'sellist';
}
//
// TEST Value
//
// Use Validate class to allow external Modules to use data validation part instead of concentrate all test here (factoring) or just for reuse
$validate = new Validate($this->db, $langs);
// little trick : to perform tests with good performances sort tests by quick to low
//
// COMMON TESTS
//
// Required test and empty value
if ($required && !$validate->isNotEmptyString($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} elseif (!$required && !$validate->isNotEmptyString($fieldValue)) {
// if no value sent and the field is not mandatory, no need to perform tests
return true;
}
// MAX Size test
if (!empty($maxSize) && !$validate->isMaxLength($fieldValue, $maxSize)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
}
// MIN Size test
if (!empty($minSize) && !$validate->isMinLength($fieldValue, $minSize)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
}
//
// TESTS for TYPE
//
if (in_array($type, array('date', 'datetime', 'timestamp'))) {
if (!$validate->isTimestamp($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif ($type == 'duration') {
if (!$validate->isDuration($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif (in_array($type, array('double', 'real', 'price'))) {
// is numeric
if (!$validate->isDuration($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif ($type == 'boolean') {
if (!$validate->isBool($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif ($type == 'mail') {
if (!$validate->isEmail($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
}
} elseif ($type == 'url') {
if (!$validate->isUrl($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif ($type == 'phone') {
if (!$validate->isPhone($fieldValue)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif ($type == 'select' || $type == 'radio') {
if (!isset($param['options'][$fieldValue])) {
$this->error = $langs->trans('RequireValidValue');
return false;
} else { return true; }
} elseif ($type == 'sellist' || $type == 'chkbxlst') {
$param_list = array_keys($param['options']);
$InfoFieldList = explode(":", $param_list[0]);
$value_arr = explode(',', $fieldValue);
$value_arr = array_map(array($this->db, 'escape'), $value_arr);
$selectkey = "rowid";
if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) {
$selectkey = $InfoFieldList[2];
}
if (!isInDb($value_arr, $InfoFieldList[0], $selectkey)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
} elseif ($type == 'link') {
$param_list = array_keys($param['options']); // $param_list='ObjectName:classPath'
$InfoFieldList = explode(":", $param_list[0]);
$classname = $InfoFieldList[0];
$classpath = $InfoFieldList[1];
if (!$validate->isFetchable($fieldValue, $classname, $classpath)) {
$this->setFieldError($fieldKey, $validate->error);
return false;
} else { return true; }
}
// if no test failled all is ok
return true;
}
/**
* Function to show lines of extrafields with output datas.
@ -7920,7 +8170,7 @@ abstract class CommonObject
} else {
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
$return .= '<!-- Show thumb -->';
$return .= '<img class="photo photowithmargin maxwidth150onsmartphone" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
$return .= '<img class="photo photowithmargin maxwidth150onsmartphone maxwidth200" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
} else {
$return .= '<!-- Show original file -->';
$return .= '<img class="photo photowithmargin" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';

View File

@ -3928,13 +3928,16 @@ class Form
* @param int $maxlength Max length of label
* @param int $active Active or not, -1 = all
* @param string $morecss Add more CSS on select tag
* @param int $nooutput 1=Return string, do not send to output
* @return void
*/
public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '')
public function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '', $nooutput = 0)
{
// phpcs:enable
global $langs, $user, $conf;
$out = '';
dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
$filterarray = array();
@ -3953,9 +3956,9 @@ class Form
$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID;
}
print '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
if ($empty) {
print '<option value="">&nbsp;</option>';
$out .= '<option value="">&nbsp;</option>';
}
foreach ($this->cache_types_paiements as $id => $arraytypes) {
// If not good status
@ -3974,25 +3977,25 @@ class Form
}
if ($format == 0) {
print '<option value="'.$id.'"';
$out .= '<option value="'.$id.'"';
} elseif ($format == 1) {
print '<option value="'.$arraytypes['code'].'"';
$out .= '<option value="'.$arraytypes['code'].'"';
} elseif ($format == 2) {
print '<option value="'.$arraytypes['code'].'"';
$out .= '<option value="'.$arraytypes['code'].'"';
} elseif ($format == 3) {
print '<option value="'.$id.'"';
$out .= '<option value="'.$id.'"';
}
// Print attribute selected or not
if ($format == 1 || $format == 2) {
if ($selected == $arraytypes['code']) {
print ' selected';
$out .= ' selected';
}
} else {
if ($selected == $id) {
print ' selected';
$out .= ' selected';
}
}
print '>';
$out .= '>';
if ($format == 0) {
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 1) {
@ -4002,14 +4005,20 @@ class Form
} elseif ($format == 3) {
$value = $arraytypes['code'];
}
print $value ? $value : '&nbsp;';
print '</option>';
$out .= $value ? $value : '&nbsp;';
$out .= '</option>';
}
print '</select>';
$out .= '</select>';
if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
$out .= ajax_combobox('select'.$htmlname);
if (empty($nooutput)) {
print $out;
} else {
return $out;
}
print ajax_combobox('select'.$htmlname);
}

View File

@ -1077,7 +1077,7 @@ class FormCompany extends Form
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
$out .= '</form>';
} else {
if ($selected) {
if ($selected > 0) {
$arr = $this->typent_array(0);
$typent = $arr[$selected];
$out .= $typent;

View File

@ -272,7 +272,7 @@ class FormTicket
print '</td></tr>';
}
//Categories
// Categories
if ($conf->categorie->enabled) {
// Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
@ -441,6 +441,7 @@ class FormTicket
print '<tr><td>';
print $langs->trans("AssignedTo");
print '</td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers(GETPOST('fk_user_assign', 'int'), 'fk_user_assign', 1);
print '</td>';
print '</tr>';

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

@ -0,0 +1,309 @@
<?php
/* Copyright (C) 2021 John BOTELLA <john.botella@atm-consulting.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
* 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/core/class/validate.class.php
* \ingroup core
* \brief File for Utils class
*/
/**
* Class toolbox to validate values
*/
class Validate
{
/**
* @var DoliDb Database handler (result of a new DoliDB)
*/
public $db;
/**
* @var Translate $outputLang
*/
public $outputLang;
/**
* @var string Error string
* @see $errors
*/
public $error;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param Translate $outputLang output lang for error
* @return null
*/
public function __construct($db, $outputLang = false)
{
global $langs;
if ($outputLang) {
$this->outputLang = $langs;
} else {
$this->outputLang = $outputLang;
}
$outputLang->load('validate');
$this->db = $db;
}
/**
* Use to clear errors msg or other ghost vars
* @return null
*/
protected function clear()
{
$this->error = '';
}
/**
* Use to clear errors msg or other ghost vars
*
* @param string $errMsg your error message
* @return null
*/
protected function setError($errMsg)
{
$this->error = $errMsg;
}
/**
* Check for e-mail validity
*
* @param string $email e-mail address to validate
* @param int $maxLength string max length
* @return boolean Validity is ok or not
*/
public function isEmail($email, $maxLength = false)
{
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$this->error = $this->outputLang->trans('RequireValidEmail');
return false;
}
return true;
}
/**
* Check for price validity
*
* @param string $price Price to validate
* @return boolean Validity is ok or not
*/
public function isPrice($price)
{
if (!preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/ui', $price)) {
$this->error = $this->outputLang->trans('RequireValidValue');
return false;
}
return true;
}
/**
* Check for timestamp validity
*
* @param string|int $stamp timestamp to validate
* @return boolean Validity is ok or not
*/
public function isTimestamp($stamp)
{
if (!is_numeric($stamp) && (int) $stamp == $stamp) {
$this->error = $this->outputLang->trans('RequireValidDate');
return false;
}
return true;
}
/**
* Check for phone validity
*
* @param string $phone Phone string to validate
* @return boolean Validity is ok or not
*/
public function isPhone($phone)
{
if (!preg_match('/^[+0-9. ()-]*$/ui', $phone)) {
$this->error = $this->outputLang->trans('RequireValidPhone');
return false;
}
return true;
}
/**
* Check for string max length validity
*
* @param string $string to validate
* @param int $length max length
* @return boolean Validity is ok or not
*/
public function isMaxLength($string, $length)
{
if (strlen($string) > $length) {
$this->error = $this->outputLang->trans('RequireMaxLength', $length);
return false;
}
return true;
}
/**
* Check for string not empty
*
* @param string $string to validate
* @return boolean Validity is ok or not
*/
public function isNotEmptyString($string)
{
if (!strlen($string)) {
$this->error = $this->outputLang->trans('RequireANotEmptyValue');
return false;
}
return true;
}
/**
* Check for string min length validity
*
* @param string $string to validate
* @param int $length max length
* @return boolean Validity is ok or not
*/
public function isMinLength($string, $length)
{
if (!strlen($string) < $length) {
$this->error = $this->outputLang->trans('RequireMinLength', $length);
return false;
}
return true;
}
/**
* Check url validity
*
* @param string $url to validate
* @return boolean Validity is ok or not
*/
public function isUrl($url)
{
if (!filter_var($url, FILTER_VALIDATE_URL)) {
$this->error = $this->outputLang->trans('RequireValidUrl');
return false;
}
return true;
}
/**
* Check Duration validity
*
* @param string $duration to validate
* @return boolean Validity is ok or not
*/
public function isDuration($duration)
{
if (!is_int($duration) && $duration >= 0) {
$this->error = $this->outputLang->trans('RequireValidDuration');
return false;
}
return true;
}
/**
* Check for boolean validity
*
* @param boolean $bool Boolean to validate
* @return boolean Validity is ok or not
*/
public function isBool($bool)
{
if (!(is_null($bool) || is_bool($bool) || preg_match('/^[0|1]{1}$/ui', $bool))) {
$this->error = $this->outputLang->trans('RequireValidBool');
return false;
}
return true;
}
/**
* Check for all values in db
*
* @param array $values Boolean to validate
* @param string $table the db table name without MAIN_DB_PREFIX
* @param string $col the target col
* @return boolean Validity is ok or not
* @throws Exception
*/
public function isInDb($values, $table, $col)
{
if (!is_array($values)) {
$value_arr = array($values);
} else {
$value_arr = $values;
}
if (!count($value_arr)) {
$this->error = $this->outputLang->trans('RequireValue');
return false;
}
foreach ($value_arr as $val) {
$sql = 'SELECT ' . $col . ' FROM ' . MAIN_DB_PREFIX . $table . " WHERE " . $col ." = '" . $this->db->escape($val) . "'"; // nore quick than count(*) to check existing of a row
$resql = $this->db->getRow($sql);
if ($resql) {
continue;
} else {
$this->error = $this->outputLang->trans('RequireValidExistingElement');
return false;
}
}
return true;
}
/**
* Check for all values in db
*
* @param array $values Boolean to validate
* @param string $classname the class name
* @param string $classpath the class path
* @return boolean Validity is ok or not
* @throws Exception
*/
public function isFetchable($values, $classname, $classpath)
{
if (!empty($classpath)) {
if (dol_include_once($classpath)) {
if ($classname && class_exists($classname)) {
/** @var CommonObject $object */
$object = new $classname($this->db);
if (!is_callable(array($object, 'fetch')) || !is_callable(array($object, 'isExistingObject'))) {
$this->error = $this->outputLang->trans('BadSetupOfFieldFetchNotCallable');
return false;
}
if (!empty($object->table_element) && $object->isExistingObject($object->table_element, $values)) {
return true;
} else { $this->error = $this->outputLang->trans('RequireValidExistingElement'); }
} else { $this->error = $this->outputLang->trans('BadSetupOfFieldClassNotFoundForValidation'); }
} else { $this->error = $this->outputLang->trans('BadSetupOfFieldFileNotFound'); }
} else { $this->error = $this->outputLang->trans('BadSetupOfField'); }
return false;
}
}

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

@ -321,6 +321,7 @@ abstract class DoliDB implements Database
* Dont add LIMIT to your query, it will be added by this method
* @param string $sql the sql query string
* @return bool| object
* @deprecated
*/
public function getRow($sql)
{
@ -338,8 +339,9 @@ abstract class DoliDB implements Database
* return all results from query as an array of objects
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
* be carefull with this method use it only with some limit of results to avoid performences loss
* @param string $sql the sql query string
* @return bool| array
* @param string $sql the sql query string
* @return bool| array
* @deprecated
*/
public function getRows($sql)
{

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

@ -1766,7 +1766,7 @@ function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletef
*/
function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uploaded', $setsharekey = 0, $object = null)
{
global $db, $user;
global $db, $user, $conf;
$result = 0;
@ -1799,6 +1799,10 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
if (isset($object->src_object_keywords)) $ecmfile->keywords = $object->src_object_keywords;
}
if (!empty($conf->global->MAIN_FORCE_SHARING_ON_ANY_UPLOADED_FILE)) {
$setsharekey = 1;
}
if ($setsharekey) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
$ecmfile->share = getRandomPassword(true);

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') {
@ -9916,6 +9921,24 @@ function dolGetButtonTitleSeparator($moreClass = "")
return '<span class="button-title-separator '.$moreClass.'" ></span>';
}
/**
* get field error icon
*
* @param string $fieldValidationErrorMsg message to add in tooltip
* @return string html output
*/
function getFieldErrorIcon($fieldValidationErrorMsg)
{
$out = '';
if (!empty($fieldValidationErrorMsg)) {
$out.= '<span class="field-error-icon classfortooltip" title="'.dol_escape_htmltag($fieldValidationErrorMsg, 1).'" role="alert" >'; // role alert is used for accessibility
$out.= '<span class="fa fa-exclamation-circle" aria-hidden="true" ></span>'; // For accessibility icon is separated and aria-hidden
$out.= '</span>';
}
return $out;
}
/**
* Function dolGetButtonTitle : this kind of buttons are used in title in list
*

View File

@ -176,6 +176,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
}
$texttoinsert .= "),";
}
if ($val['validate']) {
$texttoinsert .= " 'validate'=>'".$val['validate']."',";
}
if ($val['comment']) {
$texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\"";
}

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

@ -266,6 +266,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/
public $always_enabled;
/**
* @var bool Module is disabled
*/
public $disabled;
/**
* @var int Module is enabled globally (Multicompany support)
*/
@ -1263,7 +1268,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if (is_array($this->boxes)) {
foreach ($this->boxes as $key => $value) {
//$titre = $this->boxes[$key][0];
$file = $this->boxes[$key]['file'];
if (empty($this->boxes[$key]['file'])) {
$file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : ''; // For backward compatibility
} else {
$file = $this->boxes[$key]['file'];
}
//$note = $this->boxes[$key][2];
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
@ -1276,10 +1286,6 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (empty($file)) {
$file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : ''; // For backward compatibility
}
if ($this->db->type == 'sqlite3') {
// sqlite doesn't support "USING" syntax.
// TODO: remove this dependency.

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);
@ -1408,20 +1408,24 @@ class pdf_einstein extends ModelePDFCommandes
$hautcadre = 40;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell(80, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
}
// 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);
@ -1462,11 +1466,13 @@ class pdf_einstein extends ModelePDFCommandes
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
@ -1594,20 +1594,24 @@ class pdf_eratosthene extends ModelePDFCommandes
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
}
// 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);
@ -1647,11 +1651,13 @@ class pdf_eratosthene extends ModelePDFCommandes
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
@ -685,19 +685,23 @@ class pdf_strato extends ModelePDFContract
$hautcadre = 40;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
}
// 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);
@ -738,11 +742,13 @@ class pdf_strato extends ModelePDFContract
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0, 0, 0);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0, 0, 0);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
@ -1086,21 +1086,25 @@ class pdf_espadon extends ModelePdfExpedition
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(255, 255, 255);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(255, 255, 255);
}
// 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);
@ -1139,11 +1143,13 @@ class pdf_espadon extends ModelePdfExpedition
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

View File

@ -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);
@ -1036,21 +1036,25 @@ class pdf_rouget extends ModelePdfExpedition
$widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(255, 255, 255);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, 'L');
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(255, 255, 255);
}
// 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);
@ -1089,11 +1093,13 @@ class pdf_rouget extends ModelePdfExpedition
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, 'L');
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
@ -1850,20 +1850,24 @@ class pdf_crabe extends ModelePDFFactures
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
}
// 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);
@ -1904,11 +1908,13 @@ class pdf_crabe extends ModelePDFFactures
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox - 2, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox - 2, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
@ -2088,20 +2088,24 @@ class pdf_sponge extends ModelePDFFactures
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillFrom"), 0, $ltrdirection);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0, 0, 60);
}
// 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);
@ -2141,11 +2145,13 @@ class pdf_sponge extends ModelePDFFactures
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox - 2, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->MultiCell($widthrecbox - 2, 5, $outputlangs->transnoentities("BillTo"), 0, $ltrdirection);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
@ -641,19 +641,23 @@ class pdf_soleil extends ModelePDFFicheinter
$hautcadre = 40;
// Show sender frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
if (empty($conf->global->MAIN_PDF_NO_SENDER_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx, $posy - 5);
$pdf->SetXY($posx, $posy);
$pdf->SetFillColor(230, 230, 230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
}
// 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);
@ -692,11 +696,13 @@ class pdf_soleil extends ModelePDFFicheinter
}
// Show recipient frame
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0, 0, 0);
if (empty($conf->global->MAIN_PDF_NO_RECIPENT_FRAME)) {
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
$pdf->SetTextColor(0, 0, 0);
}
// Show recipient name
$pdf->SetXY($posx + 2, $posy + 3);

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);
}
}

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