Merge remote-tracking branch 'origin/3.5' into develop

Conflicts:
	htdocs/comm/propal.php
	htdocs/commande/fiche.php
	htdocs/compta/facture.php
	htdocs/core/lib/pdf.lib.php
	htdocs/core/modules/expedition/doc/pdf_merou.modules.php
	htdocs/core/modules/modProduct.class.php
	htdocs/fourn/commande/fiche.php
	htdocs/projet/fiche.php
This commit is contained in:
Laurent Destailleur
2014-06-20 15:26:02 +02:00
22 changed files with 295 additions and 106 deletions

View File

@@ -107,12 +107,35 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
***** ChangeLog for 3.5.4 compared to 3.5.3 ***** ***** ChangeLog for 3.5.4 compared to 3.5.3 *****
Fix: [ bug #1431 ] Reception and Send supplier order box has a weird top margin.
Fix: [ bug #1428 ] "Nothing" is shown in the middle of the screen in a supplier order.
Fix: The object deliverycompany was not used anymore and output of
details for delivery reports was lost during 3.5. Rewrite code to
restore feature.
Fix: [ bug #1445 ] html fix : missing </tr>
Fix: [ bug #1415 ] Intervention document model name and suppliers model names is not shown Fix: [ bug #1415 ] Intervention document model name and suppliers model names is not shown
properly in module configuration properly in module configuration
Fix: [ bug #1416 ] Supplier order does not list document models in the select box of the Fix: [ bug #1416 ] Supplier order does not list document models in the select box of the
supplier order card supplier order card
Fix: [ bug #1443 ] Payment conditions is erased after editing supplier invoice label or Fix: [ bug #1443 ] Payment conditions is erased after editing supplier invoice label or
limit date for payment limit date for payment
Fix: Filter on status was not visible when selected from url.
Fix: Filtering on status was last when asking to sort.
Fix: [ bug #1432 ] Trigger SHIPPING_CREATE ignores interception on error.
Fix: [ bug #1449 ] Trigger ORDER_CREATE, LINEORDER_DELETE, LINEORDER_UPDATE and LINEORDER_INSERT ignore interception on error.
Fix: [ bug #1450 ] Several Customer order's triggers do not report the error from the trigger handler.
Fix: [ bug #1451 ] Interrupted order clone through trigger, loads nonexistent order.
Fix: [ bug #1454 ] Mention de bas de page erroné
Fix: Do not display dictionnay for non activated module
Fix: Link element from element project pages
Fix: [ bug #1509 ] Expedition admin free text & watermark submit error
Fix: [ bug #1349 ] AJAX contact selector does not work fine in Project card
Fix: [ bug #1452 ] variable used but not defined
Fix: If multiprice level is used the VAT on addline is not correct
Fix: [ bug #1254 ] Error when using "Enter" on qty input box of a product (on supplier order part)
Fix: [ bug #1462, 1468, 1480, 1483, 1490, 1497] $this instead of $object
Fix: [ bug #1455 ] outstanding amount
Fix: [ bug #1425 ]
***** ChangeLog for 3.5.3 compared to 3.5.2 ***** ***** ChangeLog for 3.5.3 compared to 3.5.2 *****
Fix: Error on field accountancy code for export profile of invoices. Fix: Error on field accountancy code for export profile of invoices.

View File

@@ -76,7 +76,7 @@ else if ($action == 'set_SHIPPING_FREE_TEXT')
$freetext=GETPOST('SHIPPING_FREE_TEXT','alpha'); $freetext=GETPOST('SHIPPING_FREE_TEXT','alpha');
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
if ($res < 0) if ($res > 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessage($langs->trans("Error"), 'errors');
@@ -87,7 +87,7 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK')
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if ($res < 0) if ($res > 0)
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
else else
setEventMessage($langs->trans("Error"), 'errors'); setEventMessage($langs->trans("Error"), 'errors');

View File

@@ -178,7 +178,8 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
} }
} else { } else {
$langs->load("errors"); $langs->load("errors");
setEventMessage($langs->trans($object->error), 'errors'); if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
else setEventMessage($langs->trans($object->error), 'errors');
} }
} }
@@ -472,7 +473,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
$interface = new Interfaces($db); $interface = new Interfaces($db);
$result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf); $result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf);
if ($result < 0) { if ($result < 0) {
$error ++; $error++;
$object->errors = $interface->errors; $object->errors = $interface->errors;
} }
// Fin appel triggers // Fin appel triggers
@@ -609,12 +610,17 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
$tva_npr = get_default_npr($mysoc, $object->client, $prod->id); $tva_npr = get_default_npr($mysoc, $object->client, $prod->id);
// On defini prix unitaire // On defini prix unitaire
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level) { if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level)
{
$pu_ht = $prod->multiprices [$object->client->price_level]; $pu_ht = $prod->multiprices [$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; $pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level]; $price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level]; $price_base_type = $prod->multiprices_base_type [$object->client->price_level];
} elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db); $prodcustprice = new Productcustomerprice($db);
@@ -631,7 +637,9 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx; $prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
} }
} }
} else { }
else
{
$pu_ht = $prod->price; $pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc; $pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min; $price_min = $prod->price_min;

View File

@@ -453,8 +453,13 @@ class Commande extends CommonOrder
} }
else else
{ {
$this->db->rollback(); foreach($this->errors as $errmsg)
return -1; {
dol_syslog(get_class($this)."::set_reopen ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
} }
} }
@@ -580,8 +585,14 @@ class Commande extends CommonOrder
else else
{ {
$this->error=$mouvP->error; $this->error=$mouvP->error;
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback(); $this->db->rollback();
return -1; return -1*$error;
} }
} }
else else
@@ -808,8 +819,19 @@ class Commande extends CommonOrder
// Fin appel triggers // Fin appel triggers
} }
$this->db->commit(); if (!$error) {
return $this->id; $this->db->commit();
return $this->id;
}
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
} }
else else
{ {
@@ -1795,7 +1817,7 @@ class Commande extends CommonOrder
else else
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$line->error;
return -1; return -1;
} }
} }
@@ -2229,9 +2251,14 @@ class Commande extends CommonOrder
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->error();
dol_syslog(get_class($this)."::classifyBilled ".$this->error, LOG_ERR);
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback(); $this->db->rollback();
return -2; return -1*$error;
} }
} }
else else
@@ -2397,11 +2424,10 @@ class Commande extends CommonOrder
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->line->error;
$this->errors=array($this->db->lasterror());
$this->db->rollback(); $this->db->rollback();
dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR); return -1;
return -1;
} }
} }
else else
@@ -2519,9 +2545,13 @@ class Commande extends CommonOrder
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); foreach($this->errors as $errmsg)
$this->db->rollback(); {
return -1; dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
} }
} }
@@ -3154,6 +3184,8 @@ class OrderLine extends CommonOrderLine
$error=0; $error=0;
$this->db->begin();
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
dol_syslog("OrderLine::delete sql=".$sql); dol_syslog("OrderLine::delete sql=".$sql);
@@ -3179,7 +3211,18 @@ class OrderLine extends CommonOrderLine
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
return 1; if (!$error) {
$this->db->commit();
return 1;
}
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
} }
else else
{ {
@@ -3295,8 +3338,18 @@ class OrderLine extends CommonOrderLine
// Fin appel triggers // Fin appel triggers
} }
$this->db->commit(); if (!$error) {
return 1; $this->db->commit();
return 1;
}
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
} }
else else
{ {
@@ -3403,8 +3456,18 @@ class OrderLine extends CommonOrderLine
// Fin appel triggers // Fin appel triggers
} }
$this->db->commit(); if (!$error) {
return 1; $this->db->commit();
return 1;
}
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
} }
else else
{ {

View File

@@ -104,18 +104,30 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
// Action clone object // Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer) { if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { {
$mesg = '<div class="error">' . $langs->trans("NoCloneOptionsSpecified") . '</div>'; if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
} else { {
if ($object->id > 0) { $mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
$result = $object->createFromClone($socid); }
if ($result > 0) { else
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); {
exit(); if ($object->id > 0)
} else { {
$mesg = '<div class="error">' . $object->error . '</div>'; // Because createFromClone modifies the object, we must clone it so that we can restore it later
$action = ''; $orig = dol_clone($object);
$result=$object->createFromClone($socid);
if ($result > 0)
{
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
exit;
}
else
{
setEventMessage($object->error, 'errors');
$object = $orig;
$action='';
} }
} }
} }
@@ -125,11 +137,14 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->
else if ($action == 'reopen' && $user->rights->commande->creer) { else if ($action == 'reopen' && $user->rights->commande->creer) {
if ($object->statut == 3) { if ($object->statut == 3) {
$result = $object->set_reopen($user); $result = $object->set_reopen($user);
if ($result > 0) { if ($result > 0)
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); {
exit(); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
} else { exit;
$mesg = '<div class="error">' . $object->error . '</div>'; }
else
{
setEventMessage($object->error, 'errors');
} }
} }
} }
@@ -139,9 +154,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->comm
$result = $object->delete($user); $result = $object->delete($user);
if ($result > 0) { if ($result > 0) {
header('Location: index.php'); header('Location: index.php');
exit(); exit;
} else { }
$mesg = '<div class="error">' . $object->error . '</div>'; else {
setEventMessage($object->error, 'errors');
} }
} }
@@ -165,10 +181,12 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit(); exit;
} else { }
$mesg = '<div class="error">' . $object->error . '</div>'; else
{
setEventMessage($object->error, 'errors');
} }
} }
@@ -382,8 +400,13 @@ else if ($action == 'add' && $user->rights->commande->creer) {
} }
} }
else if ($action == 'classifybilled' && $user->rights->commande->creer) { else if ($action == 'classifybilled' && $user->rights->commande->creer)
$ret = $object->classifyBilled(); {
$ret=$object->classifyBilled();
if ($ret < 0) {
setEventMessage($object->error, 'errors');
}
} }
// Positionne ref commande client // Positionne ref commande client
@@ -552,12 +575,17 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$tva_npr = get_default_npr($mysoc, $object->client, $prod->id); $tva_npr = get_default_npr($mysoc, $object->client, $prod->id);
// multiprix // multiprix
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) { if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level))
{
$pu_ht = $prod->multiprices [$object->client->price_level]; $pu_ht = $prod->multiprices [$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; $pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level]; $price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level]; $price_base_type = $prod->multiprices_base_type [$object->client->price_level];
} elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db); $prodcustprice = new Productcustomerprice($db);
@@ -574,7 +602,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx; $prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
} }
} }
} else { }
else
{
$pu_ht = $prod->price; $pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc; $pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min; $price_min = $prod->price_min;
@@ -898,8 +928,9 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
$result = $object->cloture($user); $result = $object->cloture($user);
if ($result < 0) if ($result < 0) {
$mesgs = $object->errors; setEventMessage($object->error, 'errors');
}
} }
else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) { else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->commande->valider) {
@@ -916,6 +947,10 @@ else if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->comm
if (! $error) { if (! $error) {
$result = $object->cancel($idwarehouse); $result = $object->cancel($idwarehouse);
if ($result < 0) {
setEventMessage($object->error, 'errors');
}
} }
} }

