Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-01-21 12:26:50 +01:00
commit 9a5670787f
8 changed files with 86 additions and 35 deletions

View File

@ -771,7 +771,7 @@ class ExtraFields
} }
elseif ($type == 'varchar') elseif ($type == 'varchar')
{ {
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>'; $out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keysuffix.'options_'.$key.$keyprefix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
} }
elseif (in_array($type, array('mail', 'phone', 'url'))) elseif (in_array($type, array('mail', 'phone', 'url')))
{ {

View File

@ -129,7 +129,7 @@ class pdf_crabe extends ModelePDFFactures
$this->posxqty=145; $this->posxqty=145;
} }
$this->posxdiscount=162; $this->posxdiscount=162;
$this->posxprogress=174; // Only displayed for situation invoices $this->posxprogress=126; // Only displayed for situation invoices
$this->postotalht=174; $this->postotalht=174;
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
@ -309,16 +309,20 @@ class pdf_crabe extends ModelePDFFactures
//$this->postotalht; //$this->postotalht;
} }
$progress_width = 0;
// Situation invoice handling // Situation invoice handling
if ($object->situation_cycle_ref) if ($object->situation_cycle_ref)
{ {
$this->situationinvoice = True; $this->situationinvoice = True;
$progress_width = 14; $progress_width = 18;
$this->posxtva -= $progress_width; $this->posxtva -= $progress_width;
$this->posxup -= $progress_width; $this->posxup -= $progress_width;
$this->posxqty -= $progress_width; $this->posxqty -= $progress_width;
$this->posxdiscount -= $progress_width; if(empty($conf->global->PRODUCT_USE_UNITS)) {
$this->posxprogress -= $progress_width; $this->posxprogress += $progress_width;
}
/*$this->posxdiscount -= $progress_width;
$this->posxprogress -= $progress_width;*/
} }
// New page // New page
@ -440,7 +444,7 @@ class pdf_crabe extends ModelePDFFactures
$curX = $this->posxdesc-1; $curX = $this->posxdesc-1;
$pdf->startTransaction(); $pdf->startTransaction();
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX-$progress_width,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak if ($pageposafter > $pageposbefore) // There is a pagebreak
{ {
@ -504,7 +508,12 @@ class pdf_crabe extends ModelePDFFactures
$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY); $pdf->SetXY($this->posxqty, $curY);
// Enough for 6 chars // Enough for 6 chars
if($conf->global->PRODUCT_USE_UNITS)
if ($this->situationinvoice)
{
$pdf->MultiCell($this->posxprogress-$this->posxqty-0.8, 4, $qty, 0, 'R');
}
else if($conf->global->PRODUCT_USE_UNITS)
{ {
$pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R');
} }
@ -513,6 +522,25 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R'); $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R');
} }
// Situation progress
if ($this->situationinvoice)
{
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxprogress, $curY);
if($conf->global->PRODUCT_USE_UNITS)
{
$pdf->MultiCell($this->posxunit-$this->posxprogress-1, 3, $progress, 0, 'R');
}
else if ($this->atleastonediscount)
{
$pdf->MultiCell($this->posxdiscount-$this->posxprogress-1, 3, $progress, 0, 'R');
}
else
{
$pdf->MultiCell($this->postotalht-$this->posxprogress-1, 3, $progress, 0, 'R');
}
}
// Unit // Unit
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
@ -526,15 +554,7 @@ class pdf_crabe extends ModelePDFFactures
{ {
$pdf->SetXY($this->posxdiscount-2, $curY); $pdf->SetXY($this->posxdiscount-2, $curY);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
$pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
}
// Situation progress
if ($this->situationinvoice)
{
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R');
} }
// Total HT line // Total HT line
@ -1374,7 +1394,12 @@ class pdf_crabe extends ModelePDFFactures
if (empty($hidetop)) if (empty($hidetop))
{ {
$pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->SetXY($this->posxqty-1, $tab_top+1);
if($conf->global->PRODUCT_USE_UNITS)
if($this->situationinvoice)
{
$pdf->MultiCell($this->posxprogress-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
}
else if($conf->global->PRODUCT_USE_UNITS)
{ {
$pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C');
} }
@ -1384,6 +1409,30 @@ class pdf_crabe extends ModelePDFFactures
} }
} }
if ($this->situationinvoice) {
$pdf->line($this->posxprogress - 1, $tab_top, $this->posxprogress - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posxprogress, $tab_top+1);
if($conf->global->PRODUCT_USE_UNITS)
{
$pdf->MultiCell($this->posxunit-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C');
}
else if ($this->atleastonediscount)
{
$pdf->MultiCell($this->posxdiscount-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C');
}
else
{
$pdf->MultiCell($this->postotalht-$this->posxprogress,2, $outputlangs->transnoentities("Progress"),'','C');
}
}
}
if($conf->global->PRODUCT_USE_UNITS) { if($conf->global->PRODUCT_USE_UNITS) {
$pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
if (empty($hidetop)) { if (empty($hidetop)) {

View File

@ -595,7 +595,7 @@ if (empty($reshook))
} }
} }
// Classify Billed // Classify unbilled
else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer)
{ {
$result=$object->setStatut(1); $result=$object->setStatut(1);
@ -610,7 +610,7 @@ if (empty($reshook))
} }
} }
// Classify Billed // Classify Done
else if ($action == 'classifydone' && $user->rights->ficheinter->creer) else if ($action == 'classifydone' && $user->rights->ficheinter->creer)
{ {
$result=$object->setStatut(3); $result=$object->setStatut(3);

View File

@ -368,7 +368,7 @@ if ($id > 0 || ! empty($ref)) {
print "</td></tr>"; print "</td></tr>";
if ($object->methode_commande) { if ($object->methode_commande) {
print '<tr><td>' . $langs->trans("Method") . '</td><td>' . $object->methode_commande . '</td></tr>'; print '<tr><td>' . $langs->trans("Method") . '</td><td>' . $commande->getInputMethod() . '</td></tr>';
} }
} }

View File

@ -129,6 +129,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= ", ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= ' AND f.entity IN ('.getEntity('facture', 1).')';
$sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND sc.fk_soc = f.fk_soc";
$sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
if (! empty($conf->global->AGENT_CONTACT_TYPE)) if (! empty($conf->global->AGENT_CONTACT_TYPE))
@ -136,7 +137,7 @@ if (! empty($conf->global->AGENT_CONTACT_TYPE))
else else
$sql .= " AND sc.fk_user = u.rowid"; $sql .= " AND sc.fk_user = u.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
if ($agentid > 0) { if ($agentid > 0) {
if (! empty($conf->global->AGENT_CONTACT_TYPE)) if (! empty($conf->global->AGENT_CONTACT_TYPE))

View File

@ -180,7 +180,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND s.entity = ".$conf->entity; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
$sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
if ($client) if ($client)

View File

@ -175,8 +175,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product";
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.fk_soc = s.rowid"; $sql.= ' AND f.entity IN ('.getEntity('facture', 1).')';
$sql.= " AND f.fk_statut > 0"; $sql.= " AND f.fk_statut > 0";
$sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_facture = f.rowid";
if ($id > 0) if ($id > 0)

View File

@ -1061,6 +1061,7 @@ class User extends CommonObject
$this->town = $contact->town; $this->town = $contact->town;
$this->state_id = $contact->state_id; $this->state_id = $contact->state_id;
$this->country_id = $contact->country_id; $this->country_id = $contact->country_id;
$this->employee = 0;
if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4));
$this->login = $login; $this->login = $login;