Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git …
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
eldy committed Jan 17, 2012
2 parents 536b431 + d233311 commit 9af78f9
Show file tree
Hide file tree
Showing 10 changed files with 379 additions and 32 deletions.
1 change: 1 addition & 0 deletions htdocs/compta/deplacement/class/deplacement.class.php
Expand Up @@ -177,6 +177,7 @@ function update($user)
$sql .= " SET km = ".$this->km; // This is a distance or amount
$sql .= " , dated = '".$this->db->idate($this->date)."'";
$sql .= " , type = '".$this->type."'";
$sql .= " , fk_statut = '".$this->fk_statut."'";
$sql .= " , fk_user = ".$this->fk_user;
$sql .= " , fk_user_modif = ".$user->id;
$sql .= " , fk_soc = ".($this->socid > 0?$this->socid:'null');
Expand Down
111 changes: 95 additions & 16 deletions htdocs/compta/deplacement/fiche.php
Expand Up @@ -51,6 +51,64 @@
/*
* Actions
*/
if ($action == 'block' && $user->rights->deplacement->valider)
{
$object->fetch($id);
if ($object->fk_statut == '2') // Already blocked...
{
$mesg='<div class="error">'.$langs->trans("Error").'</div>';
$action='';
$error++;
}
else
{
$result = $object->fetch($id);

$object->fk_statut = '2';

$result = $object->update($user);

if ($result > 0)
{
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
{
$mesg=$object->error;
}
}
}

if ($action == 'unblock' && $user->rights->deplacement->unvalidate)
{
$object->fetch($id);
if ($object->fk_statut == '1') // Not blocked...
{
$mesg='<div class="error">'.$langs->trans("Error").'</div>';
$action='';
$error++;
}
else
{
$result = $object->fetch($id);

$object->fk_statut = '1';

$result = $object->update($user);

if ($result > 0)
{
Header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
{
$mesg=$object->error;
}
}
}

if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
{
$result=$object->delete($id);
Expand Down Expand Up @@ -473,23 +531,44 @@

print '<div class="tabsAction">';

if ($user->rights->deplacement->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
if ($user->rights->deplacement->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
if ($object->fk_statut == '2') // if blocked...
{
if ($user->rights->deplacement->unvalidate)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=unblock&id='.$id.'">'.$langs->trans('Unblock').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Unblock').'</a>';
}
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}

if ($object->fk_statut == '1') // If not blocked...
{
if ($user->rights->deplacement->valider)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=block&id='.$id.'">'.$langs->trans('Block').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Block').'</a>';
}
if ($user->rights->deplacement->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
}
if ($user->rights->deplacement->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
}
}
print '</div>';
}
}
Expand Down
26 changes: 24 additions & 2 deletions htdocs/core/lib/sendings.lib.php
Expand Up @@ -163,15 +163,37 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
// Description
if ($objp->fk_product > 0)
{
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$object = new $origin($db);
$object->fetch($origin_id);
$object->fetch_thirdparty();
$prod = new Product($db, $objp->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}

$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product;
}
else
$label = $objp->product;

print '<td>';

// Show product and description
$product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->libelle=$objp->product;
$product_static->libelle=$label;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$objp->product;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text,$description,3,'','',$i);

Expand Down
24 changes: 18 additions & 6 deletions htdocs/core/modules/modDeplacement.class.php
Expand Up @@ -90,17 +90,29 @@ function modDeplacement($DB)
$this->rights[2][3] = 0;
$this->rights[2][4] = 'creer';

$this->rights[3][0] = 173;
$this->rights[3][0] = 173;
$this->rights[3][1] = 'Supprimer les deplacements';
$this->rights[3][2] = 'd';
$this->rights[3][3] = 0;
$this->rights[3][4] = 'supprimer';

$this->rights[4][0] = 178;
$this->rights[4][1] = 'Exporter les deplacements';
$this->rights[4][2] = 'd';
$this->rights[4][0] = 174;
$this->rights[4][1] = 'Bloquer les deplacements';
$this->rights[4][2] = 'a';
$this->rights[4][3] = 0;
$this->rights[4][4] = 'export';
$this->rights[4][4] = 'valider';

$this->rights[5][0] = 175;
$this->rights[5][1] = 'Debloquer les deplacements';
$this->rights[5][2] = 'a';
$this->rights[5][3] = 0;
$this->rights[5][4] = 'unvalidate';

$this->rights[6][0] = 178;
$this->rights[6][1] = 'Exporter les deplacements';
$this->rights[6][2] = 'd';
$this->rights[6][3] = 0;
$this->rights[6][4] = 'export';

// Exports
$r=0;
Expand Down
22 changes: 21 additions & 1 deletion htdocs/expedition/fiche.php
Expand Up @@ -1145,14 +1145,34 @@
// Predefined product or service
if ($lines[$i]->fk_product > 0)
{
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$object->fetch_thirdparty();
$prod = new Product($db, $lines[$i]->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}

$label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
}
else
$label = $lines[$i]->product_label;

print '<td>';

// Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lines[$i]->fk_product.'">';
if ($lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$lines[$i]->ref.'</a>';
$text.= ' - '.$lines[$i]->label;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lines[$i]->description));
//print $description;
print $form->textwithtooltip($text,$description,3,'','',$i);
Expand Down
24 changes: 22 additions & 2 deletions htdocs/expedition/shipment.php
Expand Up @@ -440,16 +440,36 @@
// Product label
if ($objp->fk_product > 0)
{
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$commande->fetch_thirdparty();
$prod = new Product($db, $objp->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}

$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label;
}
else
$label = $objp->product_label;

print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne

// Show product and description
$product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->libelle=$objp->product_label;
$product_static->libelle=$label;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$objp->product_label;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text,$description,3,'','',$i);

Expand Down

0 comments on commit 9af78f9

Please sign in to comment.