Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-03-18 19:42:30 +01:00
commit d3e7d61bed
6 changed files with 143 additions and 55 deletions

View File

@ -267,33 +267,34 @@ abstract class CommonDocGenerator
$object->state = getState($object->state_code, 0);
}
$array_contact = array(
$array_key.'_fullname' => $object->getFullName($outputlangs, 1),
$array_key.'_lastname' => $object->lastname,
$array_key.'_firstname' => $object->firstname,
$array_key.'_address' => $object->address,
$array_key.'_zip' => $object->zip,
$array_key.'_town' => $object->town,
$array_key.'_state_id' => $object->state_id,
$array_key.'_state_code' => $object->state_code,
$array_key.'_state' => $object->state,
$array_key.'_country_id' => $object->country_id,
$array_key.'_country_code' => $object->country_code,
$array_key.'_country' => $object->country,
$array_key.'_poste' => $object->poste,
$array_key.'_socid' => $object->socid,
$array_key.'_statut' => $object->statut,
$array_key.'_code' => $object->code,
$array_key.'_email' => $object->email,
$array_key.'_jabberid' => $object->jabberid,
$array_key.'_phone_pro' => $object->phone_pro,
$array_key.'_phone_perso' => $object->phone_perso,
$array_key.'_phone_mobile' => $object->phone_mobile,
$array_key.'_fax' => $object->fax,
$array_key.'_birthday' => $object->birthday,
$array_key.'_default_lang' => $object->default_lang,
$array_key.'_note_public' => $object->note_public,
$array_key.'_note_private' => $object->note_private
$array_contact = array (
$array_key . '_fullname' => $object->getFullName($outputlangs, 1),
$array_key . '_lastname' => $object->lastname,
$array_key . '_firstname' => $object->firstname,
$array_key . '_address' => $object->address,
$array_key . '_zip' => $object->zip,
$array_key . '_town' => $object->town,
$array_key . '_state_id' => $object->state_id,
$array_key . '_state_code' => $object->state_code,
$array_key . '_state' => $object->state,
$array_key . '_country_id' => $object->country_id,
$array_key . '_country_code' => $object->country_code,
$array_key . '_country' => $object->country,
$array_key . '_poste' => $object->poste,
$array_key . '_socid' => $object->socid,
$array_key . '_statut' => $object->statut,
$array_key . '_code' => $object->code,
$array_key . '_email' => $object->email,
$array_key . '_jabberid' => $object->jabberid, // deprecated
$array_key . '_phone_pro' => $object->phone_pro,
$array_key . '_phone_perso' => $object->phone_perso,
$array_key . '_phone_mobile' => $object->phone_mobile,
$array_key . '_fax' => $object->fax,
$array_key . '_birthday' => $object->birthday,
$array_key . '_default_lang' => $object->default_lang,
$array_key . '_note_public' => $object->note_public,
$array_key . '_note_private' => $object->note_private,
$array_key . '_civility' => $object->civility,
);
// Retrieve extrafields

View File

@ -193,14 +193,20 @@ class modContrat extends DolibarrModules
'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
$keyforselect='contrat'; $keyforelement='contract'; $keyforaliasextra='coextra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$keyforselect='contratdet'; $keyforelement='contract_line'; $keyforaliasextra='codextra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contrat as co,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'contratdet as cod';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cod.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' WHERE co.fk_soc = s.rowid and co.rowid = cod.fk_contrat';
$this->export_sql_end[$r] .=' AND co.entity IN ('.getEntity('contract').')';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid';
$this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contrat as co ON co.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' INNER JOIN '.MAIN_DB_PREFIX.'contratdet as cod ON co.rowid = cod.fk_contrat';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (cod.fk_product = p.rowid)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contrat_extrafields as coextra on (co.rowid = coextra.fk_object)';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'contratdet_extrafields as codextra on (cod.rowid = codextra.fk_object)';
$this->export_sql_end[$r] .=' WHERE co.entity IN ('.getEntity('contract').')';
}

