Merge branch 'develop' into develop#1

This commit is contained in:
Laurent Destailleur 2021-08-18 00:37:23 +02:00 committed by GitHub
commit 3bc8a7345c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1898 changed files with 34111 additions and 11442 deletions

View File

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

View File

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

@ -3,6 +3,19 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
For developers:
---------------
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 *****
For users:

View File

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

View File

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

145
dev/tools/spider.php Normal file
View File

@ -0,0 +1,145 @@
#!/usr/bin/env php
<?php
/*
* 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 dev/tools/spider.php
* \brief Script to spider Dolibarr app.
*
* To use it:
* - Disable module "bookmark"
* - Exclude param optioncss, token, sortfield, sortorder
*/
$crawledLinks=array();
const MAX_DEPTH=2;
/**
* @param string $url URL
* @param string $depth Depth
* @return string String
*/
function followLink($url, $depth = 0)
{
global $crawledLinks;
$crawling=array();
if ($depth>MAX_DEPTH) {
echo "<div style='color:red;'>The Crawler is giving up!</div>";
return;
}
$options=array(
'http'=>array(
'method'=>"GET",
'user-agent'=>"gfgBot/0.1\n"
)
);
$context=stream_context_create($options);
$doc=new DomDocument();
@$doc->loadHTML(file_get_contents($url, false, $context));
$links=$doc->getElementsByTagName('a');
$pageTitle=getDocTitle($doc, $url);
$metaData=getDocMetaData($doc);
foreach ($links as $i) {
$link=$i->getAttribute('href');
if (ignoreLink($link)) continue;
$link=convertLink($url, $link);
if (!in_array($link, $crawledLinks)) {
$crawledLinks[]=$link;
$crawling[]=$link;
insertIntoDatabase($link, $pageTitle, $metaData, $depth);
}
}
foreach ($crawling as $crawlURL)
followLink($crawlURL, $depth+1);
}
/**
* @param string $site Site
* @param string $path Path
* @return string String
*/
function convertLink($site, $path)
{
if (substr_compare($path, "//", 0, 2)==0)
return parse_url($site)['scheme'].$path;
elseif (substr_compare($path, "http://", 0, 7)==0 or
substr_compare($path, "https://", 0, 8)==0 or
substr_compare($path, "www.", 0, 4)==0)
return $path;
else return $site.'/'.$path;
}
/**
* @param string $url URL
* @return boolean
*/
function ignoreLink($url)
{
return $url[0]=="#" or substr($url, 0, 11) == "javascript:";
}
/**
* @param string $link URL
* @param string $title Title
* @param string $metaData Array
* @param int $depth Depth
* @return void
*/
function insertIntoDatabase($link, $title, &$metaData, $depth)
{
//global $crawledLinks;
echo "Inserting new record {URL= ".$link.", Title = '$title', Description = '".$metaData['description']."', Keywords = ' ".$metaData['keywords']."'}<br/><br/><br/>";
//²$crawledLinks[]=$link;
}
/**
* @param string $doc Doc
* @param string $url URL
* @return string URL/Title
*/
function getDocTitle(&$doc, $url)
{
$titleNodes=$doc->getElementsByTagName('title');
if (count($titleNodes)==0 or !isset($titleNodes[0]->nodeValue))
return $url;
$title=str_replace('', '\n', $titleNodes[0]->nodeValue);
return (strlen($title)<1)?$url:$title;
}
/**
* @param string $doc Doc
* @return array Array
*/
function getDocMetaData(&$doc)
{
$metaData=array();
$metaNodes=$doc->getElementsByTagName('meta');
foreach ($metaNodes as $node)
$metaData[$node->getAttribute("name")] = $node->getAttribute("content");
if (!isset($metaData['description']))
$metaData['description']='No Description Available';
if (!isset($metaData['keywords'])) $metaData['keywords']='';
return array(
'keywords'=>str_replace('', '\n', $metaData['keywords']),
'description'=>str_replace('', '\n', $metaData['description'])
);
}
followLink("http://localhost/dolibarr_dev/htdocs");

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

@ -49,7 +49,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) {
accessforbidden();
}
if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
accessforbidden();
}

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

