Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
Darkjeff 2018-01-12 18:59:16 +01:00
commit 05d3b1bb5c
17 changed files with 97 additions and 49 deletions

View File

@ -648,7 +648,10 @@ if ($action == 'create')
print "</tr>\n";
}
if (price2num($total_debit) != price2num($total_credit))
$total_debit = price2num($total_debit);
$total_credit = price2num($total_credit);
if ($total_debit != $total_credit)
{
setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings');
}

View File

@ -88,7 +88,7 @@ class Subscription extends CommonObject
$sql.= " '".$this->db->escape($this->note)."')";
$resql = $this->db->query($sql);
if ($res===false) {
if (! $resql) {
$error++;
$this->errors[] = $this->db->lasterror();
}

View File

@ -398,6 +398,7 @@ class BlockedLog
$totalamount += $amount;
$tmpobject = null;
if ($this->element == 'payment_supplier')
{
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
@ -413,6 +414,10 @@ class BlockedLog
include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
$tmpobject = new Don($this->db);
}
if (! is_object($tmpobject))
{
continue;
}
$result = $tmpobject->fetch($objid);
if ($result <= 0)

View File

@ -443,6 +443,7 @@ if ($object->fetch($id) >= 0)
if ($page) $param.= "&amp;page=".$page;
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
// Ligne des champs de filtres
@ -590,6 +591,7 @@ if ($object->fetch($id) >= 0)
}
}
print "</table><br>";
print '</div>';
print '</form>';

View File

@ -143,8 +143,9 @@ $arrayfields=array(
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || ! empty($ref))?0:1), 'position'=>1000),
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
);
// Extra fields
@ -662,7 +663,7 @@ if ($resql)
print '<tr>';
print '<td>';
print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label","alpha").'">';
if ($options) {
if (is_array($options) && count($options)) {
print '<br>'.$langs->trans("Rubrique").': ';
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
}
@ -865,14 +866,21 @@ if ($resql)
print '<input type="text" class="flat" name="credit" size="4" value="'.dol_escape_htmltag($credit).'">';
print '</td>';
}
if (! empty($arrayfields['balancebefore']['checked']))
{
print '<td class="liste_titre" align="right">';
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print '</td>';
}
if (! empty($arrayfields['balance']['checked']))
{
print '<td class="liste_titre" align="right">';
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print '</td>';
print '<td class="liste_titre" align="right">';
$htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue"));
print $form->textwithpicto('', $htmltext, 1);
print '</td>';
}
// Numero statement
// Numero statement
if (! empty($arrayfields['b.num_releve']['checked']))
{
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="3"></td>';
@ -904,6 +912,7 @@ if ($resql)
if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['balancebefore']['checked'])) print_liste_field_titre($arrayfields['balancebefore']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder);
@ -929,7 +938,7 @@ if ($resql)
$objp = $db->fetch_object($resql);
// If we are in a situation where we need/can show balance, we calculate the start of balance
if (! $balancecalculated && ! empty($arrayfields['balance']['checked']) && $mode_balance_ok)
if (! $balancecalculated && (! empty($arrayfields['balancebefore']['checked']) || ! empty($arrayfields['balance']['checked'])) && $mode_balance_ok)
{
if (! $account)
{
@ -970,7 +979,7 @@ if ($resql)
$balancefieldfound=false;
foreach($arrayfields as $key => $val)
{
if ($key == 'balance')
if ($key == 'balancebefore' || $key == 'balance')
{
$balancefieldfound=true;
continue;
@ -1284,25 +1293,46 @@ if ($resql)
if (! $i) $totalarray['totalcredfield']=$totalarray['nbfield'];
}
// Balance before
if (! empty($arrayfields['balancebefore']['checked']))
{
if ($mode_balance_ok)
{
$balancebefore = price2num($balance - ($sign * $objp->amount),'MT');
if ($balancebefore >= 0)
{
print '<td align="right" class="nowrap">&nbsp;'.price($balancebefore).'</td>';
}
else
{
print '<td align="right" class="error nowrap">&nbsp;'.price($balancebefore).'</td>';
}
}
else
{
print '<td align="right">-</td>';
}
if (! $i) $totalarray['nbfield']++;
}
// Balance
if (! empty($arrayfields['balance']['checked']))
{
if ($mode_balance_ok)
{
if ($balance >= 0)
{
print '<td align="right" class="nowrap">&nbsp;'.price($balance).'</td>';
}
else
{
print '<td align="right" class="error nowrap">&nbsp;'.price($balance).'</td>';
}
}
else
{
print '<td align="right">-</td>';
}
if (! $i) $totalarray['nbfield']++;
if ($mode_balance_ok)
{
if ($balance >= 0)
{
print '<td align="right" class="nowrap">&nbsp;'.price($balance).'</td>';
}
else
{
print '<td align="right" class="error nowrap">&nbsp;'.price($balance).'</td>';
}
}
else
{
print '<td align="right">-</td>';
}
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['b.num_releve']['checked']))

View File

@ -444,7 +444,7 @@ class Invoices extends DolibarrApi
}
if($this->invoice->update($id, DolibarrApiAccess::$user))
return $this->get ($id);
return $this->get($id);
return false;
}