View File

@ -119,7 +119,7 @@ button.calcbutton2 {
width: calc(25% - 2px);
height: calc(25% - 2px);
font-weight: bold;
font-size: 8pt;
font-size: 10pt;
margin: 1px;
}
@ -159,6 +159,19 @@ button.actionbutton {
border-width: 0;
}
button.item_value {
background: #bbbbbb;
border: #000000 1px solid;
border-radius: 4px;
padding: 8px;
}
button.item_value.selected {
background: #ffffff;
color: #000000;
font-weight: bold;
}
div[aria-describedby="dialog-info"] button:before {
content: "\f788";
font-family: "Font Awesome 5 Free";

View File

@ -16,7 +16,7 @@
*/
/**
* \file htdocs/takepos/floors.php
* \file htdocs/takepos/freezone.php
* \ingroup takepos
* \brief Popup to enter a free line
*/
@ -32,6 +32,11 @@ if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
global $mysoc;
$langs->loadLangs(array("bills", "cashdesk"));
@ -44,6 +49,20 @@ if (empty($user->rights->takepos->run)) {
access_forbidden();
}
// get invoice
$invoice = new Facture($db);
if ($place > 0) {
$invoice->fetch($place);
} else {
$invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')');
}
// get default vat rate
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal'];
$soc = new Societe($db);
if ($invoice->socid > 0) $soc->fetch($invoice->socid);
else $soc->fetch($conf->global->$constforcompanyid);
$vatRateDefault = get_default_tva($mysoc, $soc);
/*
* View
@ -52,18 +71,34 @@ if (empty($user->rights->takepos->run)) {
$arrayofcss = array('/takepos/css/pos.css.php');
$arrayofjs = array();
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
?>
<script>
function Save(){
$.get( "invoice.php", { action: "<?php echo $action; ?>", place: "<?php echo $place; ?>", desc:$('#desc').val(), number:$('#number').val()} );
parent.$.colorbox.close();
}
var vatRate = '<?php echo dol_escape_js($vatRateDefault); ?>';
$( document ).ready(function() {
$('#desc').focus()
});
/**
* Apply new VAT rate
*
* @param {string} id VAT id
* @param {string} rate VAT rate
*/
function ApplyVATRate(id, rate) {
vatRate = rate;
jQuery('button.vat_rate').removeClass('selected');
jQuery('#vat_rate_' + id).addClass('selected');
}
/**
* Save (validate)
*/
function Save() {
$.get( "invoice.php", { action: "<?php echo $action; ?>", place: "<?php echo $place; ?>", desc:$('#desc').val(), number:$('#number').val(), tva_tx: vatRate} );
parent.$.colorbox.close();
}
$( document ).ready(function() {
$('#desc').focus()
});
</script>
</head>
<body>
@ -76,6 +111,21 @@ if ($action == "addnote") echo '<input type="hidden" id="number" name="number" v
?>
<input type="hidden" name="place" class="takepospay" value="<?php echo $place; ?>">
<input type="button" class="button takepospay clearboth" value="OK" onclick="Save();">
<?php
if ($action == 'freezone') {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
$form = new Form($db);
$num = $form->load_cache_vatrates("'" . $mysoc->country_code . "'");
if ($num > 0) {
print '<br><br>';
print $langs->trans('VAT') . ' : ';
foreach ($form->cache_vatrates as $rate) {
print '<button type="button" class="button item_value vat_rate' . ($rate['txtva'] == $vatRateDefault ? ' selected' : '') . '" id="vat_rate_' . $rate['rowid'] . '" onclick="ApplyVATRate(\'' . $rate['rowid'] . '\', \'' . $rate['txtva'] .'\');">' . $rate['txtva'] . ' %</button>';
}
}
}
?>
</center>
</body>

View File

