Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into
Browse files Browse the repository at this point in the history
develop_dict
  • Loading branch information
hregis committed Jun 12, 2017
2 parents 8b0354c + 3f06476 commit 773abff
Show file tree
Hide file tree
Showing 89 changed files with 1,221 additions and 659 deletions.
11 changes: 10 additions & 1 deletion htdocs/admin/dict.php
Expand Up @@ -503,6 +503,14 @@
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);


// Defaut sortorder
if (empty($sortfield))
{
$tmp1 = explode(',',$tabsqlsort[$id]);
$tmp2 = explode(' ',$tmp1[0]);
$sortfield=preg_replace('/^.*\./', '', $tmp2[0]);
}

// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList=array();
Expand Down Expand Up @@ -947,7 +955,8 @@

if (! preg_match('/ WHERE /',$sql)) $sql.= " WHERE 1 = 1";
if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id;
if ($search_code != '') $sql.= natural_search("code", $search_code);
if ($search_code != '' && $id != 9) $sql.= natural_search("code", $search_code);
if ($search_code != '' && $id == 9) $sql.= natural_search("code_iso", $search_code);

if ($sortfield)
{
Expand Down
28 changes: 14 additions & 14 deletions htdocs/blockedlog/admin/blockedlog.php
Expand Up @@ -101,20 +101,20 @@

print '</td></tr>';


// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>';
print '<td align="right" width="300">';
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_BLOCKEDLOG_AUTHORITY_URL">';
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';

if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>';
print '<td align="right" width="300">';
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_BLOCKEDLOG_AUTHORITY_URL">';
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
}

print '</table>';

Expand Down
61 changes: 56 additions & 5 deletions htdocs/blockedlog/admin/fingerprints.php
Expand Up @@ -74,7 +74,7 @@

print '<br>';

echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a> <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a></div>';
echo '<div align="right"><a href="?all=1">'.$langs->trans('ShowAllFingerPrintsMightBeTooLong').'</a> | <a href="?action=downloadblockchain">'.$langs->trans('DownloadBlockChain').'</a></div>';


print '<table class="noborder" width="100%">';
Expand All @@ -97,22 +97,71 @@
print '<td>'.dol_print_date($block->tms,'dayhour').'</td>';
print '<td>'.$block->ref_object.'</td>';
print '<td>'.$langs->trans('log'.$block->action).'</td>';
print '<td>'.$block->getObject().'</td>';
print '<td>'.$block->getObject().'<a href="#" blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
print '<td align="right">'.price($block->amounts).'</td>';
print '<td>'.$block->getUser().'</td>';
print '<td>'.$block->signature.'</td>';
print '<td>';

print $block->checkSignature() ? img_picto('OkCheckPaymentValidity', 'on') : img_picto($langs->trans('KoCheckPaymentValidity'), 'off');
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );

print $block->checkSignature() ? img_picto($langs->trans('OkCheckFingerprintValidity'), 'on') : img_picto($langs->trans('KoCheckFingerprintValidity'), 'off');
if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black') );
}
print '</td>';
print '</tr>';

}

print '</table>';

?>
<script type="text/javascript">
$('a[rel=show-info]').click(function() {

$pop = $('<div id="pop-info"><table width="100%" class="border"><thead><th width="25%"><?php echo $langs->trans('Field') ?></th><th><?php echo $langs->trans('Value') ?></th></thead><tbody></tbody></table></div>');

$pop.dialog({
title:"<?php echo $langs->trans('BlockedlogInfoDialog'); ?>"
,modal:true
,width:'80%'
});

var fk_block = $(this).attr("blockid");

$.ajax({
url:"../ajax/block-info.php?id="+fk_block
,dataType:'json'
}).done(function(data) {

drawData(data,'');

});

});

function drawData(data, prefix) {

for(x in data) {

value = data[x];

$('#pop-info table tbody').append('<tr><td>'+prefix+x+'</td><td>'+value+'</td></tr>');

if( (typeof value === "object") && (value !== null) ) {
drawData(value, prefix+x+' &gt;&gt; ');
}

}

}

</script>

<?php


