clean indent

This commit is contained in:
Frédéric FRANCE 2019-10-27 09:51:15 +01:00
parent 5006001753
commit b2b057e9b5
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
28 changed files with 560 additions and 588 deletions

View File

@ -790,48 +790,40 @@ if ($object->id > 0)
if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer) if ($conf->supplier_proposal->enabled && $user->rights->supplier_proposal->creer)
{ {
$langs->load("supplier_proposal"); $langs->load("supplier_proposal");
if ($object->status == 1) if ($object->status == 1) {
{ print '<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddSupplierProposal").'</a>'; } else {
} print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddSupplierProposal").'</a>';
else }
{
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddSupplierProposal").'</a>';
}
} }
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
$langs->load("orders"); $langs->load("orders");
if ($object->status == 1) if ($object->status == 1) {
{ print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddOrder").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddOrder").'</a>'; } else {
} print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddOrder").'</a>';
else }
{
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddOrder").'</a>';
}
} }
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)
{ {
$langs->load("bills"); $langs->load("bills");
if ($object->status == 1) if ($object->status == 1) {
{ print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>'; } else {
} print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a>';
else }
{
print '<a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("AddBill").'</a>';
}
} }
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)
{ {
if (! empty($orders2invoice) && $orders2invoice > 0) if (! empty($orders2invoice) && $orders2invoice > 0)
{ {
if ($object->status == 1) // Company is open if ($object->status == 1)
{ {
// Company is open
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
} }
else else

View File

@ -1272,7 +1272,8 @@ class CommandeFournisseur extends CommonOrder
{ {
$this->special_code = $this->lines[$i]->special_code; // TODO : remove this in 9.0 and add special_code param to addline() $this->special_code = $this->lines[$i]->special_code; // TODO : remove this in 9.0 and add special_code param to addline()
$result = $this->addline( // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set // This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set
$result = $this->addline(
$this->lines[$i]->desc, $this->lines[$i]->desc,
$this->lines[$i]->subprice, $this->lines[$i]->subprice,
$this->lines[$i]->qty, $this->lines[$i]->qty,

View File

@ -2361,10 +2361,10 @@ class FactureFournisseur extends CommonInvoice
return $numref; return $numref;
} }
else else
{ {
$this->error=$obj->error; $this->error=$obj->error;
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
return false; return false;
} }
} }

View File

@ -8,7 +8,7 @@
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ion Agorria <ion@agorria.com> * Copyright (C) 2014 Ion Agorria <ion@agorria.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -647,95 +647,96 @@ if (empty($reshook))
// Define info_bits // Define info_bits
$info_bits = 0; $info_bits = 0;
if (preg_match('/\*/', $vat_rate)) if (preg_match('/\*/', $vat_rate)) {
$info_bits |= 0x01; $info_bits |= 0x01;
}
// Define vat_rate // Define vat_rate
$vat_rate = str_replace('*', '', $vat_rate); $vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $mysoc, $object->thirdparty); $localtax1_rate = get_localtax($vat_rate, 1, $mysoc, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty); $localtax2_rate = get_localtax($vat_rate, 2, $mysoc, $object->thirdparty);
if (GETPOST('price_ht') != '') if (GETPOST('price_ht') != '')
{
$price_base_type = 'HT';
$ht = price2num(GETPOST('price_ht'));
}
else
{
$vatratecleaned = $vat_rate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) // If vat is "xx (yy)"
{ {
$price_base_type = 'HT'; $vatratecleaned = trim($reg[1]);
$ht = price2num(GETPOST('price_ht')); $vatratecode = $reg[2];
}
else
{
$vatratecleaned = $vat_rate;
if (preg_match('/^(.*)\s*\((.*)\)$/', $vat_rate, $reg)) // If vat is "xx (yy)"
{
$vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2];
}
$ttc = price2num(GETPOST('price_ttc'));
$ht = $ttc / (1 + ($vatratecleaned / 100));
$price_base_type = 'HT';
} }
$pu_ht_devise = GETPOST('multicurrency_subprice'); $ttc = price2num(GETPOST('price_ttc'));
$ht = $ttc / (1 + ($vatratecleaned / 100));
$price_base_type = 'HT';
}
// Extrafields Lines $pu_ht_devise = GETPOST('multicurrency_subprice');
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line); // Extrafields Lines
// Unset extrafield POST Data $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
if (is_array($extralabelsline)) { $array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
foreach ($extralabelsline as $key => $value) { // Unset extrafield POST Data
unset($_POST["options_" . $key]); if (is_array($extralabelsline)) {
} foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
} }
}
$result = $object->updateline( $result = $object->updateline(
$lineid, $lineid,
$_POST['product_desc'], $_POST['product_desc'],
$ht, $ht,
$_POST['qty'], $_POST['qty'],
$_POST['remise_percent'], $_POST['remise_percent'],
$vat_rate, $vat_rate,
$localtax1_rate, $localtax1_rate,
$localtax2_rate, $localtax2_rate,
$price_base_type, $price_base_type,
0, 0,
isset($_POST["type"])?$_POST["type"]:$line->product_type, isset($_POST["type"])?$_POST["type"]:$line->product_type,
false, false,
$date_start, $date_start,
$date_end, $date_end,
$array_options, $array_options,
$_POST['units'], $_POST['units'],
$pu_ht_devise, $pu_ht_devise,
GETPOST('fourn_ref', 'alpha') GETPOST('fourn_ref', 'alpha')
); );
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
unset($_POST['idprodfournprice']); unset($_POST['idprodfournprice']);
unset($_POST['remmise_percent']); unset($_POST['remmise_percent']);
unset($_POST['dp_desc']); unset($_POST['dp_desc']);
unset($_POST['np_desc']); unset($_POST['np_desc']);
unset($_POST['pu']); unset($_POST['pu']);
unset($_POST['fourn_ref']); unset($_POST['fourn_ref']);
unset($_POST['tva_tx']); unset($_POST['tva_tx']);
unset($_POST['date_start']); unset($_POST['date_start']);
unset($_POST['date_end']); unset($_POST['date_end']);
unset($_POST['units']); unset($_POST['units']);
unset($localtax1_tx); unset($localtax1_tx);
unset($localtax2_tx); unset($localtax2_tx);
unset($_POST['date_starthour']); unset($_POST['date_starthour']);
unset($_POST['date_startmin']); unset($_POST['date_startmin']);
unset($_POST['date_startsec']); unset($_POST['date_startsec']);
unset($_POST['date_startday']); unset($_POST['date_startday']);
unset($_POST['date_startmonth']); unset($_POST['date_startmonth']);
unset($_POST['date_startyear']); unset($_POST['date_startyear']);
unset($_POST['date_endhour']); unset($_POST['date_endhour']);
unset($_POST['date_endmin']); unset($_POST['date_endmin']);
unset($_POST['date_endsec']); unset($_POST['date_endsec']);
unset($_POST['date_endday']); unset($_POST['date_endday']);
unset($_POST['date_endmonth']); unset($_POST['date_endmonth']);
unset($_POST['date_endyear']); unset($_POST['date_endyear']);
if ($result >= 0) if ($result >= 0)
{ {
// Define output language // Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{ {
@ -753,12 +754,12 @@ if (empty($reshook))
$result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $result=$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) dol_print_error($db, $result); if ($result < 0) dol_print_error($db, $result);
} }
} }
else else
{ {
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
exit; exit;
} }
} }
// Remove a product line // Remove a product line
@ -2500,13 +2501,13 @@ elseif (! empty($object->id))
// Create bill // Create bill
//if (! empty($conf->facture->enabled)) //if (! empty($conf->facture->enabled))
//{ //{
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled
{
if ($user->rights->fournisseur->facture->creer)
{ {
if ($user->rights->fournisseur->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}
} }
}
//} //}
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not) // Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)

