This commit is contained in:
florian HENRY 2017-09-18 11:36:45 +02:00
commit 31721165b5
30 changed files with 537 additions and 282 deletions

View File

@ -3,6 +3,7 @@
# \file build/makepack-dolibarrmodule.pl
# \brief Package builder (tgz, zip, rpm, deb, exe)
# \author (c)2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
# \contributor (c)2017 Nicolas ZABOURI <info@inovea-conseil.com>
#----------------------------------------------------------------------------
use Cwd;
@ -134,7 +135,15 @@ foreach my $PROJECT (@PROJECTLIST) {
# Get version $MAJOR, $MINOR and $BUILD
print "Version detected for module ".$PROJECT.": ";
$result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; }
$custom=false;
if (! $result) {
$result=open(IN,"<".$SOURCE."/htdocs/custom/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
if (! $result) {
die "Error: Can't open descriptor file ".$SOURCE."/htdocs/(or /htdocs/custom/)".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n";
}else{
$custom = true;
}
}
while(<IN>)
{
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
@ -294,8 +303,11 @@ foreach my $PROJECT (@PROJECTLIST) {
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
if($custom){
$ret=`cp -r $BUILDROOT/$PROJECTLC/htdocs/custom/* $BUILDROOT/$PROJECTLC/htdocs/.`;
}
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/Thumbs.db $BUILDROOT/$PROJECTLC/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/*/Thumbs.db`;
$ret=`rm -fr $BUILDROOT/$PROJECTLC/CVS* $BUILDROOT/$PROJECTLC/*/CVS* $BUILDROOT/$PROJECTLC/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/*/CVS*`;

View File

@ -68,6 +68,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
$sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
$sql.= " AND d.entity IN (".getEntity('adherent').")";
if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
$sql.= " ORDER BY d.rowid ASC";
@ -123,7 +124,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
{
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb=1; // Protection to avoid empty page
for($j=0;$j<$nb;$j++)
{
$arrayofmembers[]=array(

View File

@ -373,11 +373,12 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG
print '</td></tr>'."\n";
// AGENDA_DEFAULT_FILTER_STATUS
// TODO Remove to use the default generic feature
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2);
$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100');
print '</td></tr>'."\n";
// AGENDA_DEFAULT_VIEW

View File

@ -1082,7 +1082,7 @@ if ($action == 'create')
$disableedit=1;
$disablemove=1;
$disableremove=1;
$ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice
$ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
}
print "</table>\n";
@ -1493,7 +1493,7 @@ else
{
//$disableedit=1;
//$disablemove=1;
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice
$ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice
}
// Form to add new line
@ -1504,7 +1504,7 @@ else
$var = true;
// Add free products/services
$object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice
$object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -488,12 +488,12 @@ class Paiement extends CommonObject
/**
* Add a record into bank for payment with links between this bank record and invoices of payment.
* Add a record into bank for payment + links between this bank record and sources of payment.
* All payment properties (this->amount, this->amounts, ...) must have been set first like after a call to create().
*
* @param User $user Object of user making payment
* @param string $mode 'payment', 'payment_supplier'
* @param string $label Label to use in bank record
* @param string $label Label to use in bank record. Note: If label is '(WithdrawalPayment)', a third entry 'widthdraw' is added into bank_url.
* @param int $accountid Id of bank account to do link with
* @param string $emetteur_nom Name of transmitter
* @param string $emetteur_banque Name of bank
@ -577,10 +577,11 @@ class Paiement extends CommonObject
}
// Add link 'company' in bank_url between invoice and bank transaction (for each invoice concerned by payment)
if (! $error && $label != '(WithdrawalPayment)')
//if (! $error && $label != '(WithdrawalPayment)')
if (! $error)
{
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of.
foreach ($this->amounts as $key => $value) // We should have invoices always for same third party but we loop in case of.
{
if ($mode == 'payment')
{

View File

@ -51,6 +51,9 @@ if (! $sortfield) $sortfield="p.datec";
// Get supervariables
$statut = GETPOST('statut','int');
$search_ref = GETPOST('search_ref','alpha');
$search_amount = GETPOST('search_amount','alpha');
$bon=new BonPrelevement($db,"");
/*
@ -60,6 +63,7 @@ $search_ref = GETPOST('search_ref','alpha');
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$search_ref="";
$search_amount="";
}
@ -69,13 +73,12 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
llxHeader('',$langs->trans("WithdrawalsReceipts"));
$bon=new BonPrelevement($db,"");
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
$sql.= ", p.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE p.entity = ".$conf->entity;
if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
if ($search_amount) $sql.=natural_search("p.amount", $search_amount, 1);
$sql.= $db->order($sortfield,$sortorder);
@ -97,6 +100,8 @@ if ($result)
$urladd= "&amp;statut=".$statut;
$selectedfields='';
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -116,7 +121,9 @@ if ($result)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth100" name="search_amount" value="'. dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
@ -125,9 +132,11 @@ if ($result)
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"","","",'align="center"');
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"p.amount","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"","","",'align="right"',$sortfield,$sortorder);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print "</tr>\n";
while ($i < min($num,$limit))
@ -136,15 +145,18 @@ if ($result)
print '<tr class="oddeven"><td>';
print $bon->LibStatut($obj->statut,2);
print "&nbsp;";
print '<a href="card.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td align="right">';
print $bon->LibStatut($obj->statut, 3);
print '</td>';
print '<td align="right"></td>'."\n";
print "</tr>\n";
$i++;
}

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/compta/prelevement/card.php
* \ingroup prelevement
* \brief Fiche prelevement
* \brief Card of a direct debit
*/
require('../../main.inc.php');
@ -45,20 +45,24 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid','int');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='pl.fk_soc';
if (! $sortorder) $sortorder='DESC';
$object = new BonPrelevement($db,"");
/*
* Actions
@ -66,10 +70,9 @@ if (! $sortorder) $sortorder='DESC';
if ( $action == 'confirm_delete' )
{
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
$object->fetch($id, $ref);
$res=$bon->delete();
$res=$object->delete();
if ($res > 0)
{
header("Location: index.php");
@ -77,16 +80,16 @@ if ( $action == 'confirm_delete' )
}
}
// Seems to no be used and replaced with $action == 'infocredit
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
{
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
$object->fetch($id, $ref);
$res=$bon->set_credite();
$res=$object->set_credite();
if ($res >= 0)
{
header("Location: card.php?id=".$id);
exit;
exit;
}
}
@ -94,19 +97,18 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
$object->fetch($id, $ref);
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
/*
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $bon->ref)
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
{
$dir = $conf->prelevement->dir_output.'/receipts';
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
{
$bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
}
header("Location: card.php?id=".$id);
@ -118,7 +120,7 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
$mesg='BadFile';
}*/
$error = $bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
if ($error)
{
@ -127,13 +129,13 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
}
}
// Set direct debit order to credited, create payment and close invoices
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
{
$bon = new BonPrelevement($db,"");
$bon->fetch($id);
$object->fetch($id, $ref);
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
$error = $bon->set_infocredit($user, $dt);
$error = $object->set_infocredit($user, $dt);
if ($error)
{
@ -143,61 +145,66 @@ if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
}
/*
* View
*/
$bon = new BonPrelevement($db,"");
$form = new Form($db);
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($id > 0)
if ($id > 0 || $ref)
{
$bon->fetch($id);
$object->fetch($id, $ref);
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), '', 'payment');
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
if (GETPOST('error','alpha')!='')
{
print '<div class="error">'.$bon->getErrorString(GETPOST('error','alpha')).'</div>';
print '<div class="error">'.$object->getErrorString(GETPOST('error','alpha')).'</div>';
}
/*if ($action == 'credite')
{
print $form->formconfirm("card.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
}*/
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
//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>';
// Status
/*
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '<td>'.$object->getLibStatut(1).'</td>';
print '</tr>';
*/
if($bon->date_trans <> 0)
if($object->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
$muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
if($object->date_credit <> 0)
{
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print dol_print_date($object->date_credit,'day');
print '</td></tr>';
}
@ -205,19 +212,36 @@ if ($id > 0)
print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml';
$relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
print '</div>';
dol_fiche_end();
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
if (empty($object->date_trans) && $user->rights->prelevement->bons->send && $action=='settransmitted')
{
print '<form method="post" name="userfile" action="card.php?id='.$bon->id.'" enctype="multipart/form-data">';
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infotrans">';
print '<table class="border" width="100%">';
@ -227,7 +251,7 @@ if ($id > 0)
print $form->select_date('','','','','',"userfile",1,1);
print '</td></tr>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode",$bon->methodes_trans);
print $form->selectarray("methode",$object->methodes_trans);
print '</td></tr>';
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
@ -238,9 +262,9 @@ if ($id > 0)
print '</form>';
}
if (! empty($bon->date_trans) && $bon->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
if (! empty($object->date_trans) && $object->date_credit == 0 && $user->rights->prelevement->bons->credit && $action=='setcredited')
{
print '<form name="infocredit" method="post" action="card.php?id='.$bon->id.'">';
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="infocredit">';
print '<table class="border" width="100%">';
@ -261,17 +285,17 @@ if ($id > 0)
{
print "\n<div class=\"tabsAction\">\n";
if (empty($bon->date_trans) && $user->rights->prelevement->bons->send)
if (empty($object->date_trans) && $user->rights->prelevement->bons->send)
{
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$bon->id."\">".$langs->trans("SetToStatusSent")."</a>";
print "<a class=\"butAction\" href=\"card.php?action=settransmitted&id=".$object->id."\">".$langs->trans("SetToStatusSent")."</a>";
}
if (! empty($bon->date_trans) && $bon->date_credit == 0)
if (! empty($object->date_trans) && $object->date_credit == 0)
{
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$bon->id."\">".$langs->trans("ClassCredited")."</a>";
print "<a class=\"butAction\" href=\"card.php?action=setcredited&id=".$object->id."\">".$langs->trans("ClassCredited")."</a>";
}
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$bon->id."\">".$langs->trans("Delete")."</a>";
print "<a class=\"butActionDelete\" href=\"card.php?action=confirm_delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
print "</div>";
}
@ -293,7 +317,16 @@ if ($id > 0)
$sql.= " AND pl.fk_soc = s.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql);
@ -304,8 +337,9 @@ if ($id > 0)
$urladd = "&amp;id=".$id;
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
@ -363,12 +397,17 @@ if ($id > 0)
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>';
print '<td align="right">'.price($total)."</td>\n";
print '<td align="right">';
if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
print price($total);
print "</td>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
print '</div>';
$db->free($result);
}
else

View File

@ -38,6 +38,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
*/
class BonPrelevement extends CommonObject
{
public $element='widthdraw';
public $table_element='prelevement_bons';
public $picto = 'payment';
var $date_echeance;
var $raison_sociale;
var $reference_remise;
@ -263,10 +267,11 @@ class BonPrelevement extends CommonObject
/**
* Get object and lines from database
*
* @param int $rowid id of object to load
* @param int $rowid Id of object to load
* @param string $ref Ref of direct debit
* @return int >0 if OK, <0 if KO
*/
function fetch($rowid)
function fetch($rowid, $ref='')
{
global $conf;
@ -278,8 +283,9 @@ class BonPrelevement extends CommonObject
$sql.= ", p.fk_user_credit";
$sql.= ", p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE p.rowid = ".$rowid;
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " WHERE p.entity = ".$conf->entity;
if ($rowid > 0) $sql.= " AND p.rowid = ".$rowid;
else $sql.= " AND p.ref = '".$this->db->escape($ref)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result=$this->db->query($sql);
@ -321,7 +327,7 @@ class BonPrelevement extends CommonObject
}
/**
* Set credite and set status of linked invoices
* Set credite and set status of linked invoices. Still used ??
*
* @return int <0 if KO, >=0 if OK
*/
@ -345,7 +351,7 @@ class BonPrelevement extends CommonObject
$error++;
}
if ($error == 0)
if (! $error)
{
$facs = array();
$facs = $this->getListInvoices();
@ -361,9 +367,8 @@ class BonPrelevement extends CommonObject
}
}
if ($error == 0)
if (! $error)
{
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
$sql.= " SET statut = 2";
$sql.= " WHERE fk_prelevement_bons = ".$this->id;
@ -378,7 +383,7 @@ class BonPrelevement extends CommonObject
/*
* End of procedure
*/
if ($error == 0)
if (! $error)
{
$this->db->commit();
return 0;
@ -399,10 +404,10 @@ class BonPrelevement extends CommonObject
}
/**
* Set withdrawal to credited status
* Set direct debit order to "credited" status.
*
* @param User $user id of user
* @param int $date date of action
* @param User $user Id of user
* @param int $date date of action
* @return int >0 if OK, <0 if KO
*/
function set_infocredit($user, $date)
@ -436,49 +441,60 @@ class BonPrelevement extends CommonObject
$bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT;
$facs = array();
$amounts = array();
$amountsperthirdparty = array();
$facs = $this->getListInvoices(1);
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
$num=count($facs);
for ($i = 0; $i < $num; $i++)
{
$fac = new Facture($this->db);
$fac->fetch($facs[$i][0]);
$amounts[$fac->id] = $facs[$i][1];
$amountsperthirdparty[$fac->socid][$fac->id] = $facs[$i][1];
$totalpaye = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed();
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
if ($alreadypayed + $facs[$i][1] >= $fac->total_ttc) {
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
$result = $fac->set_paid($user);
}
}
$paiement = new Paiement($this->db);
$paiement->datepaye = $date ;
$paiement->amounts = $amounts;
$paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref ;
$paiement->id_prelevement = $this->id ;
// Make one payment per customer
foreach ($amountsperthirdparty as $thirdpartyid => $cursoramounts)
{
$paiement = new Paiement($this->db);
$paiement->datepaye = $date;
$paiement->amounts = $cursoramounts; // Array with detail of dispatching of payments for each invoice
$paiement->paiementid = 3; //
$paiement->num_paiement = $this->ref; // Set ref of direct debit note
$paiement->id_prelevement = $this->id;
$paiement_id = $paiement->create($user);
if ($paiement_id < 0)
{
dol_syslog(get_class($this)."::set_credite AddPayment Error");
$error++;
$paiement_id = $paiement->create($user);
if ($paiement_id < 0)
{
dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
$error++;
}
else
{
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'','');
if ($result < 0)
{
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error");
$error++;
}
}
//var_dump($paiement->amounts);
//var_dump($thirdpartyid);
//var_dump($cursoramounts);
}
else
{
$result=$paiement->addPaymentToBank($user,'payment','(WithdrawalPayment)',$bankaccount,'','');
if ($result < 0)
{
dol_syslog(get_class($this)."::set_credite AddPaymentToBank Error");
$error++;
}
}
// Update withdrawal line
// Update withdrawal line
// TODO: Translate to ligneprelevement.class.php
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
$sql.= " SET statut = 2";
@ -486,7 +502,7 @@ class BonPrelevement extends CommonObject
if (! $this->db->query($sql))
{
dol_syslog(get_class($this)."::set_credite Update lines Error");
dol_syslog(get_class($this)."::set_infocredit Update lines Error");
$error++;
}
@ -951,14 +967,14 @@ class BonPrelevement extends CommonObject
}
}
/*
* Create withdrawal receipt
*/
if (!$error)
{
if (count($factures_prev) > 0)
/*
* Create withdrawal receipt in database
*/
if (count($factures_prev) > 0)
{
foreach ($factures_prev as $fac)
foreach ($factures_prev as $fac) // Add a link in database for each invoice
{
// Fetch invoice
$fact = new Facture($this->db);
@ -998,7 +1014,6 @@ class BonPrelevement extends CommonObject
}
}
}
}
@ -1006,11 +1021,12 @@ class BonPrelevement extends CommonObject
if (!$error)
{
/*
* Withdraw receipt
* Create direct debit order in a XML file
*/
dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG);
if (count($factures_prev) > 0)
{
$this->date_echeance = $datetimeprev;
@ -1034,11 +1050,12 @@ class BonPrelevement extends CommonObject
$this->factures = $factures_prev_id;
// Generation of SEPA file
// Generation of SEPA file $this->filename
$this->generate();
}
dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG);
}
//var_dump($factures_prev);exit;
/*
* Update total
@ -1289,8 +1306,9 @@ class BonPrelevement extends CommonObject
$sql.= " AND soc.rowid = f.fk_soc";
$sql.= " AND rib.fk_soc = f.fk_soc";
$sql.= " AND rib.default_rib = 1";
//print $sql;
//echo $sql;
// Define $fileDebiteurSection. One section DrctDbtTxInf per invoice.
$resql=$this->db->query($sql);
if ($resql)
{
@ -1302,27 +1320,26 @@ class BonPrelevement extends CommonObject
$this->total = $this->total + $obj->somme;
$i++;
}
$nbtotalDrctDbtTxInf = $i;
}
else
{
fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
$result = -2;
}
/*
* section Emetteur(sepa Emetteur bloc lines)
*/
// Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf
if ($result != -2)
{
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf);
}
else
{
fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company
}
/**
* SECTION CREATION FICHIER SEPA
* SECTION CREATION SEPA FILE
*/
// SEPA File Header
fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
@ -1819,11 +1836,11 @@ class BonPrelevement extends CommonObject
}
/**
* Return status label for a status
* Return status label for a status
*
* @param int $statut id statut
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return string Label
* @param int $statut id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label
*/
function LibStatut($statut,$mode=0)
{
@ -1846,8 +1863,25 @@ class BonPrelevement extends CommonObject
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans($this->labelstatut[$statut]),'statut1').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==1) return img_picto($langs->trans($this->labelstatut[$statut]),'statut3').' '.$langs->trans($this->labelstatut[$statut]);
if ($statut==2) return img_picto($langs->trans($this->labelstatut[$statut]),'statut6').' '.$langs->trans($this->labelstatut[$statut]);
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');
if ($statut==2) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut6');
}
if ($mode == 6)
{
if ($statut==0) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut1');
if ($statut==1) return $langs->trans($this->labelstatut[$statut]).' '.img_picto($langs->trans($this->labelstatut[$statut]),'statut3');

View File

@ -67,7 +67,7 @@ if ($action == 'create')
{
setEventMessages($bprev->error, $bprev->errors, 'errors');
}
if ($result == 0)
elseif ($result == 0)
{
$mesg='';
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
@ -78,6 +78,10 @@ if ($action == 'create')
$mesg.=$val."<br>\n";
}
}
else
{
setEventMessages($langs->trans("DirectDebitOrderCreated"), null);
}
}