View File

@ -161,6 +161,7 @@ if ($object->id)
$modulepart = 'tax';
$permission = $user->rights->tax->charges->creer;
$permtoedit = $user->rights->fournisseur->facture->creer;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}

View File

@ -3524,7 +3524,7 @@ abstract class CommonObject
if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier')
{
print '<td class="linerefsupplier"><span id="title_fourn_ref">'.$langs->trans("SupplierProposalRefFourn").'</span></td>';
print '<td class="linerefsupplier"><span id="title_fourn_ref">'.$langs->trans("SupplierRef").'</span></td>';
}
// VAT

View File

@ -944,6 +944,7 @@ class FormFile
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
* @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
* @see list_of_autoecmfiles
*/
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0)
{
@ -1115,7 +1116,7 @@ class FormFile
// Preview link
if (! $editline) print $this->showPreview($file, $modulepart, $filepath);
// Public share link
if (! $editline && ! empty($filearray[$key]['hashp'])) print 'ee';
//if (! $editline && ! empty($filearray[$key]['hashp'])) print pictowithlinktodirectdownload;
print "</td>\n";
@ -1236,7 +1237,7 @@ class FormFile
print "</table>";
print '</div>';
if (! $editline && $nboflines > 1 && is_object($object)) {
if ($nboflines > 1 && is_object($object)) {
if (! empty($conf->use_javascript_ajax) && $permtoeditline) {
$table_element_line = 'ecm_files';
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
@ -1269,6 +1270,7 @@ class FormFile
* @param string $url Full url to use for click links ('' = autodetect)
* @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
* @see list_of_documents
*/
function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permtodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0)
{
@ -1475,7 +1477,8 @@ class FormFile
print dol_trunc($file['name'],$maxlength,'middle');
print '</a>';
print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
//print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print $this->showPreview($file, $modulepart, $file['relativename']);
print "</td>\n";
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
@ -1677,7 +1680,7 @@ class FormFile
/**
* Show detail icon with link for preview
*
* @param array $file File
* @param array $file Array with data of file. Example: array('name'=>...)
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $relativepath Relative path of docs
* @param string $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file)

View File

@ -159,7 +159,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
// if we're in a directory and we want recursive behavior, call this function again
if ($recursive)
{
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename?$relativename.'/':'').$file));
$file_list = array_merge($file_list, dol_dir_list($path."/".$file, $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder, $mode, $nohook, ($relativename!=''?$relativename.'/':'').$file));
}
}
else if (! $isdir && (($types == "files") || ($types == "all")))

View File

@ -62,7 +62,7 @@ $savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
{
//var_dump($modulepart);
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','project','project_task','expensereport')))
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','project','project_task','expensereport','tax')))
{
$savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
}
@ -87,7 +87,7 @@ $formfile->form_attach_new_file(
);
$disablemove=1;
if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product
if (in_array($modulepart, array('product', 'produit', 'societe', 'user'))) $disablemove=0; // Drag and drop for up and down allowed on product, thirdparty, ...
// List of document
$formfile->list_of_documents(

View File

@ -76,7 +76,7 @@ if ($nolinesbefore) {
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
?>
<td class="linecolrefsupplier" align="right"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierProposalRefFourn'); ?></span></td>
<td class="linecolrefsupplier" align="right"><span id="title_fourn_ref"><?php echo $langs->trans('SupplierRef'); ?></span></td>
<?php } ?>
<td class="linecolvat" align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
<td class="linecoluht" align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
@ -285,7 +285,7 @@ else {
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{
?>
<td class="nobottom linecolresupplier" align="right"><input id="fourn_ref" name="fourn_ref" class="flat" size="10" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td>
<td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref",'alpha',2):''); ?>"></td>
<?php } ?>
<td class="nobottom linecolvat" align="right"><?php

View File

@ -234,7 +234,7 @@ class PaymentDonation extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=null, $notrigger=0)
function update($user, $notrigger=0)
{
global $conf, $langs;
$error=0;

View File

@ -244,6 +244,8 @@ if ($object->id > 0)
print '</table>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();

View File

@ -1036,11 +1036,11 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
print '<tr><td colspan="2">';
print $table;
$sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
print $sql;
print '<!-- '.$sql.' -->';
if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed')
{
$resql = $db->query($sql);
print ' - Done ('.$resql.')';
print ' - Done ('.($resql?'OK':'KO').')';
}
else print ' - Disabled';
print '</td></tr>';

View File

@ -24,6 +24,7 @@ PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to
PaymentsNotLinkedToUser=Payments not linked to any user
Profit=Profit
AccountingResult=Accounting result
BalanceBefore=Balance (before)
Balance=Balance
Debit=Debit
Credit=Credit

View File

@ -470,14 +470,15 @@ class Productlot extends CommonObject
* Return a link to the a lot card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to
* @param integer $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @param string $morecss Add more css on link
* @return string String with URL
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to
* @param integer $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='', $save_lastsearch_value=-1)
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;