View File

@ -157,20 +157,21 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -407,20 +407,21 @@ if ($id > 0 || ! empty($ref)) {
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);
@ -462,8 +463,8 @@ if ($id > 0 || ! empty($ref)) {
print '<td>' . $author->getNomUrl(1, '', 0, 0, 0) . '</td>'; print '<td>' . $author->getNomUrl(1, '', 0, 0, 0) . '</td>';
print '</tr>'; print '</tr>';
$parameters=array(); $parameters = array();
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print "</table>"; print "</table>";

View File

@ -126,20 +126,21 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -122,20 +122,21 @@ if (! empty($conf->projet->enabled))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -103,20 +103,21 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -436,7 +436,7 @@ if (($action != 'create' && $action != 'add') && !$error) {
}); });
}); });
</script> </script>
<?php <?php
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,'; $sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_supplier,';
$sql .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut'; $sql .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut';

View File

@ -23,11 +23,9 @@ if (empty($conf) || ! is_object($conf))
exit; exit;
} }
?>
<!-- BEGIN PHP TEMPLATE --> print "<!-- BEGIN PHP TEMPLATE -->\n";
<?php
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;
@ -37,28 +35,29 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
$langs->load("orders"); $langs->load("orders");
$total=0; $ilink=0; $total=0;
$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {
$ilink++; $ilink++;
$trclass='oddeven'; $trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?> ?>
<tr class="<?php echo $trclass; ?>"> <tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("SupplierOrder"); ?></td> <td><?php echo $langs->trans("SupplierOrder"); ?></td>
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/commande/card.php?id='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowOrder"), "order").' '.$objectlink->ref; ?></a></td> <td><a href="<?php echo DOL_URL_ROOT.'/fourn/commande/card.php?id='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowOrder"), "order").' '.$objectlink->ref; ?></a></td>
<td class="left"><?php echo $objectlink->ref_supplier; ?></td> <td class="left"><?php echo $objectlink->ref_supplier; ?></td>
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td> <td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="right"><?php <td class="right"><?php
if ($user->rights->fournisseur->commande->lire) { if ($user->rights->fournisseur->commande->lire) {
$total = $total + $objectlink->total_ht; $total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht); echo price($objectlink->total_ht);
} ?></td> } ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1)
{ {
@ -74,6 +73,5 @@ if (count($linkedObjectBlock) > 1)
</tr> </tr>
<?php <?php
} }
?>
<!-- END PHP TEMPLATE --> print "<!-- END PHP TEMPLATE -->\n";

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr> * Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -308,18 +308,20 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09'); $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) }
$newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
if (! empty($newlang)) { $newlang = $object->thirdparty->default_lang;
$outputlangs = new Translate("", $conf); }
$outputlangs->setDefaultLang($newlang); if (! empty($newlang)) {
} $outputlangs = new Translate("", $conf);
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs->setDefaultLang($newlang);
$ret = $object->fetch($object->id); // Reload to get new records }
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
} $ret = $object->fetch($object->id); // Reload to get new records
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
} }
} }
@ -1017,97 +1019,97 @@ if (empty($reshook))
{ {
$db->begin(); $db->begin();
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
if (GETPOST('price_ht') != '') if (GETPOST('price_ht') != '')
{ {
$up = price2num(GETPOST('price_ht')); $up = price2num(GETPOST('price_ht'));
$price_base_type = 'HT'; $price_base_type = 'HT';
} }
else else
{ {
$up = price2num(GETPOST('price_ttc')); $up = price2num(GETPOST('price_ttc'));
$price_base_type = 'TTC'; $price_base_type = 'TTC';
} }
if (GETPOST('productid') > 0) if (GETPOST('productid') > 0)
{
$productsupplier = new ProductFournisseur($db);
if (! empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY))
{ {
$productsupplier = new ProductFournisseur($db); if (GETPOST('productid') > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), GETPOST('productid'), 'none', GETPOST('socid', 'int')) < 0 )
if (! empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY))
{ {
if (GETPOST('productid') > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), GETPOST('productid'), 'none', GETPOST('socid', 'int')) < 0 ) setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
{
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
}
}
$prod = new Product($db);
$prod->fetch(GETPOST('productid'));
$label = $prod->description;
if (trim($_POST['product_desc']) != trim($label)) $label=$_POST['product_desc'];
$type = $prod->type;
}
else
{
$label = $_POST['product_desc'];
$type = $_POST["type"]?$_POST["type"]:0;
}
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $tva_tx))
$info_bits |= 0x01;
// Define vat_rate
$tva_tx = str_replace('*', '', $tva_tx);
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
$remise_percent=GETPOST('remise_percent');
$pu_ht_devise = GETPOST('multicurrency_subprice');
// Extrafields Lines
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
// Unset extrafield POST Data
if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
} }
} }
$result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise, GETPOST('fourn_ref', 'alpha')); $prod = new Product($db);
if ($result >= 0) $prod->fetch(GETPOST('productid'));
{ $label = $prod->description;
unset($_POST['label']); if (trim($_POST['product_desc']) != trim($label)) $label=$_POST['product_desc'];
unset($_POST['fourn_ref']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
$db->commit(); $type = $prod->type;
} }
else else
{ {
$db->rollback(); $label = $_POST['product_desc'];
setEventMessages($object->error, $object->errors, 'errors'); $type = $_POST["type"]?$_POST["type"]:0;
}
$date_start=dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end=dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $tva_tx))
$info_bits |= 0x01;
// Define vat_rate
$tva_tx = str_replace('*', '', $tva_tx);
$localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
$localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
$remise_percent=GETPOST('remise_percent');
$pu_ht_devise = GETPOST('multicurrency_subprice');
// Extrafields Lines
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
// Unset extrafield POST Data
if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
} }
}
$result=$object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise, GETPOST('fourn_ref', 'alpha'));
if ($result >= 0)
{
unset($_POST['label']);
unset($_POST['fourn_ref']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
$db->commit();
}
else
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
} }
elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
@ -1654,52 +1656,52 @@ if ($action == 'create')
$element = 'projet'; $element = 'projet';
} }
// For compatibility // For compatibility
if ($element == 'order') { if ($element == 'order') {
$element = $subelement = 'commande'; $element = $subelement = 'commande';
} }
if ($element == 'propal') { if ($element == 'propal') {
$element = 'comm/propal'; $subelement = 'propal'; $element = 'comm/propal'; $subelement = 'propal';
} }
if ($element == 'contract') { if ($element == 'contract') {
$element = $subelement = 'contrat'; $element = $subelement = 'contrat';
} }
if ($element == 'order_supplier') { if ($element == 'order_supplier') {
$element = 'fourn'; $subelement = 'fournisseur.commande'; $element = 'fourn'; $subelement = 'fournisseur.commande';
} }
require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php'; require_once DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php';
$classname = ucfirst($subelement); $classname = ucfirst($subelement);
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur'; if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
$objectsrc = new $classname($db); $objectsrc = new $classname($db);
$objectsrc->fetch($originid); $objectsrc->fetch($originid);
$objectsrc->fetch_thirdparty(); $objectsrc->fetch_thirdparty();
$projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:'');
//$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:''); //$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
$soc = $objectsrc->thirdparty; $soc = $objectsrc->thirdparty;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_supplier_id)?$soc->cond_reglement_supplier_id:0)); // TODO maybe add default value option $cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_supplier_id)?$soc->cond_reglement_supplier_id:0)); // TODO maybe add default value option
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_supplier_id)?$soc->mode_reglement_supplier_id:0));
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0)); $fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_supplier_percent)?$soc->remise_supplier_percent:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_supplier_percent)?$soc->remise_supplier_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''; $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
} }
$datetmp=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datetmp=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp); $dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
$datetmp=dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); $datetmp=dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp); $datedue=($datetmp==''?-1:$datetmp);
// Replicate extrafields // Replicate extrafields
$objectsrc->fetch_optionals($originid); $objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options; $object->array_options = $objectsrc->array_options;
} }
else else
{ {
@ -2047,7 +2049,7 @@ if ($action == 'create')
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
print '</td>'; print '</td>';
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>'; // print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
print '</tr>'; print '</tr>';
// Private note // Private note
@ -2376,19 +2378,20 @@ else
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -614,12 +614,12 @@ if ($resql)
FactureFournisseur::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"), FactureFournisseur::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
FactureFournisseur::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"), FactureFournisseur::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
); );
/* /*
if (! empty($conf->global->INVOICE_USE_SITUATION)) if (! empty($conf->global->INVOICE_USE_SITUATION))
{ {
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation"); $listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
} }
*/ */
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order. //$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100'); print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
print '</td>'; print '</td>';
@ -1105,32 +1105,31 @@ if ($resql)
// Show total line // Show total line
if (isset($totalarray['totalhtfield']) if (isset($totalarray['totalhtfield'])
|| isset($totalarray['totalvatfield']) || isset($totalarray['totalvatfield'])
|| isset($totalarray['totallocaltax1field']) || isset($totalarray['totallocaltax1field'])
|| isset($totalarray['totallocaltax2field']) || isset($totalarray['totallocaltax2field'])
|| isset($totalarray['totalttcfield']) || isset($totalarray['totalttcfield'])
|| isset($totalarray['totalamfield']) || isset($totalarray['totalamfield'])
|| isset($totalarray['totalrtpfield']) || isset($totalarray['totalrtpfield'])
) ) {
{
print '<tr class="liste_total">'; print '<tr class="liste_total">';
$i=0; $i=0;
while ($i < $totalarray['nbfield']) while ($i < $totalarray['nbfield'])
{ {
$i++; $i++;
if ($i == 1) if ($i == 1)
{ {
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>'; if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>'; else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
} }
elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>'; elseif ($totalarray['totalhtfield'] == $i) print '<td class="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>'; elseif ($totalarray['totalvatfield'] == $i) print '<td class="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>'; elseif ($totalarray['totallocaltax1field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax1']).'</td>';
elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>'; elseif ($totalarray['totallocaltax2field'] == $i) print '<td class="right">'.price($totalarray['totallocaltax2']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>'; elseif ($totalarray['totalttcfield'] == $i) print '<td class="right">'.price($totalarray['totalttc']).'</td>';
elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>'; elseif ($totalarray['totalamfield'] == $i) print '<td class="right">'.price($totalarray['totalam']).'</td>';
elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>'; elseif ($totalarray['totalrtpfield'] == $i) print '<td class="right">'.price($totalarray['totalrtp']).'</td>';
else print '<td></td>'; else print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }

View File

@ -102,20 +102,21 @@ if ($object->id > 0)
$morehtmlref.='<br>'.$langs->trans('Project') . ' '; $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
if ($action != 'classify') if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; // $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : '; $morehtmlref.=' : ';
if ($action == 'classify') { }
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); if ($action == 'classify') {
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<input type="hidden" name="action" value="classin">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='</form>'; $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
} else { $morehtmlref.='</form>';
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } else {
} $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else { } else {
if (! empty($object->fk_project)) { if (! empty($object->fk_project)) {
$proj = new Project($db); $proj = new Project($db);

View File

@ -755,7 +755,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$db->free($resql); $db->free($resql);
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
} }

View File

@ -25,11 +25,9 @@ if (empty($conf) || ! is_object($conf))
exit; exit;
} }
?>
<!-- BEGIN PHP TEMPLATE --> print "<!-- BEGIN PHP TEMPLATE -->\n";
<?php
global $user; global $user;
global $noMoreLinkedObjectBlockAfter; global $noMoreLinkedObjectBlockAfter;
@ -46,30 +44,31 @@ foreach($linkedObjectBlock as $key => $objectlink)
$trclass='oddeven'; $trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
?> ?>
<tr class="<?php echo $trclass; ?>"> <tr class="<?php echo $trclass; ?>">
<td><?php echo $langs->trans("SupplierInvoice"); ?></td> <td><?php echo $langs->trans("SupplierInvoice"); ?></td>
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowBill"), "bill").' '.$objectlink->ref; ?></a></td> <td><a href="<?php echo DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowBill"), "bill").' '.$objectlink->ref; ?></a></td>
<td class="left"><?php echo $objectlink->ref_supplier; ?></td> <td class="left"><?php echo $objectlink->ref_supplier; ?></td>
<td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td> <td class="center"><?php echo dol_print_date($objectlink->date, 'day'); ?></td>
<td class="right"><?php <td class="right"><?php
if ($user->rights->fournisseur->facture->lire) { if ($user->rights->fournisseur->facture->lire) {
$sign = 1; $sign = 1;
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1; if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1;
if ($objectlink->statut != 3) // If not abandonned if ($objectlink->statut != 3)
{ {
$total = $total + $sign * $objectlink->total_ht; // If not abandonned
echo price($objectlink->total_ht); $total = $total + $sign * $objectlink->total_ht;
} echo price($objectlink->total_ht);
else }
{ else
echo '<strike>'.price($objectlink->total_ht).'</strike>'; {
} echo '<strike>'.price($objectlink->total_ht).'</strike>';
} ?></td> }
} ?></td>
<td class="right"><?php echo $objectlink->getLibStatut(3); ?></td> <td class="right"><?php echo $objectlink->getLibStatut(3); ?></td>
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> <td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td>
</tr> </tr>
<?php <?php
} }
if (count($linkedObjectBlock) > 1) if (count($linkedObjectBlock) > 1)
{ {
@ -85,6 +84,5 @@ if (count($linkedObjectBlock) > 1)
</tr> </tr>
<?php <?php
} }
?>
<!-- END PHP TEMPLATE --> print "<!-- END PHP TEMPLATE -->\n";