View File

@ -43,6 +43,7 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id','int');
$socid = GETPOST('socid','int');
$ref = GETPOST('ref', 'alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
@ -55,6 +56,9 @@ $pagenext = $page + 1;
if (! $sortfield) $sortfield='p.ref';
if (! $sortorder) $sortorder='DESC';
$object = new BonPrelevement($db,"");
/*
* View
@ -65,39 +69,41 @@ $thirdpartytmp = new Societe($db);
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
if ($prev_id > 0 || $ref)
{
$bon = new BonPrelevement($db,"");
if ($bon->fetch($prev_id) == 0)
if ($object->fetch($prev_id, $ref) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), '', 'payment');
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
//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>';
// Status
print '<tr><td>'.$langs->trans('Status').'</td><td>'.$bon->getLibStatut(1).'</td></tr>';
//print '<tr><td>'.$langs->trans('Status').'</td><td>'.$object->getLibStatut(1).'</td></tr>';
if($bon->date_trans <> 0)
if($object->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
$muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
if($object->date_credit <> 0)
{
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print dol_print_date($object->date_credit,'day');
print '</td></tr>';
}
@ -105,12 +111,29 @@ if ($prev_id)
print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml';
$relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
print '</div>';
dol_fiche_end();
}
@ -137,7 +160,6 @@ $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity = ".$conf->entity;
if ($prev_id) $sql.= " AND p.rowid=".$prev_id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records
@ -172,9 +194,10 @@ if ($result)
$massactionbutton='';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print_barre_liste($langs->trans("Invoices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder);
@ -243,13 +266,18 @@ if ($result)
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>';
print '<td align="right">'.price($total)."</td>\n";
print '<td align="right">';
if ($total != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
print price($total);
print "</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
print '</div>';
$db->free($result);
}
else

View File

@ -41,49 +41,69 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$object = new BonPrelevement($db,"");
/*
* View
*/
llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
if ($prev_id > 0 || $ref)
{
$bon = new BonPrelevement($db,"");
if ($bon->fetch($prev_id) == 0)
if ($object->fetch($prev_id, $ref) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), '', 'payment');
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
print '<table class="border" width="100%">';
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'."\n";
//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>';
// Status
/*
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '<td>'.$object->getLibStatut(1).'</td>';
print '</tr>';
*/
if($bon->date_trans <> 0)
if($object->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
$muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
if($object->date_credit <> 0)
{
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print dol_print_date($object->date_credit,'day');
print '</td></tr>';
}
@ -91,12 +111,29 @@ if ($prev_id)
print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml';
$relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
print '</div>';
dol_fiche_end();
}
@ -109,7 +146,7 @@ if ($prev_id)
$rej = new RejetPrelevement($db, $user);
/*
* Liste des factures
* List errors
*/
$sql = "SELECT pl.rowid, pl.amount, pl.statut";
$sql.= " , s.rowid as socid, s.nom as name";
@ -127,12 +164,25 @@ $sql.= " AND pr.fk_prelevement_lignes = pl.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= " ORDER BY pl.amount DESC";
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
print_barre_liste($langs->trans("Rejects"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td align="right">'.$langs->trans("Amount").'</td>';
@ -146,32 +196,32 @@ if ($resql)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print img_picto('', 'statut'.$obj->statut).' ';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
print '<td align="right">'.price($obj->amount)."</td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print '<td align="center">'.yn($obj->afacturer).'</td>';
print '<td align="center">'.$obj->fk_facture.'</td>';
print "</tr>\n";
$total += $obj->amount;
$i++;
}
}
else
{
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
if ($num > 0)
{
print '<tr class="liste_total"><td>&nbsp;</td>';
@ -181,6 +231,8 @@ if ($resql)
print "</tr>\n";
}
print "</table>\n";
print '</div>';
$db->free($resql);
}
else

View File

@ -38,7 +38,21 @@ if ($user->societe_id > 0) accessforbidden();
// Get supervariables
$prev_id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$object = new BonPrelevement($db,"");
/*
* View
@ -48,40 +62,44 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
if ($prev_id)
{
$bon = new BonPrelevement($db,"");
if ($bon->fetch($prev_id) == 0)
if ($object->fetch($prev_id) == 0)
{
$head = prelevement_prepare_head($bon);
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), '', 'payment');
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
print '<table class="border" width="100%">';
dol_banner_tab($object, 'ref', '', 1, 'ref', 'ref');
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("Date").'</td><td>'.dol_print_date($bon->datec,'day').'</td></tr>';
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($bon->amount).'</td></tr>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'."\n";
//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>';
// Status
/*
print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$bon->getLibStatut(1).'</td>';
print '<td>'.$object->getLibStatut(1).'</td>';
print '</tr>';
*/
if($bon->date_trans <> 0)
if($object->date_trans <> 0)
{
$muser = new User($db);
$muser->fetch($bon->user_trans);
$muser->fetch($object->user_trans);
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
print dol_print_date($bon->date_trans,'day');
print dol_print_date($object->date_trans,'day');
print ' '.$langs->trans("By").' '.$muser->getFullName($langs).'</td></tr>';
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
print $bon->methodes_trans[$bon->method_trans];
print $object->methodes_trans[$object->method_trans];
print '</td></tr>';
}
if($bon->date_credit <> 0)
if($object->date_credit <> 0)
{
print '<tr><td>'.$langs->trans('CreditDate').'</td><td>';
print dol_print_date($bon->date_credit,'day');
print dol_print_date($object->date_credit,'day');
print '</td></tr>';
}
@ -89,12 +107,29 @@ if ($prev_id)
print '<br>';
print '<table class="border" width="100%"><tr><td class="titlefield">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$acc = new Account($db);
$result=$acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT);
print '<tr><td class="titlefield">';
print $langs->trans("BankToReceiveWithdraw");
print '</td>';
print '<td>';
if ($acc->id > 0)
print $acc->getNomUrl(1);
print '</td>';
print '</tr>';
print '<tr><td class="titlefield">';
print $langs->trans("WithdrawalFile").'</td><td>';
$relativepath = 'receipts/'.$bon->ref.'.xml';
$relativepath = 'receipts/'.$object->ref.'.xml';
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&amp;modulepart=prelevement&amp;file='.urlencode($relativepath).'">'.$relativepath.'</a>';
print '</td></tr></table>';
print '</div>';
dol_fiche_end();
}
@ -121,7 +156,7 @@ if ($prev_id)
$i = 0;
print load_fiche_titre($langs->trans("StatisticsByLineStatus"),'','');
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
@ -139,12 +174,12 @@ if ($prev_id)
print price($row[0]);
print '</td><td align="right">';
if ($bon->amount) print round($row[0]/$bon->amount*100,2)." %";
if ($object->amount) print round($row[0]/$object->amount*100,2)." %";
print '</td>';
print "</tr>\n";
$i++;
}