@ -226,6 +226,7 @@ if (empty($conf->cron->enabled)) {
// Get the max frequency of reminder
if ($job->id > 0) {
if ($job->status != $job::STATUS_ENABLED) {
$langs->load("cron");
print '<span class="opacitymedium warning">'.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).'</span>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL&amp;token='.newToken().'">'.img_picto($langs->trans('Enabled'), 'switch_on').'</a>';

View File

@ -101,8 +101,8 @@ print '<br>';
print $langs->trans("ClickToDialUrlDesc").'<br>';
print '<br>';
print '<span class="opacitymedium">';
print $langs->trans("Example").':<br>';
print 'http://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
print $langs->trans("Examples").':<br>';
print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__<br>';
print 'sip:__PHONETO__@my.sip.server';
print '</span>';

View File

@ -45,6 +45,11 @@ $arrayofparameters = array(
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
);
// To fix when dire does not exists
dol_mkdir($conf->dav->dir_output.'/temp');
dol_mkdir($conf->dav->dir_output.'/public');
dol_mkdir($conf->dav->dir_output.'/private');
/*
* Actions

View File

@ -202,7 +202,7 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
$tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
@ -294,7 +294,7 @@ $tabfield[3] = "code,libelle,country_id,country";
$tabfield[4] = "code,label";
$tabfield[5] = "code,label";
$tabfield[6] = "code,libelle,type,color,position";
$tabfield[7] = "code,libelle,country,accountancy_code,deductible";
$tabfield[7] = "code,libelle,country,accountancy_code";
$tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfield[9] = "code,label,unicode";
$tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
@ -340,7 +340,7 @@ $tabfieldvalue[3] = "code,libelle,country";
$tabfieldvalue[4] = "code,label";
$tabfieldvalue[5] = "code,label";
$tabfieldvalue[6] = "code,libelle,type,color,position";
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
$tabfieldvalue[7] = "code,libelle,country,accountancy_code";
$tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfieldvalue[9] = "code,label,unicode";
$tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
@ -386,7 +386,7 @@ $tabfieldinsert[3] = "code_region,nom,fk_pays";
$tabfieldinsert[4] = "code,label";
$tabfieldinsert[5] = "code,label";
$tabfieldinsert[6] = "code,libelle,type,color,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code";
$tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
$tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";

View File

@ -34,13 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Translations
$langs->loadLangs(array("admin", "eventorganization"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
@ -70,11 +66,21 @@ $setupnotempty = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
// Access control
if (empty($user->admin)) {
accessforbidden();
}
/*
* Actions
*/
if ($cancel) {
$action ='';
}
if ((float) DOL_VERSION >= 6) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
@ -207,7 +213,7 @@ if ($action == 'edit') {
print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {
@ -293,7 +299,9 @@ if ($action == 'edit') {
print '</table>';
print '<br><div class="center">';
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
@ -301,7 +309,7 @@ if ($action == 'edit') {
} else {
if (!empty($arrayofparameters)) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldcreate">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
foreach ($arrayofparameters as $constname => $val) {
if ($val['enabled']==1) {

View File

@ -274,147 +274,141 @@ print '</div>';
print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
print dol_get_fiche_end();
// End of page
llxFooter();
$db->close();
exit;
}
/*
* Documents models for Holidays
*/
print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', '');
// Defined model definition table
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
// Defined model definition table
$def = array();
$sql = "SELECT nom";
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE type = '".$db->escape($type)."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
}
} else {
dol_print_error($db);
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
clearstatcache();
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$realpath = $reldir."core/modules/holiday".$valdir;
$dir = dol_buildpath($realpath);
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$realpath = $reldir."core/modules/holiday".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
$modulequalified = 0;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
} else {
print $module->description;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
$modulequalified = 0;
}
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
$modulequalified = 0;
}
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) {
print $module->info($langs);
} else {
print $module->description;
}
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
// Default
print '<td class="center">';
if ($conf->global->HOLIDAY_ADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
@ -422,11 +416,11 @@ foreach ($dirmodels as $reldir) {
}
}
}
}
print '</table>';
print '</div>';
print "<br>";
print '</table>';
print '</div>';
print "<br>";
}
/*
@ -446,34 +440,118 @@ print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "</tr>\n";
$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach ($substitutionarray as $key => $val) {
$htmltext .= $key.'<br>';
/*var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
*/
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 1;
}
$htmltext .= '</i>';
if (!isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
$conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 1;
}
/*
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY);
var_dump($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY);
*/
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print '<br>';
$variablename = 'HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
// Set working days
print '<tr class="oddeven">';
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Monday"))."</td>";
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0);
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
}
print '</td></tr>'."\n";
print "</td>";
print "</tr>";
//Use draft Watermark
// Set working days
print '<tr class="oddeven">';
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Friday"))."</td>";
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0);
} else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
}
print "</td>";
print "</tr>";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n";
// Set working days
print '<tr class="oddeven">';
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Saturday"))."</td>";
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1);
} else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
}
print "</td>";
print "</tr>";
// Set working days
print '<tr class="oddeven">';
print "<td>".$langs->trans("XIsAUsualNonWorkingDay", $langs->transnoentitiesnoconv("Sunday"))."</td>";
print '<td class="center">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1);
} else {
if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_other&MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
}
print "</td>";
print "</tr>";
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach ($substitutionarray as $key => $val) {
$htmltext .= $key.'<br>';
}
$htmltext .= '</i>';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print '<br>';
$variablename = 'HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td></tr>'."\n";
//Use draft Watermark
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n";
}
print '</table>';
print '</div>';