View File

@ -77,7 +77,7 @@ if ($socid > 0)
$sql.= " u.login, u.rowid as userid"; $sql.= " u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id;
$sql.= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany $sql.= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany
$sql.= " AND f.fk_user_valid = u.rowid"; $sql.= " AND f.fk_user_valid = u.rowid";
$sql.= " ORDER BY f.datef DESC"; $sql.= " ORDER BY f.datef DESC";

View File

@ -359,7 +359,7 @@ llxHeader();
// Add logic to shoow/hide buttons // Add logic to shoow/hide buttons
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#delconst").hide(); jQuery("#delconst").hide();
@ -381,7 +381,7 @@ jQuery(document).ready(function() {
</script> </script>
<?php <?php
} }
$form=new Form($db); $form=new Form($db);

View File

@ -1744,7 +1744,8 @@ class Holiday extends CommonObject
} }
} }
else else
{ // Si faux donc return array {
// Si faux donc return array
// List for Dolibarr users // List for Dolibarr users
if ($type) if ($type)
{ {
@ -1757,49 +1758,47 @@ class Holiday extends CommonObject
$sql.= " WHERE (ug.fk_user = u.rowid"; $sql.= " WHERE (ug.fk_user = u.rowid";
$sql.= " AND ug.entity = ".$conf->entity.")"; $sql.= " AND ug.entity = ".$conf->entity.")";
$sql.= " OR u.admin = 1"; $sql.= " OR u.admin = 1";
} } else {
else
$sql.= " WHERE u.entity IN (0,".$conf->entity.")"; $sql.= " WHERE u.entity IN (0,".$conf->entity.")";
}
$sql.= " AND u.statut > 0"; $sql.= " AND u.statut > 0";
if ($filters) $sql.=$filters; if ($filters) $sql.=$filters;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
// Si pas d'erreur SQL // Si pas d'erreur SQL
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$tab_result = $this->holiday; $tab_result = $this->holiday;
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
// Boucles du listage des utilisateurs // Boucles du listage des utilisateurs
while($i < $num) { while($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$tab_result[$i]['rowid'] = $obj->rowid; // rowid of user $tab_result[$i]['rowid'] = $obj->rowid; // rowid of user
$tab_result[$i]['name'] = $obj->lastname; // deprecated $tab_result[$i]['name'] = $obj->lastname; // deprecated
$tab_result[$i]['lastname'] = $obj->lastname; $tab_result[$i]['lastname'] = $obj->lastname;
$tab_result[$i]['firstname'] = $obj->firstname; $tab_result[$i]['firstname'] = $obj->firstname;
$tab_result[$i]['gender'] = $obj->gender; $tab_result[$i]['gender'] = $obj->gender;
$tab_result[$i]['status'] = $obj->statut; $tab_result[$i]['status'] = $obj->statut;
$tab_result[$i]['employee'] = $obj->employee; $tab_result[$i]['employee'] = $obj->employee;
$tab_result[$i]['photo'] = $obj->photo; $tab_result[$i]['photo'] = $obj->photo;
$tab_result[$i]['fk_user'] = $obj->fk_user; // rowid of manager $tab_result[$i]['fk_user'] = $obj->fk_user; // rowid of manager
//$tab_result[$i]['type'] = $obj->type; //$tab_result[$i]['type'] = $obj->type;
//$tab_result[$i]['nb_holiday'] = $obj->nb_holiday; //$tab_result[$i]['nb_holiday'] = $obj->nb_holiday;
$i++; $i++;
}
// Retoune le tableau des utilisateurs
return $tab_result;
}
else
{
// Erreur SQL
$this->errors[]="Error ".$this->db->lasterror();
return -1;
} }
// Retoune le tableau des utilisateurs
return $tab_result;
} else {
// Erreur SQL
$this->errors[]="Error ".$this->db->lasterror();
return -1;
}
} }
else else
{ {

View File

@ -213,7 +213,7 @@ if ($object->id)
print '</tbody>'; print '</tbody>';
print '</table>'."\n"; print '</table>'."\n";
/* /*
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';

View File

@ -119,75 +119,75 @@ print '</tr>';
if ($num == 0) if ($num == 0)
{ {
print '<tr><td colspan="10" class="opacitymedium">'.$langs->trans('None').'</td></tr>'; print '<tr><td colspan="10" class="opacitymedium">'.$langs->trans('None').'</td></tr>';
} }
else else
{ {
while ($obj = $db->fetch_object($resql)) while ($obj = $db->fetch_object($resql))
{ {
$user = new User($db); $user = new User($db);
$user->fetch($obj->fk_user); $user->fetch($obj->fk_user);
$date_start = $db->jdate($obj->date_debut, true); $date_start = $db->jdate($obj->date_debut, true);
$date_end = $db->jdate($obj->date_fin, true); $date_end = $db->jdate($obj->date_fin, true);
$tmpstart = dol_getdate($date_start); $tmpstart = dol_getdate($date_start);
$tmpend = dol_getdate($date_end); $tmpend = dol_getdate($date_end);
$starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning'; $starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning';
$endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon'; $endhalfday=($obj->halfday == 1 || $obj->halfday == 2)?'morning':'afternoon';
$halfdayinmonth = $obj->halfday; $halfdayinmonth = $obj->halfday;
$starthalfdayinmonth = $starthalfday; $starthalfdayinmonth = $starthalfday;
$endhalfdayinmonth = $endhalfday; $endhalfdayinmonth = $endhalfday;
//0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning //0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
// Set date_start_gmt and date_end_gmt that are date to show for the selected month // Set date_start_gmt and date_end_gmt that are date to show for the selected month
$date_start_inmonth = $db->jdate($obj->date_debut, true); $date_start_inmonth = $db->jdate($obj->date_debut, true);
$date_end_inmonth = $db->jdate($obj->date_fin, true); $date_end_inmonth = $db->jdate($obj->date_fin, true);
if ($tmpstart['year'] < $search_year || $tmpstart['mon'] < $search_month) if ($tmpstart['year'] < $search_year || $tmpstart['mon'] < $search_month)
{ {
$date_start_inmonth = dol_get_first_day($search_year, $search_month, true); $date_start_inmonth = dol_get_first_day($search_year, $search_month, true);
$starthalfdayinmonth = 'morning'; $starthalfdayinmonth = 'morning';
if ($halfdayinmonth == 2) $halfdayinmonth=1; if ($halfdayinmonth == 2) $halfdayinmonth=1;
if ($halfdayinmonth == -1) $halfdayinmonth=0; if ($halfdayinmonth == -1) $halfdayinmonth=0;
} }
if ($tmpend['year'] > $search_year || $tmpend['mon'] > $search_month) if ($tmpend['year'] > $search_year || $tmpend['mon'] > $search_month)
{ {
$date_end_inmonth = dol_get_last_day($search_year, $search_month, true) - ((24 * 3600) - 1); $date_end_inmonth = dol_get_last_day($search_year, $search_month, true) - ((24 * 3600) - 1);
$endhalfdayinmonth = 'afternoon'; $endhalfdayinmonth = 'afternoon';
if ($halfdayinmonth == 2) $halfdayinmonth=-1; if ($halfdayinmonth == 2) $halfdayinmonth=-1;
if ($halfdayinmonth == 1) $halfdayinmonth=0; if ($halfdayinmonth == 1) $halfdayinmonth=0;
} }
// Leave request // Leave request
$holidaystatic->id=$obj->rowid; $holidaystatic->id=$obj->rowid;
$holidaystatic->ref=$obj->rowid; $holidaystatic->ref=$obj->rowid;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $holidaystatic->getNomUrl(1, 1); print $holidaystatic->getNomUrl(1, 1);
print '</td>'; print '</td>';
print '<td>' . $user->getFullName($langs) . '</td>'; print '<td>' . $user->getFullName($langs) . '</td>';
print '<td>' . $obj->label . '</td>'; print '<td>' . $obj->label . '</td>';
print '<td class="center">' . dol_print_date($db->jdate($obj->date_debut), 'day'); print '<td class="center">' . dol_print_date($db->jdate($obj->date_debut), 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>'; print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
print '</td>'; print '</td>';
print '<td class="center">' . dol_print_date($db->jdate($obj->date_fin), 'day'); print '<td class="center">' . dol_print_date($db->jdate($obj->date_fin), 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>'; print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
print '</td>'; print '</td>';
print '<td class="right">' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '</td>'; print '<td class="right">' . num_open_day($date_start, $date_end, 0, 1, $obj->halfday) . '</td>';
print '<td class="center">' . dol_print_date($date_start_inmonth, 'day'); print '<td class="center">' . dol_print_date($date_start_inmonth, 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>'; print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>';
print '</td>'; print '</td>';
print '<td class="center">' . dol_print_date($date_end_inmonth, 'day'); print '<td class="center">' . dol_print_date($date_end_inmonth, 'day');
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>'; print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>';
print '</td>'; print '</td>';
print '<td class="right">' . num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth) . '</td>'; print '<td class="right">' . num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth) . '</td>';
print '<td class="maxwidth300">' . dol_escape_htmltag(dolGetFirstLineOfText($obj->description)) . '</td>'; print '<td class="maxwidth300">' . dol_escape_htmltag(dolGetFirstLineOfText($obj->description)) . '</td>';
print '</tr>'; print '</tr>';
} }
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -265,12 +265,12 @@ class Establishment extends CommonObject
} }
} }
/** /**
* Delete record * Delete record
* *
* @param int $id Id of record to delete * @param int $id Id of record to delete
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function delete($id) public function delete($id)
{ {
$this->db->begin(); $this->db->begin();

View File

@ -1962,15 +1962,16 @@ function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
$height='24px'; $height='24px';
if ($key == 'none') {//stop multiple duplicate ids with no number if ($key == 'none') {
//stop multiple duplicate ids with no number
print "\n\n<!-- Box_no-key start-->\n"; print "\n\n<!-- Box_no-key start-->\n";
print '<div class="box boximport" style="padding:0;">' . "\n"; print '<div class="box boximport" style="padding:0;">' . "\n";
print '<table summary="boxtable_no-key" width="100%" class="nobordernopadding">' . "\n"; print '<table summary="boxtable_no-key" width="100%" class="nobordernopadding">' . "\n";
} else { } else {
print "\n\n<!-- Box ".$pos." start -->\n"; print "\n\n<!-- Box ".$pos." start -->\n";
print '<div class="box boximport" style="padding: 0;" id="boxto_' . $pos . '">' . "\n"; print '<div class="box boximport" style="padding: 0;" id="boxto_' . $pos . '">' . "\n";
print '<table summary="boxtable'.$pos.'" width="100%" class="nobordernopadding">'."\n"; print '<table summary="boxtable'.$pos.'" width="100%" class="nobordernopadding">'."\n";
} }
if ($pos && $pos > count($fieldssource)) // No fields if ($pos && $pos > count($fieldssource)) // No fields

View File

@ -118,19 +118,21 @@ if (! empty($force_install_message))
<tr> <tr>
<td class="label"><label for="main_dir"><b><?php print $langs->trans("WebPagesDirectory"); ?></b></label></td> <td class="label"><label for="main_dir"><b><?php print $langs->trans("WebPagesDirectory"); ?></b></label></td>
<?php <?php
if (empty($dolibarr_main_url_root)) { if (empty($dolibarr_main_url_root)) {
$dolibarr_main_document_root = detect_dolibarr_main_document_root(); $dolibarr_main_document_root = detect_dolibarr_main_document_root();
} }
?> ?>
<td class="label"> <td class="label">
<input type="text" <input type="text"
class="minwidth300" class="minwidth300"
id="main_dir" id="main_dir"
name="main_dir" name="main_dir"
value="<?php print $dolibarr_main_document_root ?>" value="<?php print $dolibarr_main_document_root ?>"
<?php if (!empty($force_install_noedit)) { <?php
print ' disabled'; if (!empty($force_install_noedit)) {
} ?> print ' disabled';
}
?>
> >
</td> </td>
<td class="comment"><?php <td class="comment"><?php
@ -159,9 +161,9 @@ if (! empty($force_install_message))
id="main_data_dir" id="main_data_dir"
name="main_data_dir" name="main_data_dir"
value="<?php print $dolibarr_main_data_root ?>" value="<?php print $dolibarr_main_data_root ?>"
<?php if (!empty($force_install_noedit)) { <?php if (!empty($force_install_noedit)) {
print ' disabled'; print ' disabled';
} ?> } ?>
> >
</td> </td>
<td class="comment"><?php <td class="comment"><?php
@ -191,9 +193,10 @@ if (! empty($force_install_message))
id="main_url" id="main_url"
name="main_url" name="main_url"
value="<?php print $dolibarr_main_url_root; ?> " value="<?php print $dolibarr_main_url_root; ?> "
<?php if (!empty($force_install_noedit)) { <?php if (!empty($force_install_noedit)) {
print ' disabled'; print ' disabled';
} ?> }
?>
> >
</td> </td>
<td class="comment"><?php print $langs->trans("Examples").":<br>"; ?> <td class="comment"><?php print $langs->trans("Examples").":<br>"; ?>
@ -214,19 +217,15 @@ if (! empty($force_install_message))
<input type="checkbox" <input type="checkbox"
id="main_force_https" id="main_force_https"
name="main_force_https" name="main_force_https"
<?php if (!empty($force_install_mainforcehttps)) { <?php if (!empty($force_install_mainforcehttps)) { print ' checked'; } ?>
print ' checked'; <?php if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) { print ' disabled'; } ?>
} ?>
<?php if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?> <td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?>
</td> </td>
</tr> </tr>
<?php <?php
} }
?> ?>
@ -245,9 +244,7 @@ if (! empty($force_install_message))
id="db_name" id="db_name"
name="db_name" name="db_name"
value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>" value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>"
<?php if ($force_install_noedit == 2 && $force_install_database !== null) { <?php if ($force_install_noedit == 2 && $force_install_database !== null) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td> <td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
@ -324,9 +321,7 @@ if (! empty($force_install_message))
?> ?>
<select id="db_type" <select id="db_type"
name="db_type" name="db_type"
<?php if ($force_install_noedit == 2 && $force_install_type !== null) { <?php if ($force_install_noedit == 2 && $force_install_type !== null) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
<?php print $option; ?> <?php print $option; ?>
</select> </select>
@ -343,9 +338,7 @@ if (! empty($force_install_message))
id="db_host" id="db_host"
name="db_host" name="db_host"
value="<?php print (!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>" value="<?php print (!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>"
<?php if ($force_install_noedit == 2 && $force_install_dbserver !== null) { <?php if ($force_install_noedit == 2 && $force_install_dbserver !== null) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?> <td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?>
@ -360,9 +353,7 @@ if (! empty($force_install_message))
name="db_port" name="db_port"
id="db_port" id="db_port"
value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>" value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>"
<?php if ($force_install_noedit == 2 && $force_install_port !== null) { <?php if ($force_install_noedit == 2 && $force_install_port !== null) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?> <td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?>
@ -377,9 +368,7 @@ if (! empty($force_install_message))
id="db_prefix" id="db_prefix"
name="db_prefix" name="db_prefix"
value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>" value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>"
<?php if ($force_install_noedit == 2 && $force_install_prefix !== null) { <?php if ($force_install_noedit == 2 && $force_install_prefix !== null) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("DatabasePrefixDescription"); ?></td> <td class="comment"><?php echo $langs->trans("DatabasePrefixDescription"); ?></td>
@ -391,12 +380,8 @@ if (! empty($force_install_message))
<input type="checkbox" <input type="checkbox"
id="db_create_database" id="db_create_database"
name="db_create_database" name="db_create_database"
<?php if ($force_install_createdatabase) { <?php if ($force_install_createdatabase) { print ' checked'; } ?>
print ' checked'; <?php if ($force_install_noedit == 2 && $force_install_createdatabase !== null) { print ' disabled'; } ?>
} ?>
<?php if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("CheckToCreateDatabase"); ?> <td class="comment"><?php echo $langs->trans("CheckToCreateDatabase"); ?>
@ -410,9 +395,7 @@ if (! empty($force_install_message))
id="db_user" id="db_user"
name="db_user" name="db_user"
value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>" value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>"
<?php if ($force_install_noedit == 2 && $force_install_databaselogin !== null) { <?php if ($force_install_noedit == 2 && $force_install_databaselogin !== null) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td> <td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td>
@ -424,17 +407,16 @@ if (! empty($force_install_message))
<input type="password" <input type="password"
id="db_pass" autocomplete="off" id="db_pass" autocomplete="off"
name="db_pass" name="db_pass"
value="<?php value="
// If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1. <?php
$autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*')); // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1.
if (!empty($dolibarr_main_prod)) { $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
$autofill = ''; if (!empty($dolibarr_main_prod)) {
} $autofill = '';
print dol_escape_htmltag($autofill); }
?>" print dol_escape_htmltag($autofill);
<?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) { ?>"
print ' disabled'; <?php if ($force_install_noedit == 2 && $force_install_databasepass !== null) { print ' disabled'; } ?>
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td> <td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
@ -446,12 +428,8 @@ if (! empty($force_install_message))
<input type="checkbox" <input type="checkbox"
id="db_create_user" id="db_create_user"
name="db_create_user" name="db_create_user"
<?php if (!empty($force_install_createuser)) { <?php if (!empty($force_install_createuser)) { print ' checked'; } ?>
print ' checked'; <?php if ($force_install_noedit == 2 && $force_install_createuser !== null) { print ' disabled'; } ?>
} ?>
<?php if ($force_install_noedit == 2 && $force_install_createuser !== null) {
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("CheckToCreateUser"); ?> <td class="comment"><?php echo $langs->trans("CheckToCreateUser"); ?>
@ -478,9 +456,7 @@ if (! empty($force_install_message))
name="db_user_root" name="db_user_root"
class="needroot" class="needroot"
value="<?php print (!empty($force_install_databaserootlogin)) ? $force_install_databaserootlogin : @$db_user_root; ?>" value="<?php print (!empty($force_install_databaserootlogin)) ? $force_install_databaserootlogin : @$db_user_root; ?>"
<?php if ($force_install_noedit > 0 && ! empty($force_install_databaserootlogin)) { <?php if ($force_install_noedit > 0 && ! empty($force_install_databaserootlogin)) { print ' disabled'; } ?>
print ' disabled';
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?> <td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
@ -516,9 +492,7 @@ if (! empty($force_install_message))
} // Do not autofill password for remote access } // Do not autofill password for remote access
print dol_escape_htmltag($autofill); print dol_escape_htmltag($autofill);
?>" ?>"
<?php if ($force_install_noedit > 0 && ! empty($force_install_databaserootpass)) { <?php if ($force_install_noedit > 0 && ! empty($force_install_databaserootpass)) { print ' disabled'; // May be removed by javascript } ?>
print ' disabled'; // May be removed by javascript
} ?>
> >
</td> </td>
<td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?> <td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>

View File

@ -379,7 +379,7 @@ class MailmanSpip
return count($lists); return count($lists);
} }
else else
{ {
$this->error="ADHERENT_MAILMAN_URL not defined"; $this->error="ADHERENT_MAILMAN_URL not defined";
return -1; return -1;
} }

View File

@ -68,9 +68,9 @@ if (!empty($enddatemonth))
// Security check // Security check
if ($user->rights->margins->read->all) { if ($user->rights->margins->read->all) {
$agentid = GETPOST('agentid', 'int'); $agentid = GETPOST('agentid', 'int');
} else { } else {
$agentid = $user->id; $agentid = $user->id;
} }
$result=restrictedArea($user, 'margins'); $result=restrictedArea($user, 'margins');

View File

@ -360,7 +360,7 @@ if ($result)
print "<td class=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n"; print "<td class=\"right\">".(($markRate === '')?'n/a':price($markRate, null, null, null, null, $rounding)."%")."</td>\n";
print "</tr>\n"; print "</tr>\n";
print "</table>"; print "</table>";
} }
else else
{ {

View File

@ -103,13 +103,13 @@ dol_fiche_head($head, 'productMargins', $titre, 0, $picto);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
if ($id > 0) { if ($id > 0) {
print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>'; print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>';
print '<td class="maxwidthonsmartpone" colspan="4">'; print '<td class="maxwidthonsmartpone" colspan="4">';
print $form->select_produits($id, 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All'); print $form->select_produits($id, 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All');
print '</td></tr>'; print '</td></tr>';
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.datef"; if (! $sortfield) $sortfield="f.datef";
} }
else { else {
print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>'; print '<tr><td class="titlefield">'.$langs->trans('ChooseProduct/Service').'</td>';