View File

@ -51,7 +51,7 @@ if (! $error && count($toselect) > $maxformassaction)
$error++;
}
if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form
if (! $error && $massaction == 'confirm_presend' && ! GETPOST('sendmail')) // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form
{
$massaction='presend';
}
@ -407,6 +407,12 @@ if (! $error && $massaction == 'confirm_presend')
if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search'))
{
if (empty($diroutputmassaction))
{
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
exit;
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -502,7 +508,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
}
else {
// Create empty PDF
$pdf=pdf_getInstance();
$formatarray=pdf_getFormat();
$page_largeur = $formatarray['width'];
$page_hauteur = $formatarray['height'];
$format = array($page_largeur,$page_hauteur);
$pdf=pdf_getInstance($format);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);

View File

@ -351,7 +351,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
'__EMAIL__' => $sendto,
'__CHECK_READ__' => (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'',
'__REF__' => (is_object($object)?$object->ref:''),
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?dol_string_nohtmltag($user->signature):'')
'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:'')
/* not available on all object
/'__FIRSTNAME__'=>(is_object($object)?$object->firstname:''),
'__LASTNAME__'=>(is_object($object)?$object->lastname:''),

View File

@ -77,7 +77,6 @@ class box_activity extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$totalMnt = 0;
$totalnb = 0;
$line = 0;
$cachetime = 3600;
@ -95,8 +94,6 @@ class box_activity extends ModeleBoxes
// compute the year limit to show
$tmpdate= dol_time_plus_duree(dol_now(), -1*$nbofperiod, "m");
$cumuldata = array();
// list the summary of the propals
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
@ -146,11 +143,10 @@ class box_activity extends ModeleBoxes
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data))
{
$j=0;
while ($line < count($cumuldata))
while ($j < count($data))
{
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
@ -176,7 +172,6 @@ class box_activity extends ModeleBoxes
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($data[$j]->fk_statut,3),
@ -231,10 +226,9 @@ class box_activity extends ModeleBoxes
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
while ($j < count($data)) {
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&amp;leftmenu=orders&amp;viewstatut=".$data[$j]->fk_statut,
@ -259,7 +253,6 @@ class box_activity extends ModeleBoxes
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $data[$j]->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $commandestatic->LibStatut($data[$j]->fk_statut,0,3),
@ -290,11 +283,11 @@ class box_activity extends ModeleBoxes
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ")";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " WHERE f.entity IN (".getEntity('facture').')';
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1";
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=1";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
@ -317,10 +310,9 @@ class box_activity extends ModeleBoxes
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
while ($line < count($cumuldata)) {
while ($j < count($data)) {
$billurl="search_status=2&amp;paye=1&amp;year=".$data[$j]->annee;
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
@ -347,10 +339,8 @@ class box_activity extends ModeleBoxes
);
// We add only for the current year
if ($data[$j]->annee == date("Y")) {
$totalnb += $data[$j]->nb;
$totalMnt += $data[$j]->Mnttot;
}
$totalnb += $data[$j]->nb;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(1,$data[$j]->fk_statut,3),
@ -371,12 +361,13 @@ class box_activity extends ModeleBoxes
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
$data = array();
if ($refresh) {
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " WHERE f.entity IN (".getEntity('facture').')';
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND paye=0";
$sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND f.paye=0";
$sql.= " GROUP BY f.fk_statut";
$sql.= " ORDER BY f.fk_statut DESC";
@ -399,11 +390,11 @@ class box_activity extends ModeleBoxes
$data = dol_readcachefile($cachedir, $filename);
}
$cumuldata=array_merge($cumuldata, $data);
if (! empty($data)) {
$j=0;
$alreadypaid=-1;
while ($line < count($cumuldata)) {
$j=0;
while ($j < count($data)) {
$billurl="search_status=".$data[$j]->fk_statut."&amp;paye=0";
$this->info_box_contents[$line][0] = array(
'td' => 'align="left" width="16"',
@ -428,10 +419,9 @@ class box_activity extends ModeleBoxes
'td' => 'class="right"',
'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency),
);
$totalMnt += $objp->Mnttot;
$this->info_box_contents[$line][4] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3),
'text' => $facturestatic->LibStatut(0,$data[$j]->fk_statut,3, $alreadypaid),
);
$line++;
$j++;
@ -441,11 +431,6 @@ class box_activity extends ModeleBoxes
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'maxlength'=>500, 'text' => ($db->error().' sql='.$sql),
);
}
}

View File

@ -51,7 +51,7 @@ abstract class CommonInvoice extends CommonObject
const TYPE_DEPOSIT = 3;
/**
* Proforma invoice.
* Proforma invoice.
* @deprectad Remove this. A "proforma invoice" is an order with a look of invoice, not an invoice !
*/
const TYPE_PROFORMA = 4;
@ -89,7 +89,7 @@ abstract class CommonInvoice extends CommonObject
*/
const STATUS_ABANDONED = 3;
/**
* Return remain amount to pay. Property ->id and ->total_ttc must be set.
* This does not include open direct debit requests.
@ -141,7 +141,7 @@ abstract class CommonInvoice extends CommonObject
return -1;
}
}
/**
* Return amount (with tax) of all deposits invoices used by invoice.
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
@ -154,11 +154,11 @@ abstract class CommonInvoice extends CommonObject
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
// TODO
return 0;
return 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discountstatic=new DiscountAbsolute($this->db);
$result=$discountstatic->getSumDepositsUsed($this, $multicurrency);
if ($result >= 0)
@ -185,9 +185,9 @@ abstract class CommonInvoice extends CommonObject
// TODO
return 0;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
$discountstatic=new DiscountAbsolute($this->db);
$result=$discountstatic->getSumCreditNotesUsed($this, $multicurrency);
if ($result >= 0)
@ -200,7 +200,7 @@ abstract class CommonInvoice extends CommonObject
return -1;
}
}
/**
* Renvoie tableau des ids de facture avoir issus de la facture
*
@ -309,7 +309,7 @@ abstract class CommonInvoice extends CommonObject
* @param int $paye Status field paye
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, -1 otherwise)
* @param int $type Type invoice
* @return string Libelle du statut
*/
@ -418,7 +418,7 @@ abstract class CommonInvoice extends CommonObject
if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7');
if ($alreadypaid <= 0)
if ($alreadypaid <= 0)
{
if ($type == self::TYPE_CREDIT_NOTE) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
@ -497,13 +497,13 @@ abstract class CommonInvoice extends CommonObject
}
elseif($cdr_type == 2 && !empty($cdr_nbjour)) // Application de la règle, le N du mois courant ou suivant
{
$date_piece = dol_mktime(0,0,0,date('m', $this->date),date('d', $this->date),date('Y', $this->date)); // Sans les heures minutes et secondes
$date_lim_current = dol_mktime(0,0,0,date('m', $this->date),$cdr_nbjour,date('Y', $this->date)); // Sans les heures minutes et secondes
$date_lim_next = strtotime(date('Y-m-d', $date_lim_current).' +1month');
$diff = $date_piece - $date_lim_current;
if($diff < 0) $datelim = $date_lim_current;
else $datelim = $date_lim_next;

View File

@ -5500,6 +5500,8 @@ class Form
print '<br><!-- showLinkedObjectBlock -->';
print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder allwidth">';
print '<tr class="liste_titre">';
@ -5593,6 +5595,7 @@ class Form
}
print '</table>';
print '</div>';
return $nbofdifferenttypes;
}

