Merge branch '4.0' of https://github.com/Dolibarr/dolibarr.git into 4.0
This commit is contained in:
commit
ab4997d26f
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -128,6 +128,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
if (GETPOST('cancel')) $action='';
|
||||
|
||||
// Create predefined invoice
|
||||
if ($action == 'add')
|
||||
{
|
||||
@ -266,6 +268,16 @@ elseif ($action == 'classin' && $user->rights->facture->creer)
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
// Set bank account
|
||||
elseif ($action == 'setref' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'));
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->titre = GETPOST('ref', 'alpha');
|
||||
$object->ref = $object->titre;
|
||||
}
|
||||
}
|
||||
// Set bank account
|
||||
elseif ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@ -840,15 +852,15 @@ if ($action == 'create')
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Title
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat quatrevingtpercent" type="text" name="titre" value="'.$_POST["titre"].'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1,'customer').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat quatrevingtpercent" type="text" name="titre" value="'.$_POST["titre"].'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Note public
|
||||
print '<tr><td>'.$langs->trans("NotePublic").'</td><td valign="top">';
|
||||
print '<textarea class="flat centpercent" name="note_public" wrap="soft" rows="'.ROWS_4.'"></textarea>';
|
||||
@ -950,176 +962,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
$sql = 'SELECT l.fk_product, l.product_type, l.label as custom_label, l.description, l.qty, l.rowid, l.tva_tx,';
|
||||
$sql.= ' l.fk_remise_except,';
|
||||
$sql.= ' l.remise_percent, l.subprice, l.info_bits,';
|
||||
$sql.= ' l.total_ht, l.total_tva as total_vat, l.total_ttc,';
|
||||
$sql.= ' l.date_start,';
|
||||
$sql.= ' l.date_end,';
|
||||
$sql.= ' l.product_type,';
|
||||
$sql.= ' l.fk_unit,';
|
||||
$sql.= ' p.ref, p.fk_product_type, p.label as product_label,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
|
||||
$sql.= " WHERE l.fk_facture = ".$object->id;
|
||||
$sql.= " ORDER BY l.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
if ($num)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("VAT").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td>';
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td width="8%" align="left">'.$langs->trans("Unit").'</td>';
|
||||
}
|
||||
print '<td>'.$langs->trans("ReductionShort").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PriceUHT").'</td>';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">'.$langs->trans("CurrentProductPrice").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$product = New Product($db);
|
||||
$product->fetch($objp->fk_product);
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Show product and description
|
||||
$type=(isset($objp->product_type)?$objp->product_type:$objp->fk_product_type);
|
||||
$product_static->fk_unit=$objp->fk_unit;
|
||||
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
// Show product and description
|
||||
$product_static->fetch($objp->fk_product); // We need all information later
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.(! empty($objp->custom_label)?$objp->custom_label:$objp->product_label);
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description));
|
||||
print $form->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($objp->custom_label)) {
|
||||
|
||||
$text.= ' <strong>'.$objp->custom_label.'</strong>';
|
||||
print $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i);
|
||||
|
||||
} else {
|
||||
|
||||
print $text.' '.nl2br($objp->description);
|
||||
}
|
||||
|
||||
// Show range
|
||||
print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
|
||||
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
// Vat rate
|
||||
print '<td align="center">'.vatrate($objp->tva_tx).'%</td>';
|
||||
|
||||
// Qty
|
||||
print '<td align="center">'.$objp->qty.'</td>';
|
||||
|
||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||
print '<td align="left">'.$product_static->getLabelOfUnit().'</td>';
|
||||
}
|
||||
|
||||
// Percent
|
||||
if ($objp->remise_percent > 0)
|
||||
{
|
||||
print '<td align="right">'.$objp->remise_percent." %</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
// Total HT
|
||||
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||
|
||||
// Total VAT
|
||||
print '<td align="right">'.price($objp->total_vat)."</td>\n";
|
||||
|
||||
// Total TTC
|
||||
print '<td align="right">'.price($objp->total_ttc)."</td>\n";
|
||||
|
||||
// Total Unit price
|
||||
print '<td align="right">'.price($objp->subprice)."</td>\n";
|
||||
|
||||
// Current price of product
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$flag_price_may_change++;
|
||||
$prodprice=$product_static->price; // price HT
|
||||
print '<td align="right">'.price($prodprice)."</td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($result);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error();
|
||||
}
|
||||
print "</table>";
|
||||
*/
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
if ($flag_price_may_change)
|
||||
@ -1178,20 +1021,13 @@ else
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/fiche-rec.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="20%">' . $langs->trans('Ref') . '</td>';
|
||||
print '<td colspan="5">';
|
||||
$morehtmlref = '';
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
if ($result > 0) {
|
||||
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
|
||||
}
|
||||
if ($result < 0) {
|
||||
dol_print_error('', $discount->error);
|
||||
}*/
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'titre', $morehtmlref);
|
||||
print '<tr><td class="titlefield">';
|
||||
//print $langs->trans('Ref');
|
||||
print $form->editfieldkey($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer);
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
$morehtmlref = $form->editfieldval($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer, 'string');
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
@ -2127,6 +2127,7 @@ class Contrat extends CommonObject
|
||||
$this->ref_supplier = 'SPECIMENSUPP';
|
||||
$this->socid = 1;
|
||||
$this->statut= 0;
|
||||
$this->date_creation = (dol_now() - 3600 * 24 * 7);
|
||||
$this->date_contrat = dol_now();
|
||||
$this->commercial_signature_id = 1;
|
||||
$this->commercial_suivi_id = 1;
|
||||
|
||||
@ -5580,15 +5580,15 @@ class Form
|
||||
* @param string $paramid Name of parameter to use to name the id into the URL next/previous link
|
||||
* @param string $morehtml More html content to output just before the nav bar
|
||||
* @param int $shownav Show Condition (navigation is shown if value is 1)
|
||||
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
|
||||
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
|
||||
* @param string $fieldid Name of field id into database to use for select next and previous (we make the select max and min on this field)
|
||||
* @param string $fieldref Name of field ref of object (object->ref) to show or 'none' to not show ref.
|
||||
* @param string $morehtmlref More html to show after ref
|
||||
* @param string $moreparam More param to add in nav link url.
|
||||
* @param int $nodbprefix Do not include DB prefix to forge table name
|
||||
* @param string $morehtmlleft More html code to show before ref
|
||||
* @param string $morehtmlstatus More html code to show under navigation arrows (status place)
|
||||
* @param string $morehtmlright More html code to show after ref
|
||||
* @return string Portion HTML avec ref + boutons nav
|
||||
* @return string Portion HTML with ref + navigation buttons
|
||||
*/
|
||||
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='')
|
||||
{
|
||||
@ -5613,7 +5613,7 @@ class Form
|
||||
|
||||
$ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">';
|
||||
|
||||
// For thirdparty and contact, the ref is the id, so we show something else
|
||||
// For thirdparty, contact, user, member, the ref is the id, so we show something else
|
||||
if ($object->element == 'societe')
|
||||
{
|
||||
$ret.=dol_htmlentities($object->name);
|
||||
@ -5622,7 +5622,7 @@ class Form
|
||||
{
|
||||
$ret.=dol_htmlentities($object->getFullName($langs));
|
||||
}
|
||||
else $ret.=dol_htmlentities($object->$fieldref);
|
||||
else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref);
|
||||
if ($morehtmlref)
|
||||
{
|
||||
$ret.=' '.$morehtmlref;
|
||||
|
||||
@ -59,6 +59,9 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
|
||||
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
|
||||
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
|
||||
|
||||
// TLSv1 by default or change to TLSv1.2 in module configuration
|
||||
//curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->MAIN_CURL_SSLVERSION)?1:$conf->global->MAIN_CURL_SSLVERSION));
|
||||
|
||||
//turning off the server and peer verification(TrustManager Concept).
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
|
||||
@ -554,7 +554,7 @@ class pdf_strato extends ModelePDFContract
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_creation,"day",false,$outputlangs,true), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_contrat,"day",false,$outputlangs,true), '', 'R');
|
||||
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user