View File

@@ -1137,12 +1137,17 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$tva_npr = get_default_npr($mysoc, $object->client, $prod->id); $tva_npr = get_default_npr($mysoc, $object->client, $prod->id);
// We define price for product // We define price for product
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level)) { if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->client->price_level))
{
$pu_ht = $prod->multiprices [$object->client->price_level]; $pu_ht = $prod->multiprices [$object->client->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->client->price_level]; $pu_ttc = $prod->multiprices_ttc [$object->client->price_level];
$price_min = $prod->multiprices_min [$object->client->price_level]; $price_min = $prod->multiprices_min [$object->client->price_level];
$price_base_type = $prod->multiprices_base_type [$object->client->price_level]; $price_base_type = $prod->multiprices_base_type [$object->client->price_level];
} elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db); $prodcustprice = new Productcustomerprice($db);
@@ -1159,7 +1164,9 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx; $prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
} }
} }
} else { }
else
{
$pu_ht = $prod->price; $pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc; $pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min; $price_min = $prod->price_min;
@@ -1606,7 +1613,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$interface = new Interfaces($db); $interface = new Interfaces($db);
$result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf); $result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf);
if ($result < 0) { if ($result < 0) {
$error ++; $error++;
$object->errors = $interface->errors; $object->errors = $interface->errors;
} }
// Fin appel triggers // Fin appel triggers

