Skip to content

Commit

Permalink
Merge branch 'develop' of git://github.com/Dolibarr/dolibarr into dev…
Browse files Browse the repository at this point in the history
…elop
  • Loading branch information
grandoc committed Aug 20, 2012
2 parents 72895fa + 257dcb8 commit b277166
Show file tree
Hide file tree
Showing 38 changed files with 326 additions and 213 deletions.
2 changes: 1 addition & 1 deletion htdocs/admin/tools/dolibarr_export.php
Expand Up @@ -268,7 +268,7 @@ function hideoptions () {

<div class="formelementrow"><input type="checkbox" name="nobin_disable_fk"
value="yes" id="checkbox_disable_fk" checked="checked" /> <label
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?><?php print img_warning('Mandatory if you want to be able to restore your sql dump later'); ?></label>
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info('Mandatory if you want to be able to restore your sql dump later'); ?></label>
</div>
</fieldset>

Expand Down
5 changes: 2 additions & 3 deletions htdocs/cashdesk/tpl/menu.tpl.php
Expand Up @@ -3,6 +3,7 @@
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -58,8 +59,6 @@
$langs->load("cashdesk");
$langs->load("main");

$logout='<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png" title="'.dol_escape_htmltag($langs->trans("Logout")).'">';

print '<div class="menu_bloc">';
print '<ul class="menu">';
// Link to new sell
Expand All @@ -68,7 +67,7 @@
print '<li class="menu_choix2"><a href=".." target="backoffice"><span>'.$langs->trans("BackOffice").'</span></a></li>';
// Disconnect
print '<li class="menu_choix0">'.$langs->trans("User").': '.$_SESSION['prenom'].' '.$_SESSION['nom'];
print ' <a href="deconnexion.php">'.$logout.'</a><br>';
print ' <a href="deconnexion.php">'.img_picto($langs->trans('Logout'), 'logout.png').'</a><br>';
print $langs->trans("CashDeskThirdParty").': '.$companyLink.'<br>';
/*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/comm/action/fiche.php
Expand Up @@ -715,7 +715,7 @@ function setdatefields()
print '</td></tr>';

// Status
print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
print '<tr><td nowrap="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent=GETPOST("percentage")?GETPOST("percentage"):$act->percentage;
print $htmlactions->form_select_status_action('formaction',$percent,1);
print '</td></tr>';
Expand Down Expand Up @@ -865,7 +865,7 @@ function setdatefields()
print '</td></tr>';

// Status
print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
print '<tr><td nowrap="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
print $act->getLibStatut(4);
print '</td></tr>';

Expand Down
5 changes: 3 additions & 2 deletions htdocs/compta/facture/class/facture.class.php
Expand Up @@ -8,7 +8,8 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -2996,7 +2997,7 @@ function load_state_board()
function getLinesArray()
{
$sql = 'SELECT l.rowid, l.description, l.fk_product, l.product_type, l.qty, l.tva_tx,';
$sql.= ' l.fk_remise_except, localtax1_tx, localtax2_tx,';
$sql.= ' l.fk_remise_except, l.localtax1_tx, l.localtax2_tx,';
$sql.= ' l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.date_start, l.date_end,';
Expand Down
2 changes: 1 addition & 1 deletion htdocs/contrat/fiche.php
Expand Up @@ -1358,7 +1358,7 @@
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("Validate").'</a>';
}

if ($conf->facture->enabled && $object->statut > 0)
if ($conf->facture->enabled && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices)
{
$langs->load("bills");
if ($user->rights->facture->creer) print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->thirdparty->id.'">'.$langs->trans("CreateBill").'</a>';
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/class/conf.class.php
Expand Up @@ -374,6 +374,9 @@ function setValues($db)
$this->format_date_hour_text_short="%d %b %Y %H:%M";
$this->format_date_hour_text="%d %B %Y %H:%M";

// Duration of workday
if (! isset($conf->global->MAIN_DURATION_OF_WORKDAY)) $this->global->MAIN_DURATION_OF_WORKDAY=86400;

// Limites decimales si non definie (peuvent etre egale a 0)
if (! isset($this->global->MAIN_MAX_DECIMALS_UNIT)) $this->global->MAIN_MAX_DECIMALS_UNIT=5;
if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2;
Expand Down
60 changes: 41 additions & 19 deletions htdocs/core/class/html.formactions.class.php
Expand Up @@ -58,29 +58,51 @@ function form_select_status_action($formname,$selected,$canedit=1,$htmlname='com
{
global $langs,$conf;

$listofstatus=array('-1'=>$langs->trans("ActionNotApplicable"),
'0'=>$langs->trans("ActionRunningNotStarted"),
'50'=>$langs->trans("ActionRunningShort"),
'100'=>$langs->trans("ActionDoneShort"));
$listofstatus = array(
'-1' => $langs->trans("ActionNotApplicable"),
'0' => $langs->trans("ActionRunningNotStarted"),
'50' => $langs->trans("ActionRunningShort"),
'100' => $langs->trans("ActionDoneShort")
);

if ($conf->use_javascript_ajax)
{
print "\n";
print '<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {'."\n";
print 'jQuery("#select'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n";
print 'jQuery("#val'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n";
print 'select_status(document.'.$formname.'.status.value);'."\n";
print '});'."\n";
print 'function select_status(mypercentage) {'."\n";
print 'document.'.$formname.'.percentageshown.value=(mypercentage>=0?mypercentage:\'\');'."\n";
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
print 'if (mypercentage == -1) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").hide(); }'."\n";
print 'else if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n";
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n";
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
print '}'."\n";
print '</script>'."\n";
print "<script type=\"text/javascript\">
var htmlname = '".$htmlname."';
jQuery(document).ready(function () {
jQuery('#select'+htmlname).change(function() {
select_status();
});
jQuery('#val'+htmlname).change(function() {
select_status();
});
select_status();
});
function select_status() {
mypercentage = jQuery('#val'+htmlname).val();
jQuery('input[name=percentageshown]').val((mypercentage>=0?mypercentage:''));
jQuery('input[name=percentage]').val(mypercentage);
if (mypercentage == -1) {
jQuery('input[name=percentageshown]').attr('disabled', 'disabled');
jQuery('.hideifna').hide();
}
else if (mypercentage == 0) {
jQuery('input[name=percentageshown]').attr('disabled', 'disabled');
jQuery('.hideifna').show();
}
else if (mypercentage == 100) {
jQuery('input[name=percentageshown]').attr('disabled', 'disabled');
jQuery('.hideifna').show();
}
else {
jQuery('input[name=percentageshown]').removeAttr('disabled');
}
}
</script>\n";
print '<select '.($canedit?'':'disabled="disabled" ').'name="status" id="select'.$htmlname.'" class="flat">';
foreach($listofstatus as $key => $val)
{
Expand Down
15 changes: 8 additions & 7 deletions htdocs/core/lib/files.lib.php
Expand Up @@ -790,16 +790,17 @@ function dol_delete_dir_recursive($dir,$count=0,$nophperrors=0)
function dol_delete_preview($object)
{
global $langs,$conf;
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");

$element = $object->element;
$dir = $conf->$element->dir_output;

if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande';
elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture';
elseif ($object->element == 'project') $dir = $conf->projet->dir_output;
elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending';
elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt';
if ($object->element == 'order_supplier') $dir = $conf->fournisseur->dir_output.'/commande';
elseif ($object->element == 'invoice_supplier') $dir = $conf->fournisseur->dir_output.'/facture';
elseif ($object->element == 'project') $dir = $conf->projet->dir_output;
elseif ($object->element == 'shipping') $dir = $conf->expedition->dir_output.'/sending';
elseif ($object->element == 'delivery') $dir = $conf->expedition->dir_output.'/receipt';
elseif ($object->element == 'fichinter') $dir = $conf->ficheinter->dir_output;
else
$dir = $conf->$element->dir_output;

if (empty($dir)) return 'ErrorObjectNoSupportedByFunction';

Expand Down
6 changes: 4 additions & 2 deletions htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
Expand Up @@ -86,7 +86,8 @@ function __construct($db)

// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->code_pays) $this->emetteur->code_pays=substr($langs->defaultlang,-2); // By default, if not defined
if (empty($this->emetteur->country_code))
$this->emetteur->country_code = substr($langs->defaultlang,-2); // By default, if not defined

// Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1;
Expand Down Expand Up @@ -271,6 +272,7 @@ function write_file($object,$outputlangs)
$nexY+=2; // Passe espace entre les lignes

// Detect if some page were added automatically and output _tableau for past pages
// FIXME $pageposafter not defined
while ($pagenb < $pageposafter)
{
if ($pagenb == 1)
Expand Down Expand Up @@ -553,7 +555,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
}

$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');

// Show recipient
$posy=42;
Expand Down
5 changes: 1 addition & 4 deletions htdocs/core/modules/fichinter/modules_fichinter.php
Expand Up @@ -44,7 +44,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator
* @param string $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
static function liste_modeles($db,$maxfilenamelength=0)
{
global $conf;

Expand Down Expand Up @@ -224,9 +224,6 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
dol_delete_preview($object);

// Success in building document. We build meta file.
dol_meta_create($object);

// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
Expand Down
18 changes: 12 additions & 6 deletions htdocs/core/modules/societe/mod_codecompta_aquarium.php
Expand Up @@ -113,10 +113,16 @@ function get_code($db, $societe, $type)

// Regle gestion compte compta
$codetouse='';
if ($type == 'customer') $codetouse = $this->prefixcustomeraccountancycode;
if ($type == 'supplier') $codetouse = $this->prefixsupplieraccountancycode;
if ($type == 'customer') $codetouse.= (! empty($societe->code_client)?$societe->code_client:'CUSTCODE');
if ($type == 'supplier') $codetouse.= (! empty($societe->code_fournisseur)?$societe->code_fournisseur:'SUPPCODE');
if ($type == 'customer')
{
$codetouse = $this->prefixcustomeraccountancycode;
$codetouse.= (! empty($societe->code_client)?$societe->code_client:'CUSTCODE');
}
else if ($type == 'supplier')
{
$codetouse = $this->prefixsupplieraccountancycode;
$codetouse.= (! empty($societe->code_fournisseur)?$societe->code_fournisseur:'SUPPCODE');
}
$codetouse=strtoupper(preg_replace('/([^a-z0-9])/i','',$codetouse));

$is_dispo = $this->verif($db, $codetouse, $societe, $type);
Expand Down Expand Up @@ -147,11 +153,11 @@ function verif($db, $code, $societe, $type)
{
$sql = "SELECT ";
if ($type == 'customer') $sql.= "code_compta";
if ($type == 'supplier') $sql.= "code_compta_fournisseur";
else if ($type == 'supplier') $sql.= "code_compta_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE ";
if ($type == 'customer') $sql.= "code_compta";
if ($type == 'supplier') $sql.= "code_compta_fournisseur";
else if ($type == 'supplier') $sql.= "code_compta_fournisseur";
$sql.= " = '".$this->db->escape($code)."'";
if (! empty($societe->id)) $sql.= " AND rowid <> ".$societe->id;

Expand Down
9 changes: 4 additions & 5 deletions htdocs/fichinter/class/fichinter.class.php
Expand Up @@ -87,7 +87,7 @@ function __construct($db)
*/
function create()
{
global $conf;
global $conf, $user, $langs;

dol_syslog(get_class($this)."::create ref=".$this->ref);

Expand Down Expand Up @@ -156,8 +156,8 @@ function create()
$result=$this->db->query($sql);
if ($result)
{
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
$this->db->commit();
$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
$this->db->commit();

// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
Expand Down Expand Up @@ -328,10 +328,9 @@ function setDraft($user)
* Validate a intervention
*
* @param User $user User that validate
* @param string $outputdir Output directory
* @return int <0 if KO, >0 if OK
*/
function setValid($user, $outputdir)
function setValid($user)
{
global $langs, $conf;

Expand Down
4 changes: 2 additions & 2 deletions htdocs/fichinter/fiche.php
Expand Up @@ -76,7 +76,7 @@
$object->fetch($id);
$object->fetch_thirdparty();

$result = $object->setValid($user, $conf->fichinter->outputdir);
$result = $object->setValid($user);
if ($result >= 0)
{
// Define output language
Expand Down Expand Up @@ -905,7 +905,7 @@

// Duration
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
print '<td>'.convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print '<td>'.convertSecondToTime($object->duree, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
print '</tr>';

// Description (must be a textarea and not html must be allowed (used in list view)
Expand Down
11 changes: 1 addition & 10 deletions htdocs/fichinter/list.php
Expand Up @@ -42,21 +42,12 @@
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) {
$page = 0;
}
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="fd.date";
if ($page == -1) { $page = 0 ; }

$limit = $conf->liste_limit;
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;

$search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company','alpha');
Expand Down

0 comments on commit b277166

Please sign in to comment.