Merge branch '7.0' of https://github.com/Dolibarr/dolibarr.git into 7.0_price
This commit is contained in:
commit
f52187e829
@ -36,11 +36,11 @@ $rowid=GETPOST('rowid','int');
|
||||
$entity=GETPOST('entity','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$update=GETPOST('update','alpha');
|
||||
$delete=GETPOST('delete'); // Do not use alpha here
|
||||
$delete=GETPOST('delete','none'); // Do not use alpha here
|
||||
$debug=GETPOST('debug','int');
|
||||
$consts=GETPOST('const','array');
|
||||
$constname=GETPOST('constname','alpha');
|
||||
$constvalue=GETPOST('constvalue');
|
||||
$constvalue=GETPOST('constvalue','none'); // We shoul dbe able to send everything here
|
||||
$constnote=GETPOST('constnote','alpha');
|
||||
|
||||
|
||||
@ -247,7 +247,7 @@ if ($result)
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
|
||||
print "\n";
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ if (!$user->admin) accessforbidden();
|
||||
$id=GETPOST('rowid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
||||
$mode = GETPOST('mode','aZ09')?GETPOST('mode','aZ09'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
@ -89,7 +89,7 @@ if ($action == 'update')
|
||||
if ($result > 0)
|
||||
{
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'aZ09');
|
||||
$menu->url=GETPOST('url','alpha');
|
||||
$menu->langs=GETPOST('langs','alpha');
|
||||
$menu->position=GETPOST('position','int');
|
||||
|
||||
@ -157,7 +157,7 @@ $i=0;
|
||||
foreach($_SESSION as $key => $val)
|
||||
{
|
||||
if ($i > 0) print ', ';
|
||||
print $key.' => '.$val;
|
||||
print $key.' => '.dol_escape_htmltag($val);
|
||||
$i++;
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
@ -39,7 +39,7 @@ $transkey=GETPOST('transkey','alpha');
|
||||
$transvalue=GETPOST('transvalue','alpha');
|
||||
|
||||
|
||||
$mode = GETPOST('mode')?GETPOST('mode'):'overwrite';
|
||||
$mode = GETPOST('mode','aZ09')?GETPOST('mode','aZ09'):'overwrite';
|
||||
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
@ -4376,7 +4376,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($objectidnext) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
} else {
|
||||
//if ($resteapayer == 0) {
|
||||
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
//} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
||||
|
||||
@ -613,6 +613,7 @@ class CMailFile
|
||||
|
||||
if (! $res)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error="Failed to send mail with php mail";
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||
|
||||
@ -173,7 +173,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
|
||||
* Return amount (with tax) of all credit notes invoices + excess received used by invoice
|
||||
*
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
|
||||
@ -190,7 +190,12 @@ class Form
|
||||
$morealt=' style="width: '.$cols.'"';
|
||||
$cols='';
|
||||
}
|
||||
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'class="quatrevingtpercent"').$morealt.'">'.($editvalue?$editvalue:$value).'</textarea>';
|
||||
|
||||
$valuetoshow = ($editvalue?$editvalue:$value);
|
||||
|
||||
$ret.='<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.($tmp[1]?$tmp[1]:'20').'"'.($cols?' cols="'.$cols.'"':'class="quatrevingtpercent"').$morealt.'">';
|
||||
$ret.=dol_string_neverthesehtmltags($valuetoshow, array('textarea'));
|
||||
$ret.='</textarea>';
|
||||
}
|
||||
else if ($typeofdata == 'day' || $typeofdata == 'datepicker')
|
||||
{
|
||||
@ -288,7 +293,7 @@ class Form
|
||||
$out='';
|
||||
|
||||
// Check parameters
|
||||
if ($inputType == 'textarea') $value = dol_nl2br($value);
|
||||
if (preg_match('/^text/',$inputType)) $value = dol_nl2br($value);
|
||||
else if (preg_match('/^numeric/',$inputType)) $value = price($value);
|
||||
else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day');
|
||||
|
||||
|
||||
@ -196,7 +196,7 @@ class FormActions
|
||||
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:'').($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:($socid>0?'&socid='.$socid:'')).($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
|
||||
$buttontoaddnewevent.= $langs->trans("AddEvent");
|
||||
$buttontoaddnewevent.= '</a>';
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ function GETPOSTISSET($paramname)
|
||||
* @param string $noreplace Force disable of replacement of __xxx__ strings.
|
||||
* @return string|string[] Value found (string or array), or '' if check fails
|
||||
*/
|
||||
function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
|
||||
function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
|
||||
{
|
||||
global $mysoc,$user,$conf;
|
||||
|
||||
@ -4090,7 +4090,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
|
||||
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
|
||||
* 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK)
|
||||
* @param int $alreadysqlnb Put 1 if you know that content is already universal format number
|
||||
* @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails.
|
||||
* @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails. If amount is null or '', it returns ''.
|
||||
*
|
||||
* @see price Opposite function of price2num
|
||||
*/
|
||||
@ -5014,7 +5014,7 @@ function picto_required()
|
||||
* @param string $pagecodeto Encoding of input/output string
|
||||
* @return string String cleaned
|
||||
*
|
||||
* @see dol_escape_htmltag strip_tags
|
||||
* @see dol_escape_htmltag strip_tags dol_string_onlythesehtmltags dol_string_neverthesehtmltags
|
||||
*/
|
||||
function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-8')
|
||||
{
|
||||
@ -5041,6 +5041,51 @@ function dol_string_nohtmltag($stringtoclean,$removelinefeed=1,$pagecodeto='UTF-
|
||||
return trim($temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string to keep only desirable HTML tags.
|
||||
*
|
||||
* @param string $stringtoclean String to clean
|
||||
* @return string String cleaned
|
||||
*
|
||||
* @see dol_escape_htmltag strip_tags dol_string_nohtmltag dol_string_neverthesehtmltags
|
||||
*/
|
||||
function dol_string_onlythesehtmltags($stringtoclean)
|
||||
{
|
||||
$allowed_tags = array(
|
||||
"html", "head", "meta", "body", "b", "br", "div", "em", "font", "img", "hr", "i", "li", "link",
|
||||
"ol", "p", "s", "section", "span", "strong", "title",
|
||||
"table", "tr", "th", "td", "u", "ul"
|
||||
);
|
||||
|
||||
$allowed_tags_string = join("><", $allowed_tags);
|
||||
$allowed_tags_string = preg_replace('/^>/','',$allowed_tags_string);
|
||||
$allowed_tags_string = preg_replace('/<$/','',$allowed_tags_string);
|
||||
|
||||
$temp = strip_tags($stringtoclean, $allowed_tags_string);
|
||||
|
||||
return $temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean a string from some undesirable HTML tags.
|
||||
*
|
||||
* @param string $stringtoclean String to clean
|
||||
* @param array $disallowed_tags Array of tags not allowed
|
||||
* @return string String cleaned
|
||||
*
|
||||
* @see dol_escape_htmltag strip_tags dol_string_nohtmltag dol_string_onlythesehtmltags
|
||||
*/
|
||||
function dol_string_neverthesehtmltags($stringtoclean, $disallowed_tags=array('textarea'))
|
||||
{
|
||||
$temp = $stringtoclean;
|
||||
foreach($disallowed_tags as $tagtoremove)
|
||||
{
|
||||
$temp = preg_replace('/<\/?'.$tagtoremove.'>/', '', $temp);
|
||||
$temp = preg_replace('/<\/?'.$tagtoremove.'\s+[^>]*>/', '', $temp);
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return first line of text. Cut will depends if content is HTML or not.
|
||||
@ -6103,7 +6148,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
|
||||
else
|
||||
{
|
||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
||||
if($order!='asc') $temp=array_reverse($temp,true);
|
||||
}
|
||||
|
||||
$sorted = array();
|
||||
|
||||
@ -780,7 +780,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetFont('','', $default_font_size - 4);
|
||||
|
||||
|
||||
// Loop on each deposits and credit notes included
|
||||
// Loop on each discount available (deposits and credit notes and excess of payment included)
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
|
||||
$sql.= " re.description, re.fk_facture_source,";
|
||||
$sql.= " f.type, f.datef";
|
||||
@ -797,9 +797,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$y+=3;
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj->type == 2) $text=$outputlangs->trans("CreditNote");
|
||||
elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit");
|
||||
else $text=$outputlangs->trans("UnknownType");
|
||||
if ($obj->type == 2) $text=$outputlangs->transnoentities("CreditNote");
|
||||
elseif ($obj->type == 3) $text=$outputlangs->transnoentities("Deposit");
|
||||
elseif ($obj->type == 0) $text=$outputlangs->transnoentities("ExcessReceived");
|
||||
else $text=$outputlangs->transnoentities("UnknownType");
|
||||
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
|
||||
@ -1289,7 +1290,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
|
||||
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
//print "x".$creditnoteamount."-".$depositsamount;exit;
|
||||
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
|
||||
@ -1307,9 +1308,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Credit note
|
||||
if ($creditnoteamount)
|
||||
{
|
||||
$labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $labeltouse, 0, 'L', 0);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
|
||||
}
|
||||
@ -1688,7 +1690,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
$top_shift = $pdf->getY() - $current_y;
|
||||
}
|
||||
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
|
||||
@ -71,7 +71,7 @@ elseif ($module == 'shipping') { $permission=$user->rights->expedition->cr
|
||||
elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
|
||||
//else dol_print_error('','Bad value '.$module.' for param module');
|
||||
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
else $typeofdata='textarea:12:95%';
|
||||
|
||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||
|
||||
@ -310,8 +310,7 @@ if ($search_status != '' && $search_status >= 0) $sql.=" AND d.fk_statut IN (".$
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
||||
&& (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)))
|
||||
{
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
$childids = $user->getAllChildIds(1);
|
||||
$sql.= " AND d.fk_user_author IN (".join(',',$childids).")\n";
|
||||
}
|
||||
// Add where from extra fields
|
||||
@ -442,12 +441,15 @@ if ($resql)
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$user_id.'" class="butAction">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
$canedit=(($user->id == $user_id && $user->rights->expensereport->creer) || ($user->id != $user_id));
|
||||
$childids = $user->getAllChildIds(1);
|
||||
|
||||
$canedit=((in_array($user_id, $childids) && $user->rights->expensereport->creer)
|
||||
|| ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->expensereport->writeall_advance));
|
||||
|
||||
// Boutons d'actions
|
||||
if ($canedit)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=request&id='.$user_id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -36,38 +36,35 @@ if ($conf->deplacement->enabled) require_once DOL_DOCUMENT_ROOT.'/compta/deplace
|
||||
if ($conf->expensereport->enabled) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
|
||||
$langs->load('users');
|
||||
$langs->load('holidays');
|
||||
$langs->load('trips');
|
||||
$langs->loadLangs(array('users','holidays','trips'));
|
||||
|
||||
$socid=GETPOST("socid");
|
||||
$socid=GETPOST("socid","int");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic=new Holiday($db);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
// Update sold
|
||||
if (! empty($conf->holiday->enabled) && ! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$result = $holiday->updateBalance();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic=new Holiday($db);
|
||||
|
||||
// Update sold
|
||||
if (! empty($conf->holiday->enabled))
|
||||
{
|
||||
$result = $holiday->updateBalance();
|
||||
}
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
|
||||
@ -76,13 +73,13 @@ llxHeader('', $langs->trans('HRMArea'));
|
||||
print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||
if (! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -526,7 +526,7 @@ foreach($valid_dashboardlines as $board)
|
||||
}
|
||||
}
|
||||
//var_dump($totallate, $totaltodo);
|
||||
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||
//var_dump($totallate);
|
||||
$boxwork='';
|
||||
$boxwork.='<div class="box">';
|
||||
|
||||
@ -47,16 +47,16 @@ $main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : $main_dir
|
||||
// Dolibarr root URL
|
||||
$main_url = GETPOST('main_url');
|
||||
// Database login informations
|
||||
$userroot=GETPOST('db_user_root');
|
||||
$passroot=GETPOST('db_pass_root');
|
||||
$userroot=GETPOST('db_user_root','alpha');
|
||||
$passroot=GETPOST('db_pass_root','none');
|
||||
// Database server
|
||||
$db_type=GETPOST('db_type','alpha');
|
||||
$db_type=GETPOST('db_type','aZ09');
|
||||
$db_host=GETPOST('db_host','alpha');
|
||||
$db_name=GETPOST('db_name','alpha');
|
||||
$db_name=GETPOST('db_name','aZ09');
|
||||
$db_user=GETPOST('db_user','alpha');
|
||||
$db_pass=GETPOST('db_pass');
|
||||
$db_pass=GETPOST('db_pass','none');
|
||||
$db_port=GETPOST('db_port','int');
|
||||
$db_prefix=GETPOST('db_prefix','alpha');
|
||||
$db_prefix=GETPOST('db_prefix','aZ09');
|
||||
$db_create_database = GETPOST('db_create_database','none');
|
||||
$db_create_user = GETPOST('db_create_user','none');
|
||||
// Force https
|
||||
|
||||
@ -279,6 +279,7 @@ RelativeDiscount=Relative discount
|
||||
GlobalDiscount=Global discount
|
||||
CreditNote=Credit note
|
||||
CreditNotes=Credit notes
|
||||
CreditNotesOrExcessReceived=Credit notes or excess received
|
||||
Deposit=Down payment
|
||||
Deposits=Down payments
|
||||
DiscountFromCreditNote=Discount from credit note %s
|
||||
|
||||
@ -76,7 +76,7 @@ MenuNewSocialContribution=New social/fiscal tax
|
||||
NewSocialContribution=New social/fiscal tax
|
||||
AddSocialContribution=Add social/fiscal tax
|
||||
ContributionsToPay=Social/fiscal taxes to pay
|
||||
AccountancyTreasuryArea=Accountancy/Treasury area
|
||||
AccountancyTreasuryArea=Billing and payment area
|
||||
NewPayment=New payment
|
||||
Payments=Payments
|
||||
PaymentCustomerInvoice=Customer invoice payment
|
||||
|
||||
@ -282,6 +282,7 @@ RelativeDiscount=Remise relative
|
||||
GlobalDiscount=Ligne de déduction
|
||||
CreditNote=Avoir
|
||||
CreditNotes=Avoirs
|
||||
CreditNotesOrExcessReceived=Avoirs ou trop perçus
|
||||
Deposit=Acompte
|
||||
Deposits=Acomptes
|
||||
DiscountFromCreditNote=Remise issue de l'avoir %s
|
||||
|
||||
@ -71,7 +71,7 @@ $loan_static = new Loan($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend,";
|
||||
$sql = "SELECT l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend,";
|
||||
$sql.= " SUM(pl.amount_capital) as alreadypayed";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l LEFT JOIN ".MAIN_DB_PREFIX."payment_loan AS pl";
|
||||
$sql.= " ON l.rowid = pl.fk_loan";
|
||||
@ -83,7 +83,7 @@ if ($filtre) {
|
||||
$filtre=str_replace(":","=",$filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
}
|
||||
$sql.= " GROUP BY l.rowid, l.label, l.capital, l.datestart, l.dateend";
|
||||
$sql.= " GROUP BY l.rowid, l.label, l.capital, l.paid, l.datestart, l.dateend";
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
|
||||
@ -242,6 +242,8 @@ if ($resql)
|
||||
if ($fourn_id) $param.="&fourn_id=".$fourn_id;
|
||||
if ($snom) $param.="&snom=".$snom;
|
||||
if ($sref) $param.="&sref=".$sref;
|
||||
if ($toolowstock) $param.="&toolowstock=".$toolowstock;
|
||||
if ($search_categ) $param.="&search_categ=".$search_categ;
|
||||
|
||||
$formProduct = new FormProduct($db);
|
||||
$formProduct->loadWarehouses();
|
||||
|
||||
@ -49,11 +49,13 @@ $hookmanager->initHooks(array('productstatsorder'));
|
||||
|
||||
$mesg = '';
|
||||
|
||||
// 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 = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
@ -112,7 +114,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
show_stats_for_company($product,$socid);
|
||||
$nboflines = show_stats_for_company($product, $socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -142,25 +144,22 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
//Calcul total qty and amount for global if full scan list
|
||||
$total_ht=0;
|
||||
$total_qty=0;
|
||||
$totalrecords=0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ($objp = $db->fetch_object($result)) {
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
}
|
||||
}
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -172,7 +171,8 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&search_month='.$search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year='.$search_year;
|
||||
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
@ -183,7 +183,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,'');
|
||||
print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
|
||||
@ -211,20 +211,22 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$orderstatic->id=$objp->commandeid;
|
||||
$orderstatic->ref=$objp->ref;
|
||||
$orderstatic->ref_client=$objp->ref_client;
|
||||
$societestatic->fetch($objp->socid);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
$orderstatic->id=$objp->commandeid;
|
||||
$orderstatic->ref=$objp->ref;
|
||||
$orderstatic->ref_client=$objp->ref_client;
|
||||
print $orderstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$societestatic->fetch($objp->socid);
|
||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||
print "<td>".$objp->code_client."</td>\n";
|
||||
print '<td align="center">';
|
||||
@ -234,15 +236,11 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">'.$orderstatic->LibStatut($objp->statut,$objp->facture,5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td align="center">'.$total_qty.'</td>';
|
||||
print '<td align="right">'.price($total_ht).'</td>';
|
||||
|
||||
@ -119,7 +119,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
show_stats_for_company($product, $socid);
|
||||
$nboflines = show_stats_for_company($product, $socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -153,24 +153,21 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
||||
if ($socid)
|
||||
$sql .= " AND c.fk_soc = " . $socid;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
$total_ht = 0;
|
||||
$total_qty = 0;
|
||||
$totalrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
@ -182,7 +179,8 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$option .= '&search_month=' . $search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year=' . $search_year;
|
||||
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
@ -193,7 +191,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
||||
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period') . ' (' . $langs->trans("OrderDate") . ') - ';
|
||||
@ -219,20 +217,24 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
if ($num > 0) {
|
||||
$var = True;
|
||||
while ( $i < $num && $i < $conf->liste_limit ) {
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>';
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$supplierorderstatic->id = $objp->commandeid;
|
||||
$supplierorderstatic->ref = $objp->ref;
|
||||
$supplierorderstatic->statut = $objp->statut;
|
||||
$societestatic->fetch($objp->socid);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $supplierorderstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$societestatic->fetch($objp->socid);
|
||||
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
|
||||
print "<td>" . $objp->code_client . "</td>\n";
|
||||
print '<td align="center">';
|
||||
@ -241,16 +243,12 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
||||
print '<td align="right">' . $supplierorderstatic->getLibStatut(4) . '</td>';
|
||||
print "</tr>\n";
|
||||
$i ++;
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td align="center">' . $total_qty . '</td>';
|
||||
print '<td align="right">' . price($total_ht) . '</td>';
|
||||
|
||||
@ -46,11 +46,13 @@ $hookmanager->initHooks(array('productstatscontract'));
|
||||
|
||||
$mesg = '';
|
||||
|
||||
// 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 = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
@ -102,7 +104,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
show_stats_for_company($product,$socid);
|
||||
$nboflines = show_stats_for_company($product,$socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -133,7 +135,20 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " GROUP BY c.rowid, c.ref, c.ref_customer, c.ref_supplier, c.date_contrat, c.statut, s.nom, s.rowid, s.code_client";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
//Calcul total qty and amount for global if full scan list
|
||||
$total_ht=0;
|
||||
$total_qty=0;
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -145,7 +160,8 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&search_month=' . $search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year=' . $search_year;
|
||||
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
@ -156,7 +172,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("Contrats"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,0,'');
|
||||
print_barre_liste($langs->trans("Contrats"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
$i = 0;
|
||||
print '<div class="div-table-responsive">';
|
||||
@ -177,8 +193,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
@ -50,15 +50,18 @@ $hookmanager->initHooks(array('productstatsinvoice'));
|
||||
|
||||
$showmessage=GETPOST('showmessage');
|
||||
|
||||
// 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 = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="f.datef";
|
||||
|
||||
$search_month = GETPOST('search_month', 'aplha');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
|
||||
@ -129,7 +132,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
$nboflines = show_stats_for_company($product,$socid);
|
||||
$nboflines = show_stats_for_company($product, $socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -164,25 +167,19 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
//Calcul total qty and amount for global if full scan list
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
$total_ht=0;
|
||||
$total_qty=0;
|
||||
$totalrecords=0;
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ($objp = $db->fetch_object($result))
|
||||
{
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
}
|
||||
}
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -194,7 +191,8 @@ if ($id > 0 || ! empty($ref))
|
||||
if (! empty($search_month))
|
||||
$option .= '&search_month='.$search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year='.$search_year;
|
||||
$option .= '&search_year='.$search_year;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER ['PHP_SELF'] . '?id='.$product->id.'" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
@ -206,7 +204,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,'');
|
||||
print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"],"&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - ';
|
||||
@ -234,11 +232,13 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$invoicestatic->id=$objp->facid;
|
||||
$invoicestatic->ref=$objp->facnumber;
|
||||
$societestatic->fetch($objp->socid);
|
||||
@ -257,15 +257,11 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">'.$invoicestatic->LibStatut($objp->paye,$objp->statut,5,$paiement,$objp->type).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
|
||||
if (!empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td align="center">'.$total_qty.'</td>';
|
||||
print '<td align="right">'.price($total_ht).'</td>';
|
||||
|
||||
@ -51,11 +51,13 @@ $hookmanager->initHooks(array('productstatssupplyinvoice'));
|
||||
|
||||
$mesg = '';
|
||||
|
||||
// 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 = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder = "DESC";
|
||||
@ -114,7 +116,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
show_stats_for_company($product, $socid);
|
||||
$nboflines = show_stats_for_company($product, $socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -149,20 +151,17 @@ if ($id > 0 || ! empty($ref))
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
$total_ht = 0;
|
||||
$total_qty = 0;
|
||||
$totalrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
}
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -174,7 +173,8 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&search_month=' . $search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year=' . $search_year;
|
||||
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
@ -185,7 +185,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
||||
print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period') . ' (' . $langs->trans("DateInvoice") . ') - ';
|
||||
@ -213,19 +213,21 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var = True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>';
|
||||
$total_ht+=$objp->total_ht;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$supplierinvoicestatic->id = $objp->facid;
|
||||
$supplierinvoicestatic->ref = $objp->facnumber;
|
||||
$societestatic->fetch($objp->socid);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $supplierinvoicestatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$societestatic->fetch($objp->socid);
|
||||
print '<td>' . $societestatic->getNomUrl(1) . '</td>';
|
||||
print "<td>" . $objp->code_client . "</td>\n";
|
||||
print '<td align="center">';
|
||||
@ -234,16 +236,12 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . price($objp->total_ht) . "</td>\n";
|
||||
print '<td align="right">' . $supplierinvoicestatic->LibStatut($objp->paye, $objp->statut, 5) . '</td>';
|
||||
print "</tr>\n";
|
||||
$i ++;
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td align="center">' . $total_qty . '</td>';
|
||||
print '<td align="right">' . price($total_ht) . '</td>';
|
||||
|
||||
@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
show_stats_for_company($product, $socid);
|
||||
$nboflines = show_stats_for_company($product, $socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -148,24 +148,21 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
||||
if ($socid)
|
||||
$sql .= " AND p.fk_soc = " . $socid;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
$total_ht = 0;
|
||||
$total_qty = 0;
|
||||
$totalrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$total_ht += $objp->amount;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
}
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -178,7 +175,8 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&search_month=' . $search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year=' . $search_year;
|
||||
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
print '<input type="hidden" name="sortfield" value="' . $sortfield . '"/>';
|
||||
@ -189,7 +187,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
||||
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - ';
|
||||
@ -216,20 +214,22 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var = True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>';
|
||||
$total_ht+=$objp->amount;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$propalstatic->id=$objp->propalid;
|
||||
$propalstatic->ref=$objp->ref;
|
||||
$propalstatic->ref_client=$objp->ref_client;
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$societestatic->fetch($objp->socid);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->datep), 'dayhour') . "</td>";
|
||||
@ -237,17 +237,13 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . price($objp->amount) . '</td>' . "\n";
|
||||
print '<td align="right">' . $propalstatic->LibStatut($objp->statut, 5) . '</td>';
|
||||
print "</tr>\n";
|
||||
$i ++;
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '<td align="center">' . $total_qty . '</td>';
|
||||
print '<td align="right">' . price($total_ht) . '</td>';
|
||||
|
||||
@ -114,7 +114,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
show_stats_for_company($product, $socid);
|
||||
$nboflines = show_stats_for_company($product, $socid);
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -148,24 +148,21 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
|
||||
if ($socid)
|
||||
$sql .= " AND p.fk_soc = " . $socid;
|
||||
$sql .= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Calcul total qty and amount for global if full scan list
|
||||
$total_ht = 0;
|
||||
$total_qty = 0;
|
||||
$totalrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
|
||||
// Count total nb of records
|
||||
$totalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$totalrecords = $db->num_rows($result);
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$total_ht += $objp->amount;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
}
|
||||
$totalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -178,6 +175,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&search_month=' . $search_month;
|
||||
if (! empty($search_year))
|
||||
$option .= '&search_year=' . $search_year;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
|
||||
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $product->id . '" name="search_form">' . "\n";
|
||||
if (! empty($sortfield))
|
||||
@ -189,7 +187,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$option .= '&page=' . $page;
|
||||
}
|
||||
|
||||
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
|
||||
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print '<div class="divsearchfield">';
|
||||
print $langs->trans('Period') . ' (' . $langs->trans("DatePropal") . ') - ';
|
||||
@ -216,19 +214,21 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$var = True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>';
|
||||
$total_ht+=$objp->amount;
|
||||
$total_qty+=$objp->qty;
|
||||
|
||||
$propalstatic->id=$objp->propalid;
|
||||
$propalstatic->ref=$objp->ref;
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
$societestatic->fetch($objp->socid);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $propalstatic->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
print '<td>'.$societestatic->getNomUrl(1).'</td>';
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_valid), 'dayhour') . "</td>";
|
||||
@ -236,17 +236,13 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right">' . price($objp->amount) . '</td>' . "\n";
|
||||
print '<td align="right">' . $propalstatic->LibStatut($objp->statut, 5) . '</td>';
|
||||
print "</tr>\n";
|
||||
$i ++;
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$total_ht += $objp->total_ht;
|
||||
$total_qty += $objp->qty;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
print '<td colspan="2"></td>';
|
||||
print '<td align="center">' . $total_qty . '</td>';
|
||||
print '<td align="right">' . price($total_ht) . '</td>';
|
||||
|
||||
@ -1715,7 +1715,7 @@ class Project extends CommonObject
|
||||
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
|
||||
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.fk_statut = 1";
|
||||
$sql.= " AND p.entity IN (".getEntity('project', 0).')';
|
||||
$sql.= " AND p.entity IN (".getEntity('project').')';
|
||||
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
|
||||
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
|
||||
@ -1791,7 +1791,7 @@ class Project extends CommonObject
|
||||
$sql = "SELECT count(p.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
$sql.= " WHERE";
|
||||
$sql.= " p.entity IN (".getEntity('projet').")";
|
||||
$sql.= " p.entity IN (".getEntity('project').")";
|
||||
if (! $user->rights->projet->all->lire)
|
||||
{
|
||||
$projectsListId = $this->getProjectsAuthorizedForUser($user,0,1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user