diff --git a/ChangeLog b/ChangeLog
index 9fb65d403a4..3a882e1bb30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -233,6 +233,10 @@ FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form
FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image
FIX [ bug 1634 ] Error deleting a project when it had many linked objects
FIX [ bug 1925 ] "Link to order" option in supplier invoices is not working properly
+FIX [ bug #3198 ] Trigger LINECONTRACT_INSERT passes Contrat as $object instead of ContratLigne
+FIX: Not showing delivery date on rouget pdf
+
+NEW: Created new ContratLigne::insert function
***** ChangeLog for 3.7.1 compared to 3.7.* *****
FIX Bug in the new photo system
diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php
index d591d377ac9..187f71e93a8 100644
--- a/htdocs/adherents/admin/public.php
+++ b/htdocs/adherents/admin/public.php
@@ -219,7 +219,12 @@ print '';
print '
';
//print $langs->trans('FollowingLinksArePublic').'
';
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':
';
-print ''.DOL_MAIN_URL_ROOT.'/public/members/new.php';
+if ($conf->multicompany->enabled) {
+ $entity_qr='?entity='.$conf->entity;
+} else {
+ $entity_qr='';
+}
+print ''.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'';
/*
print '
| '.dolGetElementUrl($originid,$origin,1).' | '; print ''; print ''; + print ''; + print ''; } if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',GETPOST("datep"),$reg)) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5e8f898e830..bc5bf9da9e3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -110,8 +110,8 @@ class ActionComm extends CommonObject var $note; // Description var $userassigned = array(); // Array of user ids - var $userownerid; // Id of user owner - var $userdoneid; // Id of user done + var $userownerid; // Id of user owner = fk_user_action into table + var $userdoneid; // Id of user done (deprecated) /** * Object user of owner diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9d21b143a2d..ce02649674b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1343,8 +1343,6 @@ class Contrat extends CommonObject $sql.= ", ".($fk_unit?"'".$this->db->escape($fk_unit)."'":"null"); $sql.= ")"; - dol_syslog(get_class($this)."::addline", LOG_DEBUG); - $resql=$this->db->query($sql); if ($resql) { @@ -2627,4 +2625,74 @@ class ContratLigne extends CommonObjectLine } } + + /** + * Inserts a contrat line into database + * + * @param int $notrigger Set to 1 if you don't want triggers to be fired + * @return int <0 if KO, >0 if OK + */ + public function insert($notrigger = 0) + { + global $user; + + // Insertion dans la base + $sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet"; + $sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx,"; + $sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice,"; + $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc,"; + $sql.= " info_bits,"; + $sql.= " price_ht, remise, fk_product_fournisseur_price, buy_price_ht"; + if ($this->date_ouverture_prevue > 0) { $sql.= ",date_ouverture_prevue"; } + if ($this->date_fin_validite > 0) { $sql.= ",date_fin_validite"; } + $sql.= ") VALUES ($this->fk_contrat, '', '" . $this->db->escape($this->description) . "',"; + $sql.= ($this->fk_product>0 ? $this->fk_product : "null").","; + $sql.= " '".$this->qty."',"; + $sql.= " '".$this->tva_tx."',"; + $sql.= " '".$this->localtax1_tx."',"; + $sql.= " '".$this->localtax2_tx."',"; + $sql.= " '".$this->localtax1_type."',"; + $sql.= " '".$this->localtax2_type."',"; + $sql.= " ".price2num($this->remise_percent).",".price2num($this->subprice).","; + $sql.= " ".price2num($this->total_ht).",".price2num($this->total_tva).",".price2num($this->total_localtax1).",".price2num($this->total_localtax2).",".price2num($this->total_ttc).","; + $sql.= " '".$this->info_bits."',"; + $sql.= " ".price2num($this->price_ht).",".price2num($this->remise).","; + if ($this->fk_fournprice > 0) $sql.= ' '.$this->fk_fournprice.','; + else $sql.= ' null,'; + if ($this->pa_ht > 0) $sql.= ' '.price2num($this->pa_ht); + else $sql.= ' null'; + if ($this->date_ouverture_prevue > 0) { $sql.= ",'".$this->db->idate($this->date_ouverture_prevue)."'"; } + if ($this->date_fin_validite > 0) { $sql.= ",'".$this->db->idate($this->date_fin_validite)."'"; } + $sql.= ")"; + + dol_syslog(get_class($this)."::insert", LOG_DEBUG); + + $resql=$this->db->query($sql); + if ($resql) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet'); + + // FIXME Missing insert of extrafields + + if (!$notrigger) + { + // Call trigger + $result = $this->call_trigger('LINECONTRACT_CREATE', $user); + if ($result < 0) { + $this->db->rollback(); + return -1; + } + // End call triggers + } + + $this->db->commit(); + return 1; + } + else + { + $this->db->rollback(); + $this->error=$this->db->error()." sql=".$sql; + return -1; + } + } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 34abeeb8c6e..ebac8ccd797 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1324,6 +1324,10 @@ class ExtraFields $value=$object->getNomUrl(3); } } + elseif ($type == 'text') + { + $value=dol_htmlentitiesbr($value); + } else { $showsize=round($size); diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index e3f00a064e5..5a87e253758 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -253,7 +253,9 @@ function dol_json_decode($json, $assoc=false) if (! empty($array)) { $object = false; - + if (count($array)>0) { + $object = (object) array(); + } foreach ($array as $key => $value) { if ($key) $object->{$key} = $value; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 3188359367c..5123f713a6e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -567,7 +567,7 @@ class pdf_rouget extends ModelePdfExpedition $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"daytext",false,$outputlangs,true), '', 'R'); if (! empty($object->client->code_client)) {