diff --git a/ChangeLog b/ChangeLog index fffd210862cdab7e39a204fa505ed7d2b0822b73..4a88f51c07d4872674757ab09be25568beb0853e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ***** +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 properly in module configuration Fix: [ bug #1416 ] Supplier order does not list document models in the select box of the supplier order card Fix: [ bug #1443 ] Payment conditions is erased after editing supplier invoice label or 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 ***** Fix: Error on field accountancy code for export profile of invoices. diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 398f17c13c4f5a25a99f7e62b3d07b6dd7c1ab7f..d89b406280b1f543972e81d73266cc32a35514b1 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -76,7 +76,7 @@ else if ($action == 'set_SHIPPING_FREE_TEXT') $freetext=GETPOST('SHIPPING_FREE_TEXT','alpha'); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - if ($res < 0) + if ($res > 0) setEventMessage($langs->trans("SetupSaved")); else setEventMessage($langs->trans("Error"), 'errors'); @@ -87,7 +87,7 @@ else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - if ($res < 0) + if ($res > 0) setEventMessage($langs->trans("SetupSaved")); else setEventMessage($langs->trans("Error"), 'errors'); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index a9ec591cf5fb3e5067ebadebda2a645ab74c8a81..63220ce415e8b109aec8c00feaaf9d8e559fc2d5 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -178,7 +178,8 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr } } else { $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); $result = $interface->run_triggers('PROPAL_SENTBYMAIL', $object, $user, $langs, $conf); if ($result < 0) { - $error ++; + $error++; $object->errors = $interface->errors; } // 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); // 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_ttc = $prod->multiprices_ttc [$object->client->price_level]; $price_min = $prod->multiprices_min [$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'; $prodcustprice = new Productcustomerprice($db); @@ -631,7 +637,9 @@ else if ($action == 'addline' && $user->rights->propal->creer) { $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; } } - } else { + } + else + { $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e2b0f5506fb6bdca7f0b8cfd07be28d51b5e2639..c70e8b9e8837c4e9a2474dfeb2877646a8113747 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -453,8 +453,13 @@ class Commande extends CommonOrder } else { - $this->db->rollback(); - return -1; + foreach($this->errors as $errmsg) + { + 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 { $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(); - return -1; + return -1*$error; } } else @@ -808,8 +819,19 @@ class Commande extends CommonOrder // Fin appel triggers } - $this->db->commit(); - return $this->id; + if (!$error) { + $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 { @@ -1795,7 +1817,7 @@ class Commande extends CommonOrder else { $this->db->rollback(); - $this->error=$this->db->lasterror(); + $this->error=$line->error; return -1; } } @@ -2229,9 +2251,14 @@ class Commande extends CommonOrder else { $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(); - return -2; + return -1*$error; } } else @@ -2397,11 +2424,10 @@ class Commande extends CommonOrder } else { - $this->error=$this->db->lasterror(); - $this->errors=array($this->db->lasterror()); - $this->db->rollback(); - dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR); - return -1; + $this->error=$this->line->error; + + $this->db->rollback(); + return -1; } } else @@ -2519,9 +2545,13 @@ class Commande extends CommonOrder else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); - $this->db->rollback(); - 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; } } @@ -3154,6 +3184,8 @@ class OrderLine extends CommonOrderLine $error=0; + $this->db->begin(); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; dol_syslog("OrderLine::delete sql=".$sql); @@ -3179,7 +3211,18 @@ class OrderLine extends CommonOrderLine if ($result < 0) { $error++; $this->errors=$interface->errors; } // 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 { @@ -3295,8 +3338,18 @@ class OrderLine extends CommonOrderLine // Fin appel triggers } - $this->db->commit(); - 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 { @@ -3403,8 +3456,18 @@ class OrderLine extends CommonOrderLine // Fin appel triggers } - $this->db->commit(); - return 1; + if (!$error) { + $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 { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 7c1f0d30d25dc8651eb106e9e614893863d4fd72..172fa7e3eae217487f9f745467e0efd9c9c51617 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -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 // Action clone object -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>'; - } else { - if ($object->id > 0) { - $result = $object->createFromClone($socid); - if ($result > 0) { - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); - exit(); - } else { - $mesg = '<div class="error">' . $object->error . '</div>'; - $action = ''; +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>'; + } + else + { + if ($object->id > 0) + { + // Because createFromClone modifies the object, we must clone it so that we can restore it later + $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) { if ($object->statut == 3) { $result = $object->set_reopen($user); - if ($result > 0) { - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); - exit(); - } else { - $mesg = '<div class="error">' . $object->error . '</div>'; + if ($result > 0) + { + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + else + { + setEventMessage($object->error, 'errors'); } } } @@ -139,9 +154,10 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->comm $result = $object->delete($user); if ($result > 0) { header('Location: index.php'); - exit(); - } else { - $mesg = '<div class="error">' . $object->error . '</div>'; + exit; + } + 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); } - header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id); - exit(); - } else { - $mesg = '<div class="error">' . $object->error . '</div>'; + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } + 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) { - $ret = $object->classifyBilled(); +else if ($action == 'classifybilled' && $user->rights->commande->creer) +{ + $ret=$object->classifyBilled(); + + if ($ret < 0) { + setEventMessage($object->error, 'errors'); + } } // 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); // 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_ttc = $prod->multiprices_ttc [$object->client->price_level]; $price_min = $prod->multiprices_min [$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'; $prodcustprice = new Productcustomerprice($db); @@ -574,7 +602,9 @@ else if ($action == 'addline' && $user->rights->commande->creer) { $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; } } - } else { + } + else + { $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $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) { $result = $object->cloture($user); - if ($result < 0) - $mesgs = $object->errors; + if ($result < 0) { + setEventMessage($object->error, 'errors'); + } } 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) { $result = $object->cancel($idwarehouse); + + if ($result < 0) { + setEventMessage($object->error, 'errors'); + } } } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b6837d68a9810a5260785e91475e541095c54631..b22f1c9827e7b0bd8a8f8b8dcf5ba30b3107d18a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1137,12 +1137,17 @@ else if ($action == 'addline' && $user->rights->facture->creer) $tva_npr = get_default_npr($mysoc, $object->client, $prod->id); // 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_ttc = $prod->multiprices_ttc [$object->client->price_level]; $price_min = $prod->multiprices_min [$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'; $prodcustprice = new Productcustomerprice($db); @@ -1159,7 +1164,9 @@ else if ($action == 'addline' && $user->rights->facture->creer) $prod->tva_tx = $prodcustprice->lines [0]->tva_tx; } } - } else { + } + else + { $pu_ht = $prod->price; $pu_ttc = $prod->price_ttc; $price_min = $prod->price_min; @@ -1606,7 +1613,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $interface = new Interfaces($db); $result = $interface->run_triggers('BILL_SENTBYMAIL', $object, $user, $langs, $conf); if ($result < 0) { - $error ++; + $error++; $object->errors = $interface->errors; } // Fin appel triggers diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index fcf53d8254c6899318db20339f2c20514779ae0a..bc2a71205153aae0d54c2365ea6117c4487c75c7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -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>'; } diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 2c371d4afcd9e6a66a8cbbaeb2c6ecf87210534e..b32282782614f8de4a19cd58921c0e0efb1ba1d6 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -77,7 +77,7 @@ class FormProjets $sql.= " WHERE p.entity = ".$conf->entity; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; 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); $resql=$this->db->query($sql); @@ -113,6 +113,7 @@ class FormProjets else { $disabled=0; + $labeltoshow.=' '.dol_trunc($obj->title,$maxlength); if (! $obj->fk_statut > 0) { $disabled=1; @@ -134,8 +135,8 @@ class FormProjets if ($disabled) $resultat.=' disabled="disabled"'; //if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; - $resultat.='>'.$labeltoshow; - if (! $disabled) $resultat.=' - '.dol_trunc($obj->title,$maxlength); + $resultat.='>'; + $resultat.=$labeltoshow; $resultat.='</option>'; } $out.= $resultat; @@ -167,6 +168,7 @@ class FormProjets */ function select_element($table_element) { + global $conf; $projectkey="fk_projet"; switch ($table_element) @@ -194,7 +196,7 @@ class FormProjets if (!empty($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"; dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG); @@ -218,6 +220,10 @@ class FormProjets return $sellist ; $this->db->free($resql); + }else { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this) . "::select_element " . $this->error, LOG_ERR); + return -1; } } diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index 0223117ec501ea8c62b9bbe78c03c4f3cd0bd94f..a5e1410d503407aaa8a77df4e9cfd0d3e3453baf 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -810,6 +810,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, var input = this.input = $( "<input>" ) .insertAfter( select ) .val( value ) + .attr('id', 'inputautocomplete'+select.attr('id')) .autocomplete({ delay: 0, minLength: this.options.minLengthToAutocomplete, diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 2f5e217641f8e68f3aeff58ad06f460b6c99e5ff..19441e507aaefe0bd5203e9e2a9a23099567dbc1 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -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))); 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 module is not activated disqualified + if (empty($conf->global->$const_name)) $modulequalified=0; if ($modulequalified) { diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 55815324487b8d8c9b483f1deb439e7ed9800f33..f36dc59c43a32693906c661cb38815de5bdaea8e 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -368,6 +368,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) } }); $("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(""); + } }); } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 614c55305fc1e5820f4d2a5b9c7d95d11dc7dafa..c1dde592ab6f4bc2e1594f3cf5220a0024833ee6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -348,7 +348,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target // 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) || ! 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); // 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 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) || ! 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); // Fax if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax); diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 8e158037f8a5772b234ef9d8322dcf3d89f74f32..5385d7ad0e68816174d827946201022ddc27d016 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -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'); - $blDestX=$blExpX+55; $blW=50; $Yoff = $Ydef +1; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 648156e5befd4c06cbbffb756afe10025a9df08c..fe952fb9903cde3dc909ae6f2ad85514fd7190a7 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -630,7 +630,7 @@ class pdf_azur extends ModelePDFPropales $posxval=52; // Show shipping date - if ($object->date_livraison) + if (! empty($object->date_livraison)) { $outputlangs->load("sendings"); $pdf->SetFont('','B', $default_font_size - 2); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 63b301253ab1e4dd35cc3285c7202533f26fc2cc..f15cab9cb6bc6492f3422ec13d09dd1f213a24ed 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -911,6 +911,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $outputlangs->load("bills"); $outputlangs->load("orders"); $outputlangs->load("companies"); + $outputlangs->load("sendings"); $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -981,11 +982,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $posy+=5; $pdf->SetXY($posx,$posy); - if ($object->date_commande) + if (! empty($object->date_commande)) { $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(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : " . dol_print_date($object->date_livraison,"day",false,$outputlangs,true), '', 'R'); } else { @@ -993,6 +993,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $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; $pdf->SetTextColor(0,0,60); @@ -1094,7 +1097,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders */ 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); } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b7a94bc28c46e6291725db9d9bdda166a5eb7716..93c7f63b4adf3ddde8ae8f6045c6d1b135b16e05 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -282,8 +282,22 @@ class Expedition extends CommonObject if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers - $this->db->commit(); - return $this->id; + if (! $error) + { + $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 { diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 22df11dd7ae7e151e9e34cc69723eece04c045fc..286c3d453013dc574aae1942f158bad4e93fd0d4 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1860,8 +1860,6 @@ elseif (! empty($object->id)) 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 @@ -1890,10 +1888,6 @@ elseif (! empty($object->id)) $formactions=new FormActions($db); $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) { @@ -1962,7 +1956,6 @@ elseif (! empty($object->id)) */ print '</div></div></div>'; - //print '</td></tr></table>'; } /* diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 46932f5de970e66ba1813aea9c4af4922b564bf8..b2f803d5d2a87c8252dcf73eeca500b87aa36bd7 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1197,10 +1197,10 @@ if ($action == 'create') { print $form->select_company((empty($_GET['socid'])?'':$_GET['socid']),'socid','s.fournisseur = 1',1); } - print '</td>'; + print '</td></tr>'; // 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><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">'; @@ -1287,7 +1287,7 @@ if ($action == 'create') print '</td></tr>'; // 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 print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td>'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 1f75abf0915583525c5070a1990f7743a6c208cb..673ac3fea6f33f6777e5aac46950f054176a2c93 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -119,7 +119,7 @@ if ($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')); foreach ($filtrearr as $fil) @@ -191,15 +191,16 @@ if ($resql) $soc->fetch($socid); } - $param='&socid='.$socid; - if ($month) $param.='&month='.urlencode($month); - if ($year) $param.='&year=' .urlencode($year); - if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref")); - if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier")); - if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle")); - if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe")); - if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht")); - if (GETPOST("search_montant_ttc")) $param.='&search_montant_ttc='.urlencode(GETPOST("search_montant_ttc")); + $param='&socid='.$socid; + if ($month) $param.='&month='.urlencode($month); + if ($year) $param.='&year=' .urlencode($year); + if (GETPOST("search_ref")) $param.='&search_ref='.urlencode(GETPOST("search_ref")); + if (GETPOST("search_ref_supplier")) $param.='&search_ref_supplier'.urlencode(GETPOST("search_ref_supplier")); + if (GETPOST("search_libelle")) $param.='&search_libelle='.urlencode(GETPOST("search_libelle")); + if (GETPOST("search_societe")) $param.='&search_societe='.urlencode(GETPOST("search_societe")); + if (GETPOST("search_montant_ht")) $param.='&search_montant_ht='.urlencode(GETPOST("search_montant_ht")); + 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 '<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 '</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 '</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 '</td>'; print "</tr>\n"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 0a56b5253a9b8d79cdd355307da245f80ec5f9b4..697d773f02c190e452fb60f9214287e98ec5274b 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -852,7 +852,7 @@ class Task extends CommonObject $this->id = $obj->fk_task; $this->timespent_date = $obj->task_date; $this->timespent_duration = $obj->task_duration; - $this->timespent_user = $obj->fk_user; + $this->timespent_fk_user = $obj->fk_user; $this->timespent_note = $obj->note; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 322820b361d401a04dd8c3af6254b9a2e5c94911..6101f33747165b1c5d39fe1886ae7fa0c5645548 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -222,13 +222,18 @@ foreach ($listofreferent as $key => $value) $classname=$value['class']; $tablename=$value['table']; $qualified=$value['test']; + if ($qualified) { print '<br>'; print_titre($langs->trans($title)); - + $selectList=$formproject->select_element($tablename); + if ($selectList<0) { + setEventMessage($formproject->error,'errors'); + } + if ($selectList) { print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$projectid.'" method="post">'; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index d1fbf0d10ee8af6c1290baa39c47414feef84d5b..123b4a611b47a94bace28aa3241571d06005b5af 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -56,7 +56,7 @@ if ($object->id > 0) } // Security check -$socid=0; +$socid=GETPOST('socid'); if ($user->societe_id > 0) $socid=$user->societe_id; $result = restrictedArea($user, 'projet', $object->id); @@ -384,6 +384,10 @@ if ($action == 'create' && $user->rights->projet->creer) /* * Create */ + + $thirdparty=new Societe($db); + if ($socid > 0) $thirdparty->fetch($socid); + print_fiche_titre($langs->trans("NewProject")); dol_htmloutput_mesg($mesg); @@ -396,12 +400,28 @@ if ($action == 'create' && $user->rights->projet->creer) print '<table class="border" width="100%">'; $defaultref=''; - $obj = 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")) + $modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON; + + // 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'; - $modProject = new $obj; - $defaultref = $modProject->getNextValue($soc,$object); + $file=dol_buildpath($reldir."core/modules/project/".$modele.'.php',0); + if (file_exists($file)) + { + $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='';