if(!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {

?>
<script type="text/javascript">

Expand All @@ -134,6 +183,8 @@

<?php

}

dol_fiche_end();

print '<br><br>';
Expand Down
15 changes: 15 additions & 0 deletions htdocs/blockedlog/ajax/block-info.php
@@ -0,0 +1,15 @@
<?php

require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';

$id = GETPOST('id');

$block = new BlockedLog($db);
if($block->fetch($id)>0) {
echo json_encode($block->object_data);
}
else {
echo json_encode(false);
}

2 changes: 1 addition & 1 deletion htdocs/blockedlog/class/authority.class.php
Expand Up @@ -294,7 +294,7 @@ public function syncSignatureWithAuthority() {

//TODO create cron task on activation

if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) {
if(empty($conf->global->BLOCKEDLOG_AUTHORITY_URL) || empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
$this->error = $langs->trans('NoAuthorityURLDefined');
return -2;
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/cashdesk/affContenu.php
Expand Up @@ -34,16 +34,16 @@
// 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']);
$obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset($_SESSION['serObjFacturation']);
}
else
{
// ... sinon, c'est une nouvelle vente
$obj_facturation = new Facturation();
}


// $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']

Expand Down
26 changes: 17 additions & 9 deletions htdocs/cashdesk/class/Facturation.class.php
Expand Up @@ -99,17 +99,25 @@ public function ajoutArticle()
$product = new Product($db);
$product->fetch($this->id);


$vatrowid = $this->tva();

$tmp = getTaxesFromId($vatrowid);
$vat_rate = $tmp['rate'];
$txtva = $tmp['rate'].(empty($tmp['code'])?'':' ('.$tmp['code'].')');
$vat_npr = $tmp['npr'];

$localtaxarray = getLocalTaxesFromRate($vatrowid, 0, $societe, $mysoc, 1);


// Clean vat code
$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(), $vat_rate, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);
$resultarray=calcul_price_total($this->qte, $this->prix(), $this->remisePercent(), $txtva, -1, -1, 0, 'HT', $use_npr, $product->type, $mysoc, $localtaxarray);

// Calcul du total ht sans remise
$total_ht = $resultarray[0];
Expand All @@ -136,7 +144,7 @@ public function ajoutArticle()
$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]))
Expand All @@ -148,7 +156,7 @@ public function ajoutArticle()

$newcartarray[$i]['fk_article']=$this->id;
$newcartarray[$i]['qte']=$this->qte();
$newcartarray[$i]['fk_tva']=$this->tva();
$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');
Expand Down Expand Up @@ -220,7 +228,7 @@ public function calculTotaux()
$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 $this->prix_total_ttc.'eeee'; exit;
}
Expand Down
45 changes: 9 additions & 36 deletions htdocs/cashdesk/facturation.php
Expand Up @@ -35,7 +35,7 @@
$form=new Form($db);

// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
if ( GETPOST('filtre') ) {
if ( GETPOST('filtre','alpha') ) {

// Avec filtre
$ret=array(); $i=0;
Expand All @@ -47,22 +47,23 @@
$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 (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
if (! empty($conf->barcode->enabled)) {

$filtre = GETPOST('filtre');
$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)."%')";
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
} else {
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%')";
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%'";
}
}
else $sql.= ")";
$sql.= ")";
$sql.= " ORDER BY label";

dol_syslog("facturation.php", LOG_DEBUG);
Expand Down Expand Up @@ -154,34 +155,6 @@
$ret=array();
$i=0;

$sql = "SELECT t.rowid, t.taux";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t";
$sql.= ", ".MAIN_DB_PREFIX."c_country as c";
$sql.= " WHERE t.fk_pays = c.rowid";
$sql.= " AND t.active = 1";
$sql.= " AND c.code = '".$mysoc->country_code."'";
//print $sql;

$resql = $db->query($sql);
if ($resql)
{
while ( $tab = $db->fetch_array($resql) )
{
foreach ( $tab as $cle => $valeur )
{
$ret[$i][$cle] = $valeur;
}
$i++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
}
$tab_tva = $ret;


// Reinitialisation du mode de paiement, en cas de retour aux achats apres validation
$obj_facturation->getSetPaymentMode('RESET');
$obj_facturation->montantEncaisse('RESET');
Expand Down

0 comments on commit 773abff

Please sign in to comment.