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

Conflicts:
	htdocs/commande/class/api_commande.class.php
	htdocs/compta/facture/class/api_invoice.class.php
	htdocs/product/class/api_product.class.php
	htdocs/societe/class/api_contact.class.php
	htdocs/societe/class/api_thirdparty.class.php
This commit is contained in:
Laurent Destailleur 2016-08-02 17:43:12 +02:00
commit f0c75388cb
21 changed files with 135 additions and 66 deletions

View File

@ -3,7 +3,7 @@
Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans). Dolibarr ERP & CRM est un logiciel moderne pour gérer votre activité (société, association, auto-entrepreneurs, artisans).
Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...). Il est simple d'utilisation et modulaire, vous permettant de n'activez que les fonctions dont vous avez besoin (contacts, fournisseurs, factures, commandes, stocks, agenda, ...).
![ScreenShot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png) ![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_640x480.png)
@ -23,7 +23,7 @@ Ubuntu) ou DoliRpm (la version tout-en-un de Dolibarr pour Fedora, Redhat,
OpenSuse, Mandriva ou Mageia). OpenSuse, Mandriva ou Mageia).
Vous pouvez les télécharger depuis la rubrique *download* du portail officiel: Vous pouvez les télécharger depuis la rubrique *download* du portail officiel:
http://www.dolibarr.org/ https://www.dolibarr.org/
Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (Mysql), Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (Mysql),
vous pouvez installer Dolibarr avec cette version de la manière suivante: vous pouvez installer Dolibarr avec cette version de la manière suivante:
@ -139,13 +139,13 @@ Suivez le projet Dolibarr project sur les réseaux francophones
- Facebook: <https://www.facebook.com/dolibarr.fr> - Facebook: <https://www.facebook.com/dolibarr.fr>
- Google+: <https://plus.google.com/+DolibarrFrance> - Google+: <https://plus.google.com/+DolibarrFrance>
- Twitter: <http://www.twitter.com/dolibarr_france> - Twitter: <https://www.twitter.com/dolibarr_france>
ou sur les réseaux anglophones ou sur les réseaux anglophones
- [Facebook](https://www.facebook.com/dolibarr) - [Facebook](https://www.facebook.com/dolibarr)
- [Google+](https://plus.google.com/+DolibarrOrg) - [Google+](https://plus.google.com/+DolibarrOrg)
- [Twitter](http://www.twitter.com/dolibarr) - [Twitter](https://www.twitter.com/dolibarr)
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr) - [GitHub](https://github.com/Dolibarr/dolibarr)

View File

@ -10,7 +10,7 @@ You can freely use, study, modify or distribute it according to its Free Softwar
You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN. You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN.
![ScreenShot](http://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png) ![ScreenShot](https://www.dolibarr.org/images/dolibarr_screenshot1_640x400.png)
## LICENSE ## LICENSE
@ -24,7 +24,7 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
### Download ### Download
Releases can be downloaded from [official website](http://www.dolibarr.org/). Releases can be downloaded from [official website](https://www.dolibarr.org/).
### Simple setup ### Simple setup
@ -133,7 +133,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
### Extending ### Extending
Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](http://www.dolistore.com). Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](https://www.dolistore.com).
## FUTURE ## FUTURE
@ -165,7 +165,7 @@ Follow Dolibarr project on:
- [Facebook](https://www.facebook.com/dolibarr) - [Facebook](https://www.facebook.com/dolibarr)
- [Google+](https://plus.google.com/+DolibarrOrg) - [Google+](https://plus.google.com/+DolibarrOrg)
- [Twitter](http://www.twitter.com/dolibarr) - [Twitter](https://www.twitter.com/dolibarr)
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr) - [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM) - [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr) - [GitHub](https://github.com/Dolibarr/dolibarr)

View File

@ -160,6 +160,7 @@ class CommandeApi extends DolibarrApi
if ($result) if ($result)
{ {
$i=0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {

View File

@ -665,7 +665,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'; print '<td class="nobordernopadding nowrap">';
print $generic_commande->getNomUrl(1,$objp->fk_statut); print $generic_commande->getNomUrl(1,0);
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding nowrap">'; print '<td width="20" class="nobordernopadding nowrap">';

View File

@ -158,6 +158,7 @@ class InvoiceApi extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {

View File

@ -366,7 +366,7 @@ $sql.=$hookmanager->resPrint;
if (! $sall) if (! $sall)
{ {
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, fk_mode_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
$sql.= ' f.datec, f.tms,'; $sql.= ' f.datec, f.tms,';

View File

@ -474,13 +474,16 @@ class Contact extends CommonObject
* *
* @param int $id Id of contact * @param int $id Id of contact
* @param User $user User asking to change alert or birthday * @param User $user User asking to change alert or birthday
* @param int $notrigger 0=no, 1=yes
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function update_perso($id, $user=null) function update_perso($id, $user=null, $notrigger=0)
{ {
$error=0; $error=0;
$result=false; $result=false;
$this->db->begin();
// Mis a jour contact // Mis a jour contact
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET";
$sql.= " birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql.= " birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
@ -531,6 +534,26 @@ class Contact extends CommonObject
} }
} }
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('CONTACT_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if (! $error)
{
$this->db->commit();
return 1;
}
else
{
dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR);
$this->db->rollback();
return -$error;
}
return $result; return $result;
} }

View File

@ -135,11 +135,9 @@ $object->fetch($id, $user);
$head = contact_prepare_head($object); $head = contact_prepare_head($object);
dol_fiche_head($head, 'perso', $title, 0, 'contact');
if ($action == 'edit') if ($action == 'edit')
{ {
/* /*
* Fiche en mode edition * Fiche en mode edition
*/ */
@ -148,6 +146,8 @@ if ($action == 'edit')
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
dol_fiche_head($head, 'perso', $title, 0, 'contact');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
@ -213,7 +213,9 @@ if ($action == 'edit')
} }
print '</tr>'; print '</tr>';
print "</table><br>"; print "</table>";
dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
@ -227,6 +229,8 @@ else
{ {
// View mode // View mode
dol_fiche_head($head, 'perso', $title, 0, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
@ -285,16 +289,17 @@ else
} }
else else
{ {
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.$langs->trans("Unknown")."</td>"; print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3"></td>';
} }
print "</tr>"; print "</tr>";
print "</table>"; print "</table>";
print '</div>'; print '</div>';
dol_fiche_end();
} }
dol_fiche_end();
if ($action != 'edit') if ($action != 'edit')
{ {

View File

@ -172,7 +172,7 @@ if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall); $sql .= natural_search(array_keys($fieldstosearchall), $sall);
} }
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid"; $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, s.nom, s.rowid";
$totalnboflines=0; $totalnboflines=0;
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)

View File

@ -65,7 +65,7 @@ class DolGraph
var $bgcolorgrid=array(255,255,255); // array(R,G,B) var $bgcolorgrid=array(255,255,255); // array(R,G,B)
var $datacolor; // array(array(R,G,B),...) var $datacolor; // array(array(R,G,B),...)
private $_stringtoshow; // To store string to output graph into HTML page private $stringtoshow; // To store string to output graph into HTML page
/** /**

View File

@ -163,8 +163,11 @@ function updateTotal(days,mode)
} }
} }
} }
document.getElementById('totalDay['+days+']').innerHTML = pad(total.getHours())+':'+pad(total.getMinutes()); if (document.getElementById('totalDay['+days+']')) // May be null if no task records to output (nbline is also 0 in this case)
//addText(,total.getHours()+':'+total.getMinutes()); {
document.getElementById('totalDay['+days+']').innerHTML = pad(total.getHours())+':'+pad(total.getMinutes());
//addText(,total.getHours()+':'+total.getMinutes());
}
} }
else else
{ {
@ -204,7 +207,10 @@ function updateTotal(days,mode)
} }
} }
} }
document.getElementById('totalDay['+days+']').innerHTML = total; if (document.getElementById('totalDay['+days+']')) // May be null if no task records to output (nbline is also 0 in this case)
{
document.getElementById('totalDay['+days+']').innerHTML = total;
}
} }
} }

View File

@ -333,7 +333,7 @@ function dol_include_once($relpath, $classname='')
* Return path of url or filesystem. Return alternate root if exists * Return path of url or filesystem. Return alternate root if exists
* *
* @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile * @param string $path Relative path to file (if mode=0) or relative url (if mode=1). Ie: mydir/myfile, ../myfile
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path) * @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path using same host that current url), 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file)
* @return string Full filesystem path (if mode=0), Full url path (if mode=1) * @return string Full filesystem path (if mode=0), Full url path (if mode=1)
*/ */
function dol_buildpath($path, $type=0) function dol_buildpath($path, $type=0)
@ -364,6 +364,8 @@ function dol_buildpath($path, $type=0)
$res=''; $res='';
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
if ($type == 3) $res = DOL_URL_ROOT.'/'.$path;
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{ {
if ($key == 'main') continue; if ($key == 'main') continue;
@ -379,7 +381,18 @@ function dol_buildpath($path, $type=0)
} }
if ($type == 2) if ($type == 2)
{ {
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path; $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
}
if ($type == 3)
{
global $dolibarr_main_url_root;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path;
} }
break; break;
} }
@ -1044,7 +1057,7 @@ function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
else // Other: title firstname name \n address lines \n zip town \n country else // Other: title firstname name \n address lines \n zip town \n country
{ {
$ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : ''; $ret .= $object->zip ? (($ret ? $sep : '' ).$object->zip) : '';
$ret .= ($object->town?(($object->zip?' ':$sep).$object->town):''); $ret .= ($object->town?(($object->zip?' ':($ret ? $sep : '' )).$object->town):'');
if ($object->state && in_array($object->country_code,$countriesusingstate)) if ($object->state && in_array($object->country_code,$countriesusingstate))
{ {
$ret.=($ret?", ":'').$object->state; $ret.=($ret?", ":'').$object->state;

View File

@ -2160,7 +2160,7 @@ else
// Make payments // Make payments
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
{ {
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create &amp;accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice print '<a class="butAction" href="paiement.php?facid='.$object->id.'&amp;action=create'.($object->fk_account>0?'&amp;accountid='.$object->fk_account:'').'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice
} }
// Classify paid // Classify paid

View File

@ -386,15 +386,15 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
/* /*
* Autres factures impayees * Autres factures impayees
*/ */
$sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef as df'; $sql = 'SELECT f.rowid as facid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef as df,';
$sql.= ', SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am'; $sql.= ' SUM(pf.amount) as am, SUM(pf.multicurrency_amount) as multicurrency_am';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
$sql.= " WHERE f.entity = ".$conf->entity; $sql.= " WHERE f.entity = ".$conf->entity;
$sql.= ' AND f.fk_soc = '.$object->socid; $sql.= ' AND f.fk_soc = '.$object->socid;
$sql.= ' AND f.paye = 0'; $sql.= ' AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee $sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
$sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.datef'; $sql.= ' GROUP BY f.rowid, f.ref, f.ref_supplier, f.total_ht, f.total_ttc, f.multicurrency_total_ttc, f.datef';
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -147,6 +147,7 @@ class ProductApi extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {
@ -232,6 +233,7 @@ class ProductApi extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {

View File

@ -113,7 +113,7 @@ $htmlother=new FormOther($db);
$title=$langs->trans("ProductsAndServices"); $title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,'; $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' SUM(s.reel) as stock_physique'; $sql.= ' SUM(s.reel) as stock_physique';
@ -167,7 +167,7 @@ if ($search_categ)
{ {
$sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ);
} }
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
$sql.= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock"; $sql.= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock";
if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; // Not used yet if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
@ -278,7 +278,7 @@ if ($resql)
} }
} }
if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);

View File

@ -114,7 +114,7 @@ if ($action == 'order' && isset($_POST['valid']))
$supplierpriceid = GETPOST('fourn'.$i, 'int'); $supplierpriceid = GETPOST('fourn'.$i, 'int');
//get all the parameters needed to create a line //get all the parameters needed to create a line
$qty = GETPOST('tobuy'.$i, 'int'); $qty = GETPOST('tobuy'.$i, 'int');
$desc = GETPOST('desc'.$i, 'alpha'); //$desc = GETPOST('desc'.$i, 'alpha');
$sql = 'SELECT fk_product, fk_soc, ref_fourn'; $sql = 'SELECT fk_product, fk_soc, ref_fourn';
$sql .= ', tva_tx, unitprice FROM '; $sql .= ', tva_tx, unitprice FROM ';
$sql .= MAIN_DB_PREFIX . 'product_fournisseur_price'; $sql .= MAIN_DB_PREFIX . 'product_fournisseur_price';
@ -128,8 +128,20 @@ if ($action == 'order' && isset($_POST['valid']))
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$line = new CommandeFournisseurLigne($db); $line = new CommandeFournisseurLigne($db);
$line->qty = $qty; $line->qty = $qty;
$line->desc = $desc;
$line->fk_product = $obj->fk_product; $line->fk_product = $obj->fk_product;
$product = new Product($db);
$product->fetch($obj->fk_product);
if (! empty($conf->global->MAIN_MULTILANGS))
{
$product->getMultiLangs();
}
$line->desc = $product->description;
if (! empty($conf->global->MAIN_MULTILANGS))
{
// TODO Get desc in language of thirdparty
}
$line->tva_tx = $obj->tva_tx; $line->tva_tx = $obj->tva_tx;
$line->subprice = $obj->unitprice; $line->subprice = $obj->unitprice;
$line->total_ht = $obj->unitprice * $qty; $line->total_ht = $obj->unitprice * $qty;
@ -241,7 +253,7 @@ $form = new Form($db);
$title = $langs->trans('Status'); $title = $langs->trans('Status');
$sql = 'SELECT p.rowid, p.ref, p.label,p.description, p.price,'; $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,';
$sql.= ' p.price_ttc, p.price_base_type,p.fk_product_type,'; $sql.= ' p.price_ttc, p.price_base_type,p.fk_product_type,';
$sql.= ' p.tms as datem, p.duration, p.tobuy,'; $sql.= ' p.tms as datem, p.duration, p.tobuy,';
$sql.= ' p.desiredstock, p.seuil_stock_alerte as alertstock,'; $sql.= ' p.desiredstock, p.seuil_stock_alerte as alertstock,';
@ -280,7 +292,7 @@ if ($snom) {
} }
$sql.= ' AND p.tobuy = 1'; $sql.= ' AND p.tobuy = 1';
if (!empty($canvas)) $sql .= ' AND p.canvas = "' . $db->escape($canvas) . '"'; if (!empty($canvas)) $sql .= ' AND p.canvas = "' . $db->escape($canvas) . '"';
$sql.= ' GROUP BY p.rowid, p.ref, p.label, p.price'; $sql.= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
$sql.= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms'; $sql.= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
$sql.= ', p.duration, p.tobuy'; $sql.= ', p.duration, p.tobuy';
$sql.= ', p.desiredstock, p.seuil_stock_alerte'; $sql.= ', p.desiredstock, p.seuil_stock_alerte';
@ -459,20 +471,20 @@ print_liste_field_titre($langs->trans('Supplier'), $_SERVER["PHP_SELF"], '', $pa
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<tr class="liste_titre">'. print '<tr class="liste_titre">';
'<td class="liste_titre">&nbsp;</td>'. print '<td class="liste_titre">&nbsp;</td>';
'<td class="liste_titre"><input class="flat" type="text" name="sref" size="8" value="'.dol_escape_htmltag($sref).'"></td>'. print '<td class="liste_titre"><input class="flat" type="text" name="sref" size="8" value="'.dol_escape_htmltag($sref).'"></td>';
'<td class="liste_titre"><input class="flat" type="text" name="snom" size="8" value="'.dol_escape_htmltag($snom).'"></td>'; print '<td class="liste_titre"><input class="flat" type="text" name="snom" size="8" value="'.dol_escape_htmltag($snom).'"></td>';
if (!empty($conf->service->enabled) && $type == 1) print '<td class="liste_titre">&nbsp;</td>'; if (!empty($conf->service->enabled) && $type == 1) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'. print '<td class="liste_titre">&nbsp;</td>';
'<td class="liste_titre" align="right">&nbsp;</td>'. print '<td class="liste_titre" align="right">&nbsp;</td>';
'<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" id="salert" name="salert" ' . (!empty($alertchecked)?$alertchecked:'') . '></td>'. print '<td class="liste_titre" align="right">' . $langs->trans('AlertOnly') . '&nbsp;<input type="checkbox" id="salert" name="salert" ' . (!empty($alertchecked)?$alertchecked:'') . '></td>';
'<td class="liste_titre" align="right">&nbsp;</td>'. print '<td class="liste_titre" align="right">&nbsp;</td>';
'<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco; print $searchpitco;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$prod = new Product($db); $prod = new Product($db);
@ -558,7 +570,9 @@ while ($i < ($limit ? min($num, $limit) : $num))
print '<td class="nowrap">'.$prod->getNomUrl(1, '').'</td>'; print '<td class="nowrap">'.$prod->getNomUrl(1, '').'</td>';
print '<td>' . $objp->label . '<input type="hidden" name="desc' . $i . '" value="' . $objp->description . '" ></td>'; print '<td>'.$objp->label ;
print '<input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp->description) . '">'; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST
print '</td>';
if (!empty($conf->service->enabled) && $type == 1) if (!empty($conf->service->enabled) && $type == 1)
{ {

View File

@ -393,7 +393,7 @@ class Dolresource extends CommonObject
} }
} }
} }
$sql.= " GROUP BY t.rowid, ty.label"; $sql.= " GROUP BY t.rowid, t.entity, t.ref, t.description, t.fk_code_type_resource, t.tms, ty.label";
$sql.= $this->db->order($sortfield,$sortorder); $sql.= $this->db->order($sortfield,$sortorder);
$this->num_all = 0; $this->num_all = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))

