diff --git a/ChangeLog b/ChangeLog index 96f459b4f64..d4d90a73359 100644 --- a/ChangeLog +++ b/ChangeLog @@ -76,14 +76,14 @@ New experimental modules: - Fix: [ bug #499 ] Supplier order input method not translated -- Fix: No images into product description lines as PDF generation does - not work with this. +- Fix: No images into product description lines as PDF generation does not work with this. - Fix: Errors weren't being shown in customer's & supplier's orders - Fix: Lastname wasn't being recorded in xinputuser emailing module. - Fix: [ bug #653 ] Error while creating agenda additional attributes - Fix: [ bug #654 ] Event rapport PDF showing ActionAC_OTH_AUTO - Fix: [ bug #658 ] Search on bank do not work for description - Fix: [ bug #659 ] Comment in recurrent invoices is not stored +- Fix: [ bug #622 ] Attaching wrong file when sending the invoice via e-mail For developers: - New: Add webservice for thirdparty creation and list. diff --git a/htdocs/.gitignore b/htdocs/.gitignore index b9cde1c6dcf..4d1eff0617e 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -5,3 +5,4 @@ /ovh /numberingpack /google +/skincoloreditor \ No newline at end of file diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3c16a67205a..2ec2e5c3253 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -541,7 +541,7 @@ class ActionComm extends CommonObject * @param int $fk_element Id of element action is linked to * @param string $elementtype Type of element action is linked to * @param string $filter Other filter - * @return array <0 if KO, array with actions + * @return array or string Error string if KO, array with actions if OK */ static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='') { @@ -580,9 +580,8 @@ class ActionComm extends CommonObject return $resarray; } else - { - $this->error=$db->lasterror(); - return -1; + { + return $db->lasterror(); } } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index f6316a44975..a8c268ccfee 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1817,7 +1817,7 @@ if ($action == 'presend') { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -1840,7 +1840,7 @@ if ($action == 'presend') dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref); + $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 8acf2ae85af..167f4c53268 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -204,14 +204,14 @@ else if ($action == 'add' && $user->rights->commande->creer) $action='create'; $error++; } - + if (! $error) { $object->socid=$socid; $object->fetch_thirdparty(); - + $db->begin(); - + $object->date_commande = $datecommande; $object->note = GETPOST('note'); $object->note_public = GETPOST('note_public'); @@ -226,7 +226,7 @@ else if ($action == 'add' && $user->rights->commande->creer) $object->date_livraison = $datelivraison; $object->fk_delivery_address = GETPOST('fk_address'); $object->contactid = GETPOST('contactidp'); - + // If creation from another object of another module (Example: origin=propal, originid=1) if (! empty($origin) && ! empty($originid)) { @@ -237,7 +237,7 @@ else if ($action == 'add' && $user->rights->commande->creer) $element = $regs[1]; $subelement = $regs[2]; } - + // For compatibility if ($element == 'order') { $element = $subelement = 'commande'; @@ -248,10 +248,10 @@ else if ($action == 'add' && $user->rights->commande->creer) if ($element == 'contract') { $element = $subelement = 'contrat'; } - + $object->origin = $origin; $object->origin_id = $originid; - + // Possibility to add external linked objects with hooks $object->linked_objects[$object->origin] = $object->origin_id; $other_linked_objects=GETPOST('other_linked_objects','array'); @@ -259,32 +259,32 @@ else if ($action == 'add' && $user->rights->commande->creer) { $object->linked_objects = array_merge($object->linked_objects, $other_linked_objects); } - + $object_id = $object->create($user); - + if ($object_id > 0) { dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - + $classname = ucfirst($subelement); $srcobject = new $classname($db); - + dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines"); $result=$srcobject->fetch($object->origin_id); if ($result > 0) { $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); - + $fk_parent_line=0; $num=count($lines); - + for ($i=0;$i<$num;$i++) { $label=(! empty($lines[$i]->label)?$lines[$i]->label:''); $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); $product_type=(! empty($lines[$i]->product_type)?$lines[$i]->product_type:0); - + // Dates // TODO mutualiser $date_start=$lines[$i]->date_debut_prevue; @@ -293,12 +293,12 @@ else if ($action == 'add' && $user->rights->commande->creer) $date_end=$lines[$i]->date_fin_prevue; if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; - + // Reset fk_parent_line for no child products and special product if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } - + $result = $object->addline( $object_id, $desc, @@ -323,19 +323,19 @@ else if ($action == 'add' && $user->rights->commande->creer) $lines[$i]->pa_ht, $label ); - + if ($result < 0) { $error++; break; } - + // Defined the new fk_parent_line if ($result > 0 && $lines[$i]->product_type == 9) { $fk_parent_line = $result; } } - + // Hooks $parameters=array('objFrom'=>$srcobject); $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -356,7 +356,7 @@ else if ($action == 'add' && $user->rights->commande->creer) else { $object_id = $object->create($user); - + // If some invoice's lines already known $NBLINES=8; for ($i = 1 ; $i <= $NBLINES ; $i++) @@ -370,7 +370,7 @@ else if ($action == 'add' && $user->rights->commande->creer) } } } - + // Insert default contacts if defined if ($object_id > 0) { @@ -383,11 +383,11 @@ else if ($action == 'add' && $user->rights->commande->creer) $error++; } } - + $id = $object_id; $action = ''; } - + // End of object creation, we show it if ($object_id > 0 && ! $error) { @@ -1405,7 +1405,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; $datedelivery = (!empty($objectsrc->date_livraison)?$objectsrc->date_livraison:''); - + $note_private = (! empty($objectsrc->note) ? $objectsrc->note : (! empty($objectsrc->note_private) ? $objectsrc->note_private : '')); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); @@ -2347,7 +2347,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G { $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -2370,7 +2370,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref); + $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f1a684387e0..809bd6eb452 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2689,7 +2689,7 @@ else if ($id > 0 || ! empty($ref)) { $num = $db->num_rows($result); $i = 0; - + //if ($object->type != 2) //{ if ($num > 0) @@ -3343,7 +3343,7 @@ else if ($id > 0 || ! empty($ref)) $ref = dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $file=$fileparams['fullname']; // Build document if it not exists @@ -3366,7 +3366,7 @@ else if ($id > 0 || ! empty($ref)) dol_print_error($db,$result); exit; } - $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref); + $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/')); $file=$fileparams['fullname']; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 04dd81a3da5..cf18ea17974 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -145,7 +145,7 @@ class FormActions require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $listofactions=ActionComm::getActions($this->db, $socid, $object->id, $typeelement); - if (is_numeric($listofactions) && $listofactions < 0) dol_print_error($this->db,'FailedToGetActions'); + if (! is_array($listofactions)) dol_print_error($this->db,'FailedToGetActions'); $num = count($listofactions); if ($num) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d541808ae36..15ea8b2cc2c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -378,7 +378,7 @@ class FormFile $out.= ''; $out.= '