@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
global $mysoc;
$langs->loadLangs(array("companies", "commercial", "bills", "cashdesk", "stocks"));
$id = GETPOST('id', 'int');
@ -333,7 +335,12 @@ if ($action == "freezone") {
$customer = new Societe($db);
$customer->fetch($invoice->socid);
$tva_tx = get_default_tva($mysoc, $customer);
$tva_tx = GETPOST('tva_tx', 'alpha');
if ($tva_tx != '') {
$tva_tx = price2num($tva_tx);
} else {
$tva_tx = get_default_tva($mysoc, $customer);
}
// Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);

View File

@ -77,6 +77,14 @@ $arrayofjs = array();
top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
$langs->loadLangs(array('main', 'bills', 'cashdesk'));
if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) {
$htmlReductionPercent = '<span class="fa fa-2x fa-percent"></span>';
$htmlReductionAmount = '<span class="fa fa-2x fa-money"></span>';
} else {
$htmlReductionPercent = $langs->trans('ReductionShort') . '<br>%';
$htmlReductionAmount = $langs->trans('ReductionShort') . '<br>' . $langs->trans('Amount');
}
?>
<link rel="stylesheet" href="css/pos.css.php">
</head>
@ -87,6 +95,9 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk'));
var reductionTotal = '';
var editAction = '';
var editNumber = '';
var htmlBtnOK = '<span style="font-size: 14pt;">OK</span>';
var htmlReductionPercent = '<?php echo dol_escape_js($htmlReductionPercent); ?>';
var htmlReductionAmount = '<?php echo dol_escape_js($htmlReductionAmount); ?>';
/**
* Reset values
@ -98,8 +109,8 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk'));
editAction = '';
editNumber = '';
jQuery('#reduction_total').val(reductionTotal);
jQuery("#reduction_type_percent").html('<span class="fa fa-2x fa-percent"></span>');
jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>');
jQuery("#reduction_type_percent").html(htmlReductionPercent);
jQuery('#reduction_type_amount').html(htmlReductionAmount);
}
/**
@ -128,14 +139,14 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk'));
}
if (editAction === 'p'){
jQuery('#reduction_type_percent').html('<span style="font-size: 14pt;">OK</span>');
jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>');
jQuery('#reduction_type_percent').html(htmlBtnOK);
jQuery('#reduction_type_amount').html(htmlReductionAmount);
} else if (editAction === 'a'){
jQuery('#reduction_type_amount').html('<span style="font-size: 14pt;">OK</span>');
jQuery("#reduction_type_percent").html('<span class="fa fa-2x fa-percent"></span>');
jQuery('#reduction_type_amount').html(htmlBtnOK);
jQuery("#reduction_type_percent").html(htmlReductionPercent);
} else {
jQuery('#reduction_type_percent').html('<span class="fa fa-2x fa-percent"></span>');
jQuery('#reduction_type_amount').html('<span class="fa fa-2x fa-money-bill-alt"></span>');
jQuery('#reduction_type_percent').html(htmlReductionPercent);
jQuery('#reduction_type_amount').html(htmlReductionAmount);
}
}
@ -202,11 +213,11 @@ $langs->loadLangs(array('main', 'bills', 'cashdesk'));
print '<button type="button" class="calcbutton" onclick="AddReduction(7);">7</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(8);">8</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(9);">9</button>';
print '<button type="button" class="calcbutton2" id="reduction_type_percent" onclick="Edit(\'p\');"><span class="fa fa-2x fa-percent"></span></button>';
print '<button type="button" class="calcbutton2" id="reduction_type_percent" onclick="Edit(\'p\');">' . $htmlReductionPercent . '</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(4);">4</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(5);">5</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(6);">6</button>';
print '<button type="button" class="calcbutton2" id="reduction_type_amount" onclick="Edit(\'a\');"><span class="fa fa-2x fa-money-bill-alt"></span></button>';
print '<button type="button" class="calcbutton2" id="reduction_type_amount" onclick="Edit(\'a\');">' . $htmlReductionAmount . '</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(1);">1</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(2);">2</button>';
print '<button type="button" class="calcbutton" onclick="AddReduction(3);">3</button>';