View File

@ -142,7 +142,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("Status");
print ' &nbsp;</td><td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
$formactions->form_select_status_action('formaction',$status,1,'status',1,2);
$formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2, 'minwidth100');
print '</td></tr>';
}

View File

@ -1446,7 +1446,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
}
// Status
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,1,$histo[$key]['datestart']).'</td>';
$out.='<td class="nowrap" align="center">'.$actionstatic->LibStatut($histo[$key]['percent'],3,0,$histo[$key]['datestart']).'</td>';
// Actions
$out.='<td></td>';

View File

@ -266,7 +266,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
{
// url = url from host, shorturl = relative path into dolibarr sources
$url = $shorturl = $newTabMenu[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) // Do not change url content for external links
{
$tmp=explode('?',$newTabMenu[$i]['url'],2);
$url = $shorturl = $tmp[0];
@ -301,7 +301,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
foreach($menu->liste as $menkey => $menuval)
{
if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], (($menuval['url']!='#' && !preg_match('/^(http:\/\/|https:\/\/)/i', $menuval['url'])) ? DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry($menuval['enabled']);
}

View File

@ -463,17 +463,20 @@ class pdf_strato extends ModelePDFContract
if (empty($hidebottom))
{
$pdf->SetXY(20,230);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
$posy = $tab_top + $tab_height + 3 + 3;
$pdf->SetXY(20,235);
$pdf->MultiCell(80,25, '', 1);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->emetteur->name),0,'L',0);
$pdf->SetXY(110,230);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0);
$pdf->SetXY($this->marge_gauche, $posy + 5);
$pdf->MultiCell($posmiddle - $this->marge_gauche - 5, 20, '', 1);
$pdf->SetXY(110,235);
$pdf->MultiCell(80,25, '', 1);
$pdf->SetXY($posmiddle + 5, $posy);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 5, $outputlangs->transnoentities("ContactNameAndSignature", $this->recipient->name),0,'L',0);
$pdf->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
}
}

