Merge remote-tracking branch 'Dolibarr/develop' into develop
This commit is contained in:
commit
7e169ae977
@ -7,6 +7,7 @@ For Users:
|
||||
NEW: Module Ticket is available as a stable module.
|
||||
NEW: Experimental module "Vendor receptions".
|
||||
NEW: Experimental module "BOM".
|
||||
FIX: Disallow line start date to be after end date
|
||||
|
||||
For Developers:
|
||||
NEW: Module DebugBar is available as a stable module.
|
||||
|
||||
@ -333,7 +333,7 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print '<td class="liste_titre"></td>';
|
||||
// Current account
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
|
||||
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
|
||||
$listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
|
||||
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
|
||||
print '</td>';
|
||||
@ -481,6 +481,14 @@ if ($result)
|
||||
});
|
||||
|
||||
init_savebutton();
|
||||
|
||||
jQuery("#search_current_account").keyup(function() {
|
||||
if (jQuery("#search_current_account").val() != \'\')
|
||||
{
|
||||
console.log("We set a value of account to search "+jQuery("#search_current_account").val()+", so we disable the other search criteria on account");
|
||||
jQuery("#search_current_account_valid").val(-1);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
@ -178,10 +178,9 @@ if ($action == 'confirm_collect')
|
||||
dol_include_once('/emailcollector/class/emailcollector.class.php');
|
||||
|
||||
$res = $object->doCollectOneCollector();
|
||||
|
||||
if ($res > 0)
|
||||
{
|
||||
setEventMessages($object->output, null, 'mesgs');
|
||||
setEventMessages($object->lastresult, null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -391,7 +390,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
|
||||
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
|
||||
|
||||
$connection = imap_open($connectstringsource, $object->user, $object->password);
|
||||
$connection = imap_open($connectstringsource, $object->login, $object->password);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -443,8 +442,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Add filter
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$arrayoftypes=array('from'=>'MailFrom', 'to'=>'MailTo', 'cc'=>'Cc', 'bcc'=>'Bcc', 'subject'=>'Subject', 'body'=>'Body', 'seen'=>'AlreadyRead', 'unseen'=>'NotRead', 'withtrackingid'=>'WithDolTrackingID', 'withouttrackingid'=>'WithoutDolTrackingID');
|
||||
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1);
|
||||
$arrayoftypes=array(
|
||||
'from'=>'MailFrom',
|
||||
'to'=>'MailTo',
|
||||
'cc'=>'Cc',
|
||||
'bcc'=>'Bcc',
|
||||
'subject'=>'Subject',
|
||||
'body'=>'Body',
|
||||
'X1'=>'---',
|
||||
'seen'=>'AlreadyRead',
|
||||
'unseen'=>'NotRead',
|
||||
'X2'=>'---',
|
||||
'withtrackingid'=>'WithDolTrackingID',
|
||||
'withouttrackingid'=>'WithoutDolTrackingID'
|
||||
);
|
||||
print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', '', 0, '', 2);
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="rulevalue">';
|
||||
print '</td>';
|
||||
@ -462,7 +474,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '</td>';
|
||||
print '<td>'.$rulefilter['rulevalue'].'</td>';
|
||||
print '<td class="right">';
|
||||
//print $rulefilterobj->getLibStatut(3);
|
||||
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deletefilter&filterid='.$rulefilter['id'].'">'.img_delete().'</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -51,48 +51,52 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$page_name = "ExportSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
|
||||
. $langs->trans("BackToModuleList") . '</a>';
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||
|
||||
// Configuration header
|
||||
//$head = export_admin_prepare_head();
|
||||
$h=0;
|
||||
$head = array();
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/export.php';
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$head[$h][2] = 'setup';
|
||||
$h++;
|
||||
|
||||
dol_fiche_head(
|
||||
$head,
|
||||
'settings',
|
||||
$langs->trans("ExportsArea"),
|
||||
0,
|
||||
"exports"
|
||||
);
|
||||
dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports");
|
||||
|
||||
// Setup page goes here
|
||||
$form=new Form($db);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("ExportModel").'</td>'."\n";
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="center" width="100"></td>'."\n";
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("set_EXPORTS_SHARE_MODELS").'</td>';
|
||||
print '<td>'.$langs->trans("EXPORTS_SHARE_MODELS").'</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="center" width="100">';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_EXPORTS_SHARE_MODELS">';
|
||||
echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
|
||||
print '</form>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -1625,7 +1625,7 @@ if ($action == 'create')
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
|
||||
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id');
|
||||
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
|
||||
@ -473,6 +473,12 @@ class Propal extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -666,7 +672,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
|
||||
{
|
||||
global $mysoc;
|
||||
global $mysoc, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
||||
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||
@ -684,6 +690,12 @@ class Propal extends CommonObject
|
||||
if (empty($qty) && empty($special_code)) $special_code=3; // Set option tag
|
||||
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
||||
if (empty($type)) $type=0;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT)
|
||||
{
|
||||
|
||||
@ -1367,6 +1367,12 @@ class Commande extends CommonOrder
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -2932,7 +2938,6 @@ class Commande extends CommonOrder
|
||||
|
||||
if ($this->statut == Propal::STATUS_DRAFT)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
if (empty($qty)) $qty=0;
|
||||
@ -2942,6 +2947,12 @@ class Commande extends CommonOrder
|
||||
if (empty($txlocaltax2)) $txlocaltax2=0;
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
if (empty($special_code) || $special_code == 3) $special_code=0;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$remise_percent=price2num($remise_percent);
|
||||
$qty=price2num($qty);
|
||||
@ -2951,6 +2962,8 @@ class Commande extends CommonOrder
|
||||
$txtva=price2num($txtva);
|
||||
$txlocaltax1=price2num($txlocaltax1);
|
||||
$txlocaltax2=price2num($txlocaltax2);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
|
||||
@ -2720,6 +2720,12 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -2923,6 +2929,12 @@ class Facture extends CommonInvoice
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
||||
@ -1374,7 +1374,6 @@ class Contrat extends CommonObject
|
||||
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
$pu_ht=price2num($pu_ht);
|
||||
@ -1394,7 +1393,7 @@ class Contrat extends CommonObject
|
||||
if (empty($txtva) || ! is_numeric($txtva)) $txtva=0;
|
||||
if (empty($txlocaltax1) || ! is_numeric($txlocaltax1)) $txlocaltax1=0;
|
||||
if (empty($txlocaltax2) || ! is_numeric($txlocaltax2)) $txlocaltax2=0;
|
||||
|
||||
|
||||
if ($price_base_type=='HT')
|
||||
{
|
||||
$pu=$pu_ht;
|
||||
@ -1406,6 +1405,14 @@ class Contrat extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if (empty($remise_percent)) $remise_percent=0;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||
|
||||
@ -1596,6 +1603,12 @@ class Contrat extends CommonObject
|
||||
{
|
||||
$remise_percent=0;
|
||||
}
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx, $localtax1tx, $localtax2tx, $price_base_type, $info_bits");
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
|
||||
// Ligne info remises tiers
|
||||
|
||||
@ -5841,10 +5841,10 @@ class Form
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $addjscombo Add js combo
|
||||
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
|
||||
* @param int $disablebademail Check if an email is found into value and if not disable and colorize entry
|
||||
* @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry
|
||||
* @param int $nohtmlescape No html escaping.
|
||||
* @return string HTML select string.
|
||||
* @see multiselectarray, selectArrayAjax, selectArrayFilter
|
||||
* @see multiselectarray(), selectArrayAjax(), selectArrayFilter()
|
||||
*/
|
||||
public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '', $addjscombo = 0, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0)
|
||||
{
|
||||
@ -5902,9 +5902,9 @@ class Form
|
||||
$disabled=''; $style='';
|
||||
if (! empty($disablebademail))
|
||||
{
|
||||
if (! preg_match('/<.+@.+>/', $value))
|
||||
if (($disablebademail == 1 && ! preg_match('/<.+@.+>/', $value))
|
||||
|| ($disablebademail == 2 && preg_match('/---/', $value)))
|
||||
{
|
||||
//$value=preg_replace('/'.preg_quote($a,'/').'/', $b, $value);
|
||||
$disabled=' disabled';
|
||||
$style=' class="warning"';
|
||||
}
|
||||
|
||||
@ -63,8 +63,8 @@ class FormOther
|
||||
* @param string $selected Id modele pre-selectionne
|
||||
* @param string $htmlname Nom de la zone select
|
||||
* @param string $type Type des modeles recherches
|
||||
* @param int $useempty Affiche valeur vide dans liste
|
||||
* @param int $fk_user Utilisateur créant le modèle
|
||||
* @param int $useempty Show an empty value in list
|
||||
* @param int $fk_user User that has created the template (this is set to null to get all export model when EXPORTS_SHARE_MODELS is on)
|
||||
* @return void
|
||||
*/
|
||||
public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null)
|
||||
@ -73,7 +73,7 @@ class FormOther
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."export_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user;
|
||||
if (!empty($fk_user)) $sql.=" AND fk_user IN (0, ".$fk_user.")"; // An export model
|
||||
$sql.= " ORDER BY rowid";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
|
||||
@ -8027,7 +8027,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
}
|
||||
|
||||
if ($displayMode === 2) {
|
||||
$return = $htmlImg .' '. $htmlLabel;
|
||||
$return = $htmlImg .' '. $htmlLabelShort;
|
||||
}
|
||||
elseif ($displayMode === 3) {
|
||||
$return = $htmlImg;
|
||||
|
||||
@ -1543,6 +1543,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
return -1;
|
||||
}
|
||||
if ($type < 0) return -1;
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
@ -2470,7 +2475,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
*/
|
||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
|
||||
{
|
||||
global $mysoc, $conf;
|
||||
global $mysoc, $conf, $langs;
|
||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
@ -2478,8 +2483,6 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
if ($this->brouillon)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
if (empty($qty)) $qty=0;
|
||||
if (empty($info_bits)) $info_bits=0;
|
||||
@ -2500,6 +2503,13 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
// Check parameters
|
||||
if ($type < 0) return -1;
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
|
||||
@ -1616,6 +1616,12 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||
}
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -1837,7 +1843,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
*/
|
||||
public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
|
||||
{
|
||||
global $mysoc;
|
||||
global $mysoc, $langs;
|
||||
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$notrigger,$date_start,$date_end,$fk_unit,$pu_ht_devise,$ref_supplier", LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
@ -1849,6 +1855,12 @@ class FactureFournisseur extends CommonInvoice
|
||||
// Check parameters
|
||||
//if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
|
||||
if ($type < 0) return -1;
|
||||
|
||||
if ($date_start && $date_end && $date_start > $date_end) {
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (empty($vatrate)) $vatrate=0;
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
-- Copyright (C) 2012 Sebastian Neuwert <sebastian.neuwert@modula71.de>
|
||||
-- Copyright (C) 2012 Ricardo Schluter <info@ripasch.nl>
|
||||
-- Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
-- Copyright (C) 2019~ Lao Tian <281388879@qq.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
|
||||
@ -352,3 +353,39 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (25
|
||||
-- Regions Slovenia (rowid country=202)
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ('202', '20203', 'SI03', NULL, 'East Slovenia');
|
||||
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ('202', '20204', 'SI04', NULL, 'West Slovenia');
|
||||
|
||||
-- Regions China (rowid country=9)
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,901, '京',0,'北京市');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,902, '津',0,'天津市');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,903, '沪',0,'上海市');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,904, '渝',0,'重庆市');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,905, '冀',0,'河北省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,906, '晋',0,'山西省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,907, '辽',0,'辽宁省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,908, '吉',0,'吉林省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,909, '黑',0,'黑龙江省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,910, '苏',0,'江苏省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,911, '浙',0,'浙江省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,912, '皖',0,'安徽省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,913, '闽',0,'福建省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,914, '赣',0,'江西省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,915, '鲁',0,'山东省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,916, '豫',0,'河南省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,917, '鄂',0,'湖北省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,918, '湘',0,'湖南省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,919, '粤',0,'广东省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,920, '琼',0,'海南省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,921, '川',0,'四川省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,922, '贵',0,'贵州省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,923, '云',0,'云南省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,924, '陕',0,'陕西省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,925, '甘',0,'甘肃省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,926, '青',0,'青海省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,927, '台',0,'台湾省');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,928, '蒙',0,'内蒙古自治区');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,929, '桂',0,'广西壮族自治区');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,930, '藏',0,'西藏自治区');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,931, '宁',0,'宁夏回族自治区');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,932, '新',0,'新疆维吾尔自治区');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,933, '港',0,'香港特别行政区');
|
||||
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,934, '澳',0,'澳门特别行政区');
|
||||
|
||||
@ -19,7 +19,7 @@ CREATE TABLE llx_emailcollector_emailcollectorfilter(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
fk_emailcollector INTEGER NOT NULL,
|
||||
type varchar(128) NOT NULL,
|
||||
rulevalue varchar(255) NULL,
|
||||
rulevalue varchar(128) NULL,
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
fk_user_creat integer NOT NULL,
|
||||
|
||||
@ -1837,7 +1837,7 @@ XEmailsDoneYActionsDone=%s emails qualified, %s emails successfully processed (f
|
||||
RecordEvent=Record email event
|
||||
CreateLeadAndThirdParty=Create lead (and third party if necessary)
|
||||
CodeLastResult=Result code of last collect
|
||||
NbOfEmailsInInbox=Number of email in source directory
|
||||
NbOfEmailsInInbox=Number of emails in source directory
|
||||
LoadThirdPartyFromName=Load third party from name (load only)
|
||||
LoadThirdPartyFromNameOrCreate=Load third party from name (create if not found)
|
||||
WithDolTrackingID=Dolibarr Tracking ID found
|
||||
@ -1848,7 +1848,6 @@ ECMAutoTree=Show automatic ECM tree
|
||||
OperationParamDesc=Define values to use for action, or how to extract values. For example:<br>VALUE:abc<br>REGEX:SUBJECT:([^\s]*)<br>REGEX:BODY:My company name is\s([^\s]*)
|
||||
OpeningHours=Opening hours
|
||||
OpeningHoursDesc=Enter here the regular opening hours of your company.
|
||||
##### Resource ####
|
||||
ResourceSetup=Configuration of Resource module
|
||||
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
||||
DisabledResourceLinkUser=Disable feature to link a resource to users
|
||||
@ -1871,4 +1870,6 @@ LogsLinesNumber=Number of lines to show on logs tab
|
||||
UseDebugBar=Use the debug bar
|
||||
DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console
|
||||
WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output
|
||||
DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface
|
||||
DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface
|
||||
EXPORTS_SHARE_MODELS=Export models are share with everybody
|
||||
ExportSetup=Setup of module Export
|
||||
@ -56,4 +56,7 @@ BillsCoinsPad=Bills and Coins Pad
|
||||
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
|
||||
TakeposNeedsCategories=TakePOS needs product categories to work
|
||||
OrderNotes=Order Notes
|
||||
AutoPrintTickets=Automatically print tickets
|
||||
CashDeskBankAccountFor=Default account to use for payments in
|
||||
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration
|
||||
TicketVatGrouped=Group VAT by rate in tickets
|
||||
AutoPrintTickets=Automatically print tickets
|
||||
@ -49,4 +49,7 @@ AmountAtEndOfPeriod=Montant en fin de période (jour, mois ou année)
|
||||
TheoricalAmount=Montant théorique
|
||||
RealAmount=Montant réel
|
||||
CashFenceDone=Clôture de caisse faite pour la période
|
||||
AutoPrintTickets=Imprimet les tickets automatiquement
|
||||
CashDeskBankAccountFor=Compte utilisé pour les paiements en
|
||||
NoPaimementModesDefined=Pas de mode de paiement défini dans la configuration de TakePOS
|
||||
TicketVatGrouped=Grouper la TVA par taux dans les tickets
|
||||
AutoPrintTickets=Imprimet les tickets automatiquement
|
||||
@ -378,7 +378,7 @@ class Project extends CommonObject
|
||||
if (file_exists($olddir))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
$res=dol_move($olddir, $newdir);
|
||||
$res=@rename($olddir, $newdir);
|
||||
if (! $res)
|
||||
{
|
||||
$langs->load("errors");
|
||||
|
||||
@ -932,12 +932,12 @@ if (empty($reshook))
|
||||
$object->setProject(GETPOST('projectid'), 'int');
|
||||
}
|
||||
|
||||
// Delai de livraison
|
||||
// Delivery delay
|
||||
elseif ($action == 'setavailability' && $user->rights->supplier_proposal->creer) {
|
||||
$result = $object->availability($_POST['availability_id']);
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
// Terms of payments
|
||||
elseif ($action == 'setconditions' && $user->rights->supplier_proposal->creer) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
}
|
||||
@ -950,7 +950,7 @@ if (empty($reshook))
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
// Mode de reglement
|
||||
// Payment mode
|
||||
elseif ($action == 'setmode' && $user->rights->supplier_proposal->creer) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
|
||||
@ -41,19 +41,38 @@ if (!$user->admin) accessforbidden();
|
||||
|
||||
$langs->loadLangs(array("admin", "cashdesk"));
|
||||
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND active = 1";
|
||||
$sql.= " ORDER BY libelle";
|
||||
$resql = $db->query($sql);
|
||||
$paiements = array();
|
||||
if($resql){
|
||||
while ($obj = $db->fetch_object($resql)){
|
||||
array_push($paiements, $obj);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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_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);
|
||||
foreach($paiements as $modep) {
|
||||
if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue;
|
||||
$name="CASHDESK_ID_BANKACCOUNT_".$modep->code;
|
||||
$res = dolibarr_set_const($db, $name, (GETPOST($name, 'alpha') > 0 ? GETPOST($name, '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);
|
||||
@ -61,6 +80,7 @@ if (GETPOST('action', 'alpha') == 'set')
|
||||
|
||||
$res = dolibarr_set_const($db, "TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
@ -154,6 +174,7 @@ if ($conf->global->TAKEPOSCONNECTOR){
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Bar Restaurant mode
|
||||
print '<tr class="oddeven"><td>';
|
||||
print 'Bar Restaurant';
|
||||
@ -175,6 +196,12 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOSCONNECTOR){
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('TicketVatGrouped');
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Payment numpad
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("Paymentnumpad");
|
||||
@ -233,27 +260,32 @@ 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 $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 '<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>';
|
||||
|
||||
foreach($paiements as $modep) {
|
||||
if (in_array($modep->code, array('LIQ', 'CB', 'CHQ'))) continue;
|
||||
$name="CASHDESK_ID_BANKACCOUNT_".$modep->code;
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->libelle).'</td>';
|
||||
print '<td colspan="2">';
|
||||
$cour=preg_match('/^LIQ.*/', $modep->code)?2:1;
|
||||
$form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->stock->enabled))
|
||||
|
||||
@ -16,10 +16,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
// if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
|
||||
// if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
|
||||
// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', '1'); }
|
||||
if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', '1'); }
|
||||
if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); }
|
||||
@ -47,17 +47,33 @@ $invoice = new Facture($db);
|
||||
$ret = $invoice->fetch('', '(PROV-POS-'.$place.')');
|
||||
if ($ret > 0) $placeid = $invoice->id;
|
||||
|
||||
$paycode = $pay;
|
||||
if ($pay == 'cash') $paycode = 'LIQ';
|
||||
if ($pay == 'card') $paycode = 'CB';
|
||||
if ($pay == 'cheque') $paycode = 'CHQ';
|
||||
|
||||
// Retrieve paiementid
|
||||
$sql = "SELECT id FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND code = '".$paycode."'";
|
||||
$resql = $db->query($sql);
|
||||
$codes = $db->fetch_array($resql);
|
||||
$paiementid=$codes[0];
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'valid' && $user->rights->facture->creer)
|
||||
{
|
||||
if ($pay == "cash") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
|
||||
if ($pay == "cash") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH;
|
||||
elseif ($pay == "card") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CB;
|
||||
elseif ($pay == "cheque") $bankaccount = $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE;
|
||||
|
||||
else
|
||||
{
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$pay;
|
||||
$bankaccount=$conf->global->$accountname;
|
||||
}
|
||||
$now=dol_now();
|
||||
|
||||
$invoice = new Facture($db);
|
||||
@ -72,12 +88,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
|
||||
$payment->bank_account = $bankaccount;
|
||||
$payment->amounts[$invoice->id] = $invoice->total_ttc;
|
||||
|
||||
if ($pay=="cash") $payment->paiementid = 4;
|
||||
elseif ($pay=="card") $payment->paiementid = 6;
|
||||
elseif ($pay=="cheque") $payment->paiementid = 7;
|
||||
$payment->num_payment = $invoice->ref;
|
||||
$payment->paiementid=$paiementid;
|
||||
$payment->num_paiement=$invoice->ref;
|
||||
|
||||
$payment->create($user);
|
||||
$payment->create($user);
|
||||
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
|
||||
|
||||
$invoice->set_paid($user);
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
|
||||
@ -50,6 +50,24 @@ else{
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
$langs->loadLangs(array("main", "bills", "cashdesk"));
|
||||
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND active = 1";
|
||||
$sql.= " ORDER BY libelle";
|
||||
$resql = $db->query($sql);
|
||||
$paiements = array();
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$paycode = $obj->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'CASH';
|
||||
if ($paycode == 'CB') $paycode = 'CB';
|
||||
if ($paycode == 'CHQ') $paycode = 'CHEQUE';
|
||||
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$paycode;
|
||||
if (! empty($conf->global->$accountname) && $conf->global->$accountname > 0) array_push($paiements, $obj);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<link rel="stylesheet" href="css/pos.css">
|
||||
<script>
|
||||
@ -64,7 +82,7 @@ $langs->loadLangs(array("main", "bills", "cashdesk"));
|
||||
else print 'received+=parseFloat(price);';
|
||||
?>
|
||||
$('#change1').html(parseFloat(received).toFixed(2));
|
||||
if (parseFloat(received)><?php echo $invoice->total_ttc;?>)
|
||||
if (parseFloat(received) > <?php echo $invoice->total_ttc;?>)
|
||||
{
|
||||
var change=parseFloat(parseFloat(received)-<?php echo $invoice->total_ttc;?>);
|
||||
$('#change2').html(change.toFixed(2));
|
||||
@ -79,10 +97,10 @@ $langs->loadLangs(array("main", "bills", "cashdesk"));
|
||||
}
|
||||
|
||||
function Validate(payment){
|
||||
parent.$("#poslines").load("invoice.php?place=<?php echo $place;?>&action=valid&pay="+payment, function() {
|
||||
parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
|
||||
parent.$.colorbox.close();
|
||||
});
|
||||
parent.$("#poslines").load("invoice.php?place=<?php echo $place;?>&action=valid&pay="+payment, function() {
|
||||
parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
|
||||
parent.$.colorbox.close();
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -105,25 +123,82 @@ $langs->loadLangs(array("main", "bills", "cashdesk"));
|
||||
|
||||
<div style="position:absolute; top:40%; left:5%; height:55%; width:91%;">
|
||||
<?php
|
||||
$action_buttons = array(
|
||||
array(
|
||||
"function" =>"reset()",
|
||||
"span" => "style='font-size: 150%;'",
|
||||
"text" => "C",
|
||||
),
|
||||
array(
|
||||
"function" => "parent.$.colorbox.close();",
|
||||
"span" => "id='printtext'",
|
||||
"text" => $langs->trans("GoBack"),
|
||||
),
|
||||
);
|
||||
$numpad=$conf->global->TAKEPOS_NUMPAD;
|
||||
?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "7"; else print "10";?>);"><?php if ($numpad==0) print "7"; else print "10";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "8"; else print "20";?>);"><?php if ($numpad==0) print "8"; else print "20";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "9"; else print "50";?>);"><?php if ($numpad==0) print "9"; else print "50";?></button>
|
||||
<button type="button" <?php if ($placeid==0) echo "disabled";?> class="calcbutton2" onclick="Validate('cash');"><?php echo $langs->trans("Cash"); ?></button>
|
||||
<?php if (count($paiements) > 0) {
|
||||
$paycode = $paiements[0]->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'cash';
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[0]->libelle); ?></button>
|
||||
<?php } else { ?>
|
||||
<button type="button" class="calcbutton2"><?php echo $langs->trans("NoPaimementModesDefined");?></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "4"; else print "1";?>);"><?php if ($numpad==0) print "4"; else print "1";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "5"; else print "2";?>);"><?php if ($numpad==0) print "5"; else print "2";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "6"; else print "5";?>);"><?php if ($numpad==0) print "6"; else print "5";?></button>
|
||||
<button type="button" <?php if ($placeid==0) echo "disabled";?> class="calcbutton2" onclick="Validate('card');"><?php echo $langs->trans("PaymentTypeCB"); ?></button>
|
||||
<?php if (count($paiements) > 1) {
|
||||
$paycode = $paiements[1]->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'cash';
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[1]->libelle); ?></button>
|
||||
<?php } else {
|
||||
$button = array_pop($action_buttons);
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "1"; else print "0.10";?>);"><?php if ($numpad==0) print "1"; else print "0.10";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "2"; else print "0.20";?>);"><?php if ($numpad==0) print "2"; else print "0.20";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "3"; else print "0.50";?>);"><?php if ($numpad==0) print "3"; else print "0.50";?></button>
|
||||
<button type="button" <?php if ($placeid==0) echo "disabled";?> class="calcbutton2" onclick="Validate('cheque');"><?php echo $langs->trans("Cheque"); ?></button>
|
||||
<?php if (count($paiements) > 2) {
|
||||
$paycode = $paiements[2]->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'cash';
|
||||
if ($paycode == 'CB') $paycode = 'card';
|
||||
if ($paycode == 'CHQ') $paycode = 'cheque';
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans($paiements[2]->libelle); ?></button>
|
||||
<?php } else { ?>
|
||||
<?php
|
||||
$button = array_pop($action_buttons);
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button>
|
||||
<?php } ?>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "0"; else print "0.01";?>);"><?php if ($numpad==0) print "0"; else print "0.01";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "'000'"; else print "0.02";?>);"><?php if ($numpad==0) print "000"; else print "0.02";?></button>
|
||||
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "'.'"; else print "0.05";?>);"><?php if ($numpad==0) print "."; else print "0.05";?></button>
|
||||
<button type="button" class="calcbutton3" onclick="reset();"><span style='font-size: 150%;'>C</span></button>
|
||||
<button type="button" class="calcbutton3" onclick="parent.$.colorbox.close();"><span id="printtext"><?php echo $langs->trans("GoBack"); ?></span></button>
|
||||
<?php
|
||||
$i=3;
|
||||
while($i < count($paiements)){
|
||||
?>
|
||||
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paiements[$i]->code); ?>');"><?php echo $langs->trans($paiements[$i]->libelle); ?></button>
|
||||
<?php
|
||||
$i=$i+1;
|
||||
}
|
||||
$class=($i==3)?"calcbutton3":"calcbutton2";
|
||||
foreach($action_buttons as $button){
|
||||
?>
|
||||
<button type="button" class="<?php echo $class;?>" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
@ -103,11 +103,32 @@ print $object->ref;
|
||||
<th class="right"><?php echo $langs->trans("TotalHT");?></th>
|
||||
<td class="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
|
||||
</tr>
|
||||
<?php if($conf->global->TAKEPOS_TICKET_VAT_GROUPPED):?>
|
||||
<?php
|
||||
$vat_groups = array();
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
if(!array_key_exists($line->tva_tx, $vat_groups)){
|
||||
$vat_groups[$line->tva_tx] = 0;
|
||||
}
|
||||
$vat_groups[$line->tva_tx] += $line->total_tva;
|
||||
}
|
||||
foreach($vat_groups as $key => $val){
|
||||
?>
|
||||
<tr>
|
||||
<th align="right"><?php echo $langs->trans("VAT").' '.vatrate($key, 1);?></th>
|
||||
<td align="right"><?php echo price($val, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<th class="right"><?php echo $langs->trans("TotalVAT").'</th><td class="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
|
||||
<th class="right"><?php echo $langs->trans("TotalVAT").'</th><td class="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
<tr>
|
||||
<th class="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
|
||||
<th class="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style="border-top-style: double;">
|
||||
|
||||
@ -449,8 +449,26 @@ $( document ).ready(function() {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
// TakePOS setup check
|
||||
if (empty($conf->global->CASHDESK_ID_THIRDPARTY) or empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) or empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB)) {
|
||||
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql.= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql.= " AND active = 1";
|
||||
$sql.= " ORDER BY libelle";
|
||||
$resql = $db->query($sql);
|
||||
$paiementsModes = array();
|
||||
if ($resql){
|
||||
while ($obj = $db->fetch_object($resql)){
|
||||
$paycode = $obj->code;
|
||||
if ($paycode == 'LIQ') $paycode = 'CASH';
|
||||
if ($paycode == 'CB') $paycode = 'CARD';
|
||||
if ($paycode == 'CHQ') $paycode = 'CHEQUE';
|
||||
|
||||
$accountname="CASHDESK_ID_BANKACCOUNT_".$paycode;
|
||||
if (! empty($conf->global->$accountname) && $conf->global->$accountname > 0) array_push($paiementsModes, $obj);
|
||||
}
|
||||
}
|
||||
if (empty($paiementsModes)) {
|
||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
|
||||
}
|
||||
if (count($maincategories)==0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user