View File

@@ -616,7 +616,7 @@ class FormFile
} }
} }
if (count($file_list) == 0) if (count($file_list) == 0 && $headershown)
{ {
$out.='<tr><td colspan="3">'.$langs->trans("None").'</td></tr>'; $out.='<tr><td colspan="3">'.$langs->trans("None").'</td></tr>';
} }

View File

@@ -77,7 +77,7 @@ class FormProjets
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
$sql.= " ORDER BY p.title ASC"; $sql.= " ORDER BY p.ref ASC";
dol_syslog(get_class($this)."::select_projects sql=".$sql,LOG_DEBUG); dol_syslog(get_class($this)."::select_projects sql=".$sql,LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@@ -113,6 +113,7 @@ class FormProjets
else else
{ {
$disabled=0; $disabled=0;
$labeltoshow.=' '.dol_trunc($obj->title,$maxlength);
if (! $obj->fk_statut > 0) if (! $obj->fk_statut > 0)
{ {
$disabled=1; $disabled=1;
@@ -134,8 +135,8 @@ class FormProjets
if ($disabled) $resultat.=' disabled="disabled"'; if ($disabled) $resultat.=' disabled="disabled"';
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')'; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')';
$resultat.='>'.$labeltoshow; $resultat.='>';
if (! $disabled) $resultat.=' - '.dol_trunc($obj->title,$maxlength); $resultat.=$labeltoshow;
$resultat.='</option>'; $resultat.='</option>';
} }
$out.= $resultat; $out.= $resultat;
@@ -167,6 +168,7 @@ class FormProjets
*/ */
function select_element($table_element) function select_element($table_element)
{ {
global $conf;
$projectkey="fk_projet"; $projectkey="fk_projet";
switch ($table_element) switch ($table_element)
@@ -194,7 +196,7 @@ class FormProjets
if (!empty($this->societe->id)) { if (!empty($this->societe->id)) {
$sql.= " AND fk_soc=".$this->societe->id; $sql.= " AND fk_soc=".$this->societe->id;
} }
$sql.= ' AND entity='.$conf->entity; $sql.= ' AND entity='.getEntity('project');
$sql.= " ORDER BY ref DESC"; $sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG); dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);
@@ -218,6 +220,10 @@ class FormProjets
return $sellist ; return $sellist ;
$this->db->free($resql); $this->db->free($resql);
}else {
$this->error=$this->db->lasterror();
dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR);
return -1;
} }
} }