View File

@ -162,14 +162,14 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices'));
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'BuyingPrice','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin'));
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric'));
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric'));
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
$this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon

View File

@ -93,9 +93,12 @@ $day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
$toselect = GETPOST('toselect', 'array');
$filter = GETPOST('filtre','alpha');
$option = GETPOST('option');
if ($option == 'late') $filter = 'paye:0';
if ($option == 'late') {
$filter = 'paye:0';
}
$search_all = GETPOST('sall', 'alphanohtml');
$search_label = GETPOST("search_label","alpha");

View File

@ -83,6 +83,9 @@ EXPENSE_REPORT_VALIDATEInDolibarr=Expense report %s validated
EXPENSE_REPORT_APPROVEInDolibarr=Expense report %s approved
EXPENSE_REPORT_DELETEInDolibarr=Expense report %s deleted
EXPENSE_REPORT_REFUSEDInDolibarr=Expense report %s refused
PROJECT_CREATEInDolibarr=Project %s created
PROJECT_MODIFYInDolibarr=Project %s modified
PROJECT_DELETEInDolibarr=Project %s deleted
##### End agenda events #####
AgendaModelModule=Document templates for event
DateActionStart=Start date

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -142,7 +142,7 @@ if ($action == 'search')
{
$current_lang = $langs->getDefaultLang();
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type as type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem';
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
@ -220,7 +220,7 @@ if ($id > 0 || ! empty($ref))
// Nature
if ($object->type!=Product::TYPE_SERVICE)
{
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td>';
print $object->getLibFinished();
print '</td></tr>';
}
@ -228,7 +228,7 @@ if ($id > 0 || ! empty($ref))
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
// Price
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("SellingPrice").'</td><td>';
if ($object->price_base_type == 'TTC')
{
print price($object->price_ttc).' '.$langs->trans($object->price_base_type);
@ -575,7 +575,8 @@ if ($id > 0 || ! empty($ref))
}
}
print "\n<tr ".$bc[$var].">";
print "\n".'<tr class="oddeven">';
$productstatic->id=$objp->rowid;
$productstatic->ref=$objp->ref;
$productstatic->label=$objp->label;

