Merge remote-tracking branch 'origin/3.7' into 3.8

Conflicts:
	htdocs/contrat/class/contrat.class.php
	htdocs/core/class/extrafields.class.php
	htdocs/main.inc.php
This commit is contained in:
Laurent Destailleur 2015-07-28 18:57:13 +02:00
commit ff8969073c
8 changed files with 92 additions and 7 deletions

View File

@ -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

View File

@ -219,7 +219,12 @@ print '</form>';
print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>';
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php">'.DOL_MAIN_URL_ROOT.'/public/members/new.php</a>';
if ($conf->multicompany->enabled) {
$entity_qr='?entity='.$conf->entity;
} else {
$entity_qr='';
}
print '<a target="_blank" href="'.DOL_URL_ROOT.'/public/members/new.php'.$entity_qr.'">'.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'</a>';
/*
print '<table class="border" cellspacing="0" cellpadding="3">';

View File

@ -780,6 +780,8 @@ if ($action == 'create')
print '<td colspan="3">'.dolGetElementUrl($originid,$origin,1).'</td></tr>';
print '<input type="hidden" name="fk_element" size="10" value="'.GETPOST('originid').'">';
print '<input type="hidden" name="elementtype" size="10" value="'.GETPOST('origin').'">';
print '<input type="hidden" name="originid" size="10" value="'.GETPOST('originid').'">';
print '<input type="hidden" name="origin" size="10" value="'.GETPOST('origin').'">';
}
if (GETPOST("datep") && preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])$/',GETPOST("datep"),$reg))

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -1324,6 +1324,10 @@ class ExtraFields
$value=$object->getNomUrl(3);
}
}
elseif ($type == 'text')
{
$value=dol_htmlentitiesbr($value);
}
else
{
$showsize=round($size);

View File

@ -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;

View File

@ -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))
{