View File

@@ -810,6 +810,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
var input = this.input = $( "<input>" ) var input = this.input = $( "<input>" )
.insertAfter( select ) .insertAfter( select )
.val( value ) .val( value )
.attr('id', 'inputautocomplete'+select.attr('id'))
.autocomplete({ .autocomplete({
delay: 0, delay: 0,
minLength: this.options.minLengthToAutocomplete, minLength: this.options.minLengthToAutocomplete,

View File

@@ -937,6 +937,8 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0; if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0; if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
//If module is not activated disqualified
if (empty($conf->global->$const_name)) $modulequalified=0;
if ($modulequalified) if ($modulequalified)
{ {

View File

@@ -368,6 +368,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
} }
}); });
$("select#" + htmlname).html(response.value); $("select#" + htmlname).html(response.value);
if (response.num) {
var selecthtml_str = response.value;
var selecthtml_dom=$.parseHTML(selecthtml_str);
$("#inputautocomplete"+htmlname).val(selecthtml_dom[0][0].innerHTML);
} else {
$("#inputautocomplete"+htmlname).val("");
}
}); });
} }

View File

@@ -348,7 +348,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Phone // Phone
if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": "; if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= " / "; if (! empty($targetcontact->phone_pro) && ! empty($targetcontact->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
// Fax // Fax
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
@@ -369,7 +369,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Phone // Phone
if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": "; if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone); if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= " / "; if (! empty($targetcompany->phone) && ! empty($targetcompany->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile); if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
// Fax // Fax
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);

View File

@@ -604,7 +604,6 @@ class pdf_merou extends ModelePdfExpedition
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails'); $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,((!empty($object->contact))?$object->contact:null),$usecontact,'targetwithdetails');
$blDestX=$blExpX+55; $blDestX=$blExpX+55;
$blW=50; $blW=50;
$Yoff = $Ydef +1; $Yoff = $Ydef +1;

View File

@@ -630,7 +630,7 @@ class pdf_azur extends ModelePDFPropales
$posxval=52; $posxval=52;
// Show shipping date // Show shipping date
if ($object->date_livraison) if (! empty($object->date_livraison))
{ {
$outputlangs->load("sendings"); $outputlangs->load("sendings");
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);

View File

@@ -911,6 +911,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$outputlangs->load("bills"); $outputlangs->load("bills");
$outputlangs->load("orders"); $outputlangs->load("orders");
$outputlangs->load("companies"); $outputlangs->load("companies");
$outputlangs->load("sendings");
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -981,11 +982,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$posy+=5; $posy+=5;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
if ($object->date_commande) if (! empty($object->date_commande))
{ {
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R');
$pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
} }
else else
{ {
@@ -993,6 +993,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R');
} }
$pdf->SetTextColor(0,0,60);
if (! empty($object->date_livraison)) $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R');
$posy+=5; $posy+=5;
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
@@ -1094,7 +1097,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
*/ */
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0) function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
{ {
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext); return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
} }
} }