View File

@ -187,7 +187,7 @@ if ($id > 0 || ! empty($ref))
// Tabs for project
$tab='tasks';
$head=project_prepare_head($projectstatic);
dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project'));
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project'));
$param=($mode=='mine'?'&mode=mine':'');
@ -272,8 +272,11 @@ if ($id > 0 || ! empty($ref))
print '<div class="clearboth"></div>';
dol_fiche_end();
print '<br>';
}
// To verify role of users
//$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
//$arrayofuseridoftask=$object->getListContactId('internal');

View File

@ -130,7 +130,8 @@ if ($object->id > 0)
// Tabs for project
$tab='tasks';
$head=project_prepare_head($projectstatic);
dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project'));
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project'));
$param=($mode=='mine'?'&mode=mine':'');
@ -215,6 +216,8 @@ if ($object->id > 0)
print '<div class="clearboth"></div>';
dol_fiche_end();
print '<br>';
}
$head = task_prepare_head($object);

View File

@ -110,7 +110,7 @@ if ($object->id > 0)
// Tabs for project
$tab='tasks';
$head=project_prepare_head($projectstatic);
dol_fiche_head($head, $tab, $langs->trans("Project"), 0, ($projectstatic->public?'projectpub':'project'));
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project'));
$param=($mode=='mine'?'&mode=mine':'');
// Project card
@ -194,6 +194,8 @@ if ($object->id > 0)
print '<div class="clearboth"></div>';
dol_fiche_end();
print '<br>';
}
$head = task_prepare_head($object);