View File

@ -82,7 +82,8 @@ print '<br><br>';
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
$setupcompanynotcomplete = 1;
}
print img_picto('', 'company', 'class="paddingright"').' '.$langs->trans("SetupDescription3", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit'), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
print '<br><br>'.$langs->trans("SetupDescription3b");
if (!empty($setupcompanynotcomplete)) {
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
@ -93,7 +94,8 @@ print '<br>';
print '<br>';
// Show info setup module
print img_picto('', 'cog', 'class="paddingright"').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
print '<br><br>'.$langs->trans("SetupDescription4b");
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
$langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');

View File

@ -230,6 +230,9 @@ if (!empty($conf->agenda->enabled)) {
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
}
if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToPartnership'));
}
$parameters = array('elementList'=>$elementList);
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks

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

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

View File

@ -95,7 +95,7 @@ print "<strong>PHP session.cookie_samesite</strong> = ".(ini_get('session.cookie
print "<strong>PHP open_basedir</strong> = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").' '.$_SERVER["DOCUMENT_ROOT"]).')</span>')."<br>\n";
print "<strong>PHP allow_url_fopen</strong> = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
print "<strong>PHP allow_url_include</strong> = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).' &nbsp; <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")</span><br>\n";
print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).' &nbsp; <span class="opacitymedium">'.$langs->trans("Deprecated")." (removed in PHP 5.4)</span><br>\n";
//print "<strong>PHP safe_mode</strong> = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).' &nbsp; <span class="opacitymedium">'.$langs->trans("Deprecated")." (removed in PHP 5.4)</span><br>\n";
print "<strong>PHP disable_functions</strong> = ";
$arrayoffunctionsdisabled = explode(',', ini_get('disable_functions'));
$arrayoffunctionstodisable = explode(',', 'pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals');
@ -249,7 +249,7 @@ if (empty($dolibarr_main_prod)) {
}
print '<br>';
print '<strong>$dolibarr_nocsrfcheck</strong>: '.$dolibarr_nocsrfcheck;
print '<strong>$dolibarr_nocsrfcheck</strong>: '.(empty($dolibarr_nocsrfcheck) ? '0' : $dolibarr_nocsrfcheck);
if (!empty($dolibarr_nocsrfcheck)) {
print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
}
@ -350,7 +350,7 @@ if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
print '<br><strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_SALT).'<br>';
} else {
print '<span class="opacitymedium">('.$langs->trans("Recommanded").': password_hash)</span>';
print '<span class="opacitymedium">('.$langs->trans("Recommended").': password_hash)</span>';
print '<br>';
}
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
@ -363,16 +363,19 @@ if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
}
print '<br>';
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Example").': static-ips-of-server - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span> &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': List of static IPs of server separated with coma - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
print '<br>';
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0 &nbsp; <span class="opacitymedium">('.$langs->trans("Recommanded").': 0)</span>' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)."<br>";
print '<strong>MAIN_ALLOW_SVG_FILES_AS_IMAGES</strong> = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 0)</span><br>';
print '<br>';
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommanded").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
print '<strong>MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE</strong> = '.(empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE).' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': 1)</span><br>';
print '<br>';
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommanded").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
print '<strong>MAIN_RESTRICTHTML_ONLY_VALID_HTML</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML)."<br>";
print '<br>';
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>' : $conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)."<br>";
print '<br>';
print '<strong>MAIN_EXEC_USE_POPEN</strong> = ';
@ -382,10 +385,14 @@ if (empty($conf->global->MAIN_EXEC_USE_POPEN)) {
print $conf->global->MAIN_EXEC_USE_POPEN;
}
if ($execmethod == 1) {
print ' &nbsp; <span class="opacitymedium">("exec" PHP method will be used for shell commands)</span>';
print '<span class="opacitymedium">, "exec" PHP method will be used for shell commands';
print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
print '</span>';
}
if ($execmethod == 2) {
print ' &nbsp; <span class="opacitymedium">("popen" PHP method will be used for shell commands)</span>';
print '<span class="opacitymedium">, "popen" PHP method will be used for shell commands';
print ' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 1)';
print '</span>';
}
print "<br>";
print '<br>';