View File

@@ -282,8 +282,22 @@ class Expedition extends CommonObject
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
$this->db->commit(); if (! $error)
return $this->id; {
$this->db->commit();
return $this->id;
}
else
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
} }
else else
{ {

View File

@@ -1860,8 +1860,6 @@ elseif (! empty($object->id))
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
//print '<table width="100%"><tr><td width="50%" valign="top">';
//print '<a name="builddoc"></a>'; // ancre
/* /*
* Documents generes * Documents generes
@@ -1890,10 +1888,6 @@ elseif (! empty($object->id))
$formactions=new FormActions($db); $formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'order_supplier',$socid); $somethingshown=$formactions->showactions($object,'order_supplier',$socid);
print '</div></div></div>';
//print '</td><td valign="top" width="50%">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
if ($user->rights->fournisseur->commande->commander && $object->statut == 2) if ($user->rights->fournisseur->commande->commander && $object->statut == 2)
{ {
@@ -1962,7 +1956,6 @@ elseif (! empty($object->id))
*/ */
print '</div></div></div>'; print '</div></div></div>';
//print '</td></tr></table>';
} }
/* /*

View File

@@ -1197,10 +1197,10 @@ if ($action == 'create')
{ {
print $form->select_company((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1); print $form->select_company((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1);
} }
print '</td>'; print '</td></tr>';
// Ref supplier // Ref supplier
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:$fac_ori->ref).'" type="text"></td>'; print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier'])?$_POST['ref_supplier']:'').'" type="text"></td>';
print '</tr>'; print '</tr>';
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">'; print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
@@ -1287,7 +1287,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'.$langs->trans('Label').'</td><td><input size="30" name="libelle" value="'.(isset($_POST['libelle'])?$_POST['libelle']:$fac_ori->libelle).'" type="text"></td></tr>'; print '<tr><td>'.$langs->trans('Label').'</td><td><input size="30" name="libelle" value="'.(isset($_POST['libelle'])?$_POST['libelle']:'').'" type="text"></td></tr>';
// Date invoice // Date invoice
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td>'; print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td>';

View File

@@ -119,7 +119,7 @@ if ($socid)
{ {
$sql .= " AND s.rowid = ".$socid; $sql .= " AND s.rowid = ".$socid;
} }
if (GETPOST('filtre')) if (GETPOST('filtre') && GETPOST('filtre') != -1) // GETPOST('filtre') may be a string
{ {
$filtrearr = explode(",", GETPOST('filtre')); $filtrearr = explode(",", GETPOST('filtre'));
foreach ($filtrearr as $fil) foreach ($filtrearr as $fil)
@@ -191,15 +191,16 @@ if ($resql)
$soc->fetch($socid); $soc->fetch($socid);
} }
$param='&amp;socid='.$socid; $param='&socid='.$socid;
if ($month) $param.='&amp;month='.urlencode($month); if ($month) $param.='&month='.urlencode($month);
if ($year) $param.='&amp;year=' .urlencode($year); if ($year) $param.='&year=' .urlencode($year);
if (GETPOST("search_ref")) $param.='&amp;search_ref='.urlencode(GETPOST("search_ref")); if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref"));
if (GETPOST("search_ref_supplier")) $param.='&amp;search_ref_supplier'.urlencode(GETPOST("search_ref_supplier")); if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier"));
if (GETPOST("search_libelle")) $param.='&amp;search_libelle='.urlencode(GETPOST("search_libelle")); if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle"));
if (GETPOST("search_societe")) $param.='&amp;search_societe='.urlencode(GETPOST("search_societe")); if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe"));
if (GETPOST("search_montant_ht")) $param.='&amp;search_montant_ht='.urlencode(GETPOST("search_montant_ht")); if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht"));
if (GETPOST("search_montant_ttc")) $param.='&amp;search_montant_ttc='.urlencode(GETPOST("search_montant_ttc")); if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc"));
if (GETPOST("filtre") && GETPOST('filtre') != -1) $param.='&filtre='.urlencode(GETPOST("filtre"));
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->nom":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->nom":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
@@ -242,7 +243,9 @@ if ($resql)
print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.GETPOST("search_montant_ht").'">'; print '<input class="flat" type="text" size="8" name="search_montant_ht" value="'.GETPOST("search_montant_ht").'">';
print '</td><td class="liste_titre" align="right">'; print '</td><td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.GETPOST("search_montant_ttc").'">'; print '<input class="flat" type="text" size="8" name="search_montant_ttc" value="'.GETPOST("search_montant_ttc").'">';
print '</td><td class="liste_titre" colspan="2" align="center">'; print '</td><td class="liste_titre" align="center">';
$liststatus=array('paye:0'=>$langs->trans("Unpayed"), 'paye:1'=>$langs->trans("Payed"));
print $form->selectarray('filtre', $liststatus, GETPOST('filtre'), 1);
print '<input type="image" class="liste_titre" align="right" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" align="right" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@@ -852,7 +852,7 @@ class Task extends CommonObject
$this->id = $obj->fk_task; $this->id = $obj->fk_task;
$this->timespent_date = $obj->task_date; $this->timespent_date = $obj->task_date;
$this->timespent_duration = $obj->task_duration; $this->timespent_duration = $obj->task_duration;
$this->timespent_user = $obj->fk_user; $this->timespent_fk_user = $obj->fk_user;
$this->timespent_note = $obj->note; $this->timespent_note = $obj->note;
} }

View File

@@ -222,13 +222,18 @@ foreach ($listofreferent as $key => $value)
$classname=$value['class']; $classname=$value['class'];
$tablename=$value['table']; $tablename=$value['table'];
$qualified=$value['test']; $qualified=$value['test'];
if ($qualified) if ($qualified)
{ {
print '<br>'; print '<br>';
print_titre($langs->trans($title)); print_titre($langs->trans($title));
$selectList=$formproject->select_element($tablename); $selectList=$formproject->select_element($tablename);
if ($selectList<0) {
setEventMessage($formproject->error,'errors');
}
if ($selectList) if ($selectList)
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">';

View File

@@ -56,7 +56,7 @@ if ($object->id > 0)
} }
// Security check // Security check
$socid=0; $socid=GETPOST('socid');
if ($user->societe_id > 0) $socid=$user->societe_id; if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $object->id); $result = restrictedArea($user, 'projet', $object->id);
@@ -384,6 +384,10 @@ if ($action == 'create' && $user->rights->projet->creer)
/* /*
* Create * Create
*/ */
$thirdparty=new Societe($db);
if ($socid > 0) $thirdparty->fetch($socid);
print_fiche_titre($langs->trans("NewProject")); print_fiche_titre($langs->trans("NewProject"));
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);
@@ -396,12 +400,28 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$defaultref=''; $defaultref='';
$obj = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON; $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
if (! empty($conf->global->PROJECT_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.".php"))
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{ {
require_once DOL_DOCUMENT_ROOT ."/core/modules/project/".$conf->global->PROJECT_ADDON.'.php'; $file=dol_buildpath($reldir."core/modules/project/".$modele.'.php',0);
$modProject = new $obj; if (file_exists($file))
$defaultref = $modProject->getNextValue($soc,$object); {
$filefound=1;
$classname = $modele;
break;
}
}
if ($filefound)
{
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
$defaultref = $modProject->getNextValue($thirdparty,$object);
} }
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';