View File

@ -279,6 +279,7 @@ if ($id > 0 || ! empty($ref))
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
@ -468,6 +469,7 @@ if ($id > 0 || ! empty($ref))
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
@ -490,8 +492,21 @@ if ($id > 0 || ! empty($ref))
}
print '</td></tr>';
// Description
print '<td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
print nl2br($object->description);
print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Progress declared
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
if ($object->progress != '')
{
print $object->progress.' %';
@ -506,12 +521,7 @@ if ($id > 0 || ! empty($ref))
if ($tmparray['total_duration'] > 0 && ! empty($object->planned_workload)) print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %';
else print '0 %';
}
else print '';
print '</td></tr>';
// Description
print '<td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
print nl2br($object->description);
else print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>';
print '</td></tr>';
// Other attributes
@ -522,6 +532,10 @@ if ($id > 0 || ! empty($ref))
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
}

View File

@ -418,6 +418,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '</div>';
}
else
{
print '<br>';
}
}
}
@ -442,7 +446,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
$morehtmlref='';
// Project
if (empty($withproject))
{
@ -450,7 +454,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1);
$morehtmlref.='<br>';
// Third party
$morehtmlref.=$langs->trans("ThirdParty").': ';
if (is_object($projectstatic->thirdparty)) {
@ -464,7 +468,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Date start - Date end
@ -491,7 +495,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print '<table class="border" width="100%">';
// Progress declared
print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("ProgressDeclared").'</td><td>';
print $object->progress.' %';
print '</td></tr>';
@ -503,7 +507,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration']/$object->planned_workload*100, 2).' %';
else print '0 %';
}
else print '';
else print '<span class="opacitymedium">'.$langs->trans("WorkloadNotDefined").'</span>';
print '</td></tr>';
print '</table>';