View File

@ -97,20 +97,18 @@ if($ret == -1) {
} else { } else {
print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $object->num_all,'title_generic.png'); print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $object->num_all,'title_generic.png');
} }
if(!$ret) {
print '<div class="warning">'.$langs->trans('NoResourceInDatabase').'</div>'; $var=true;
}
else print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder);
print_liste_field_titre('',"","","","",'width="60" align="center"',"","");
print "</tr>\n";
if ($ret)
{ {
$var=true;
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder);
print_liste_field_titre('',"","","","",'width="60" align="center"',"","");
print "</tr>\n";
foreach ($object->lines as $resource) foreach ($object->lines as $resource)
{ {
$var=!$var; $var=!$var;
@ -142,7 +140,10 @@ else
} }
print '</table>'; print '</table>';
}
else
{
print '<tr><td class="opacitymedium">'.$langs->trans('NoResourceInDatabase').'</td></tr>';
} }
llxFooter(); llxFooter();

View File

@ -114,6 +114,7 @@ class ContactApi extends DolibarrApi
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
} }
$search_sale = 0;
// If the internal user must only see his customers, force searching by him // If the internal user must only see his customers, force searching by him
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid)
$search_sale = DolibarrApiAccess::$user->id; $search_sale = DolibarrApiAccess::$user->id;
@ -164,7 +165,8 @@ class ContactApi extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $i = 0;
$num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);

View File

@ -211,6 +211,7 @@ class ThirdpartyApi extends DolibarrApi
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i = 0;
$num = $db->num_rows($result); $num = $db->num_rows($result);
while ($i < $num) while ($i < $num)
{ {