View File

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

View File

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

View File

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

View File

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

View File

@ -72,10 +72,12 @@ function printDropdownBookmarksList()
// Url to go on create new bookmark page
$newbtn = '';
if (!empty($user->rights->bookmark->creer)) {
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$newbtn .= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
$newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) {
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$newbtn .= '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.dol_escape_htmltag($urltoadd).'" >';
$newbtn .= img_picto('', 'add', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
}
}
// Menu with list of bookmarks
@ -105,9 +107,11 @@ function printDropdownBookmarksList()
$searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
// Url to go on create new bookmark page
if (!empty($user->rights->bookmark->creer)) {
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$searchForm .= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) {
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$searchForm .= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
}
}
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -1,50 +0,0 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2009-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// This file initializes more variables to already initialized variables with main.inc.php
// So include of this file must be always done after include to main.inc.php
$conf_db_type = $dolibarr_main_db_type;
// Parametres de connexion a la base
$conf_db_host = $dolibarr_main_db_host;
$conf_db_user = $dolibarr_main_db_user;
$conf_db_pass = $dolibarr_main_db_pass;
$conf_db_base = $dolibarr_main_db_name;
// Identifiant unique correspondant au tiers generique pour la vente
$conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0);
// Identifiant unique correspondant a l'entrepot a utiliser
$conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0);
if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
$conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0.
}
// Identifiant unique correspondant au compte caisse / liquide
$conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0);
// Identifiant unique correspondant au compte cheque
$conf_fkaccount_cheque = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE : 0);
// Identifiant unique correspondant au compte cb
$conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CB"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CB : 0);
//var_dump($_SESSION);
// View parameters
$conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists
$conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -200,7 +200,8 @@ if ($id > 0 || $ref) {
//print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
// Status
/*

View File

@ -82,7 +82,8 @@ class BonPrelevement extends CommonObject
const STATUS_DRAFT = 0;
const STATUS_TRANSFERED = 1;
const STATUS_CREDITED = 2;
const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
/**
@ -2343,17 +2344,22 @@ class BonPrelevement extends CommonObject
//$langs->load("mymodule");
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('StatusWaiting');
$this->labelStatus[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans');
$this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('StatusWaiting');
$this->labelStatusShort[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans');
$this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited');
if ($this->type == 'bank-transfer') {
$this->labelStatus[self::STATUS_DEBITED] = $langs->trans('StatusDebited');
$this->labelStatusShort[self::STATUS_DEBITED] = $langs->trans('StatusDebited');
} else {
$this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited');
$this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited');
}
}
$statusType = 'status1';
if ($status == self::STATUS_TRANSFERED) {
$statusType = 'status3';
}
if ($status == self::STATUS_CREDITED) {
if ($status == self::STATUS_CREDITED || $status == self::STATUS_DEBITED) {
$statusType = 'status6';
}

View File

@ -31,6 +31,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
@ -135,6 +136,7 @@ if (empty($reshook)) {
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
$tva_static = new Tva($db);
$bankstatic = new Account($db);
$accountingjournal = new AccountingJournal($db);
@ -445,7 +447,13 @@ while ($i < min($num, $limit)) {
// Ref
if (!empty($arrayfields['t.rowid']['checked'])) {
print '<td>'.$tva_static->getNomUrl(1).'</td>';
print '<td>';
print $tva_static->getNomUrl(1);
$filename = dol_sanitizeFileName($tva_static->ref);
$filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id;
print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}

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

@ -111,6 +111,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
@ -216,6 +225,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

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

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@inodbox.com>
/* Copyright (C) 2011-2015 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2021 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
@ -47,6 +48,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$action = GETPOST('action', 'aZ09'); // set or del
$name = GETPOST('name', 'alpha');
$entity = GETPOST('entity', 'int');
$value = ((GETPOST('value', 'int') || GETPOST('value', 'int') == '0') ? GETPOST('value', 'int') : 1);
/*
@ -64,9 +67,6 @@ top_httphead();
// Registering the new value of constant
if (!empty($action) && !empty($name)) {
$entity = GETPOST('entity', 'int');
$value = (GETPOST('value') ?GETPOST('value') : 1);
if ($user->admin) {
if ($action == 'set') {
dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity);

View File

@ -531,7 +531,7 @@ abstract class CommonDocGenerator
$totalUp += $line->subprice * $line->qty;
}
// @GS: Calculate total up and total discount percentage
// Calculate total up and total discount percentage
// Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object)
$resarray['object_total_up'] = $totalUp;
$resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs);
@ -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
*/
@ -123,6 +128,10 @@ abstract class CommonObject
*/
protected $table_ref_field = '';
/**
* @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.
@ -3016,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';
@ -3028,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
@ -4111,7 +4124,7 @@ abstract class CommonObject
$sql .= " SET ".$fieldstatus." = ".((int) $status);
// If status = 1 = validated, update also fk_user_valid
if ($status == 1 && $elementTable == 'expensereport') {
$sql .= ", fk_user_valid = ".$user->id;
$sql .= ", fk_user_valid = ".((int) $user->id);
}
$sql .= " WHERE rowid=".((int) $elementId);
@ -4805,13 +4818,18 @@ abstract class CommonObject
if (!empty($this->lines)) {
foreach ($this->lines as $line) {
if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
$reshook = 0;
//if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
if (is_object($hookmanager)) { // Old code is commented on preceding line.
if (empty($line->fk_parent_line)) {
$parameters = array('line'=>$line, 'i'=>$i);
$action = '';
$hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} else {
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line);
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
} else {
}
if (empty($reshook)) {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);
}
@ -6407,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;
@ -6498,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];
@ -6964,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;
}
@ -7303,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.

View File

@ -958,7 +958,7 @@ class Form
if ($row['code_iso']) {
$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>';
if (empty($hideflags)) {
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"');
$tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);
$labeltoshow = $tmpflag.' '.$labeltoshow;
}
}
@ -969,7 +969,7 @@ class Form
$out .= '<option value="'.($usecodeaskey ? ($usecodeaskey == 'code2' ? $row['code_iso'] : $row['code_iso3']) : $row['rowid']).'" data-html="'.dol_escape_htmltag($labeltoshow).'" data-eec="'.((int) $row['eec']).'">';
}
$out .= $labeltoshow;
$out .= '</option>';
$out .= '</option>'."\n";
}
}
$out .= '</select>';
@ -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);
}
@ -4724,7 +4733,7 @@ class Form
$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
foreach ($formquestion as $key => $input) {
if (is_array($input) && !empty($input)) {
$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : '');
$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');

View File

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

@ -981,13 +981,15 @@ class FormFile
* You may want to call this into a div like this:
* print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>';
*
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $modulepart 'propal', 'facture', 'facture_fourn', ...
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
* @param string $filedir Full path to directory to scan
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @param string $morecss Add more css to the download picto
* @param string $allfiles 0=Only generated docs, 1=All files
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/
public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '')
public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '', $morecss = 'valignmiddle', $allfiles = 0)
{
global $conf, $langs;
@ -1005,12 +1007,11 @@ class FormFile
$entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default
}
// Get list of files starting with name of ref (but not followed by "-" to discard uploaded files and get only generated files)
// @todo Why not showing by default all files by just removing the '[^\-]+' at end of regex ?
if (!empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) {
$filterforfilesearch = preg_quote(basename($modulesubdir), '/');
// Get list of files starting with name of ref (Note: files with '^ref\.extension' are generated files, files with '^ref-...' are uploaded files)
if ($allfiles || !empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) {
$filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/');
} else {
$filterforfilesearch = preg_quote(basename($modulesubdir), '/').'[^\-]+';
$filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/').'\.';
}
$file_list = dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // We also discard .meta and .png preview
@ -1019,7 +1020,7 @@ class FormFile
$out .= '<!-- html.formfile::getDocumentsLink -->'."\n";
if (!empty($file_list)) {
$out = '<dl class="dropdown inline-block">
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignmiddle').'</a></dt>
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', $morecss).'</a></dt>
<dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
$tmpout = '';

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

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