Skip to content

Commit

Permalink
Merge remote-tracking branch 'dolibarr/3.7' into 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Jun 8, 2015
2 parents 792911b + dc3ae22 commit 8d82478
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 12 deletions.
17 changes: 14 additions & 3 deletions htdocs/comm/propal/class/propal.class.php
Expand Up @@ -959,8 +959,10 @@ function create_from($user)
*/
function createFromClone($socid=0)
{
global $user,$langs,$conf,$hookmanager;

global $db, $user,$langs,$conf,$hookmanager;

dol_include_once('/projet/class.project.class.php');

$this->context['createfromclone']='createfromclone';

$error=0;
Expand All @@ -985,7 +987,16 @@ function createFromClone($socid=0)
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = '';

$project = new Project($db);

if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) {
if($project->socid <= 0) $this->fk_project = $objFrom->fk_project;
else $this->fk_project = '';
} else {
$this->fk_project = '';
}

$this->fk_delivery_address = '';
}

Expand Down
10 changes: 6 additions & 4 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -77,13 +77,15 @@ abstract class CommonObject
*/
static function isExistingObject($element, $id, $ref='', $ref_ext='')
{
global $db;
global $db,$conf;

$sql = "SELECT rowid, ref, ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX.$element;
if ($id > 0) $sql.= " WHERE rowid = ".$db->escape($id);
else if ($ref) $sql.= " WHERE ref = '".$db->escape($ref)."'";
else if ($ref_ext) $sql.= " WHERE ref_ext = '".$db->escape($ref_ext)."'";
$sql.= " WHERE entity IN (".getEntity($element).")" ;

if ($id > 0) $sql.= " AND rowid = ".$db->escape($id);
else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'";
else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'";
else {
$error='ErrorWrongParameters';
dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/company.lib.php
Expand Up @@ -352,7 +352,7 @@ function getState($id,$withcode='',$dbtouse=0)
}
else
{
return $langs->trans("NotDefined");
return $langs->transnoentitiesnoconv("NotDefined");
}
}
else dol_print_error($dbtouse,'');
Expand Down
3 changes: 2 additions & 1 deletion htdocs/expedition/tpl/linkedobjectblock.tpl.php
Expand Up @@ -41,6 +41,7 @@
<td align="right"><?php echo $langs->trans("Status"); ?></td>
</tr>
<?php
$total=0;
$var=true;
foreach($linkedObjectBlock as $object)
{
Expand Down Expand Up @@ -71,4 +72,4 @@
</tr>
</table>

<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE -->
1 change: 1 addition & 0 deletions htdocs/fourn/class/fournisseur.product.class.php
Expand Up @@ -155,6 +155,7 @@ function remove_product_fournisseur_price($rowid)
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0)
{
global $conf, $langs;
//global $mysoc;

// Clean parameter
if (empty($qty)) $qty=0;
Expand Down
3 changes: 2 additions & 1 deletion htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php
Expand Up @@ -39,6 +39,7 @@
<td align="right"><?php echo $langs->trans("Status"); ?></td>
</tr>
<?php
$total=0;
$var=true;
foreach($linkedObjectBlock as $object)
{
Expand Down Expand Up @@ -68,4 +69,4 @@
</tr>
</table>

<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE -->
3 changes: 2 additions & 1 deletion htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php
Expand Up @@ -41,6 +41,7 @@
<td align="right"><?php echo $langs->trans("Status"); ?></td>
</tr>
<?php
$total=0;
$var=true;
foreach($linkedObjectBlock as $object)
{
Expand Down Expand Up @@ -69,4 +70,4 @@
</tr>
</table>

<!-- END PHP TEMPLATE -->
<!-- END PHP TEMPLATE -->
7 changes: 6 additions & 1 deletion htdocs/install/mysql/migration/3.6.0-3.7.0.sql
Expand Up @@ -208,10 +208,14 @@ UPDATE llx_product SET fk_barcode_type = NULL WHERE fk_barcode_type NOT IN (SELE
ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_user_author (fk_user_author);
UPDATE llx_product_price set fk_user_author = null where fk_user_author = 0;
UPDATE llx_product_price set fk_user_author = null where fk_user_author not in (select rowid from llx_user);
-- drop foreign key for avoid a mysql crash
ALTER TABLE llx_product_price DROP FOREIGN KEY fk_product_price_user_author;
ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
-- fk_product
ALTER TABLE llx_product_price ADD INDEX idx_product_price_fk_product (fk_product);
DELETE from llx_product_price where fk_product NOT IN (SELECT rowid from llx_product);
-- drop foreign key for avoid a mysql crash
ALTER TABLE llx_product_price DROP FOREIGN KEY fk_product_price_product;
ALTER TABLE llx_product_price ADD CONSTRAINT fk_product_price_product FOREIGN KEY (fk_product) REFERENCES llx_product (rowid);

ALTER TABLE llx_commande_fournisseur MODIFY COLUMN date_livraison datetime;
Expand Down Expand Up @@ -1177,4 +1181,5 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_typ

ALTER TABLE llx_livraison MODIFY COLUMN date_delivery DATETIME NULL DEFAULT NULL;

INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT __ENCRYPT('PRODUCT_USE_OLD_PATH_FOR_PHOTO')__,__ENCRYPT('1')__,'chaine','Use old path for products images',1,0 FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_VERSION_LAST_INSTALL' AND __DECRYPT('value')__ <= '3.7.2';
-- This constant is for compatibility if user come from 3.6 or lower. Must not be enabled on 3.7.0 or +
INSERT INTO llx_const (name, value, type, note, visible, entity) SELECT __ENCRYPT('PRODUCT_USE_OLD_PATH_FOR_PHOTO')__,__ENCRYPT('1')__,'chaine','Use old path for products images',1,0 FROM llx_const WHERE __DECRYPT('name')__ = 'MAIN_VERSION_LAST_INSTALL' AND __DECRYPT('value')__ < '3.7.0';

0 comments on commit 8d82478

Please sign in to comment.