This commit is contained in:
Florian Henry 2014-01-29 10:09:44 +01:00
commit ca556485e0
36 changed files with 271 additions and 209 deletions

View File

@ -88,18 +88,6 @@ print "Source directory: $SOURCE\n";
print "Target directory: $NEWDESTI\n"; print "Target directory: $NEWDESTI\n";
# Ask and set version $MAJOR, $MINOR and $BUILD
print "Enter value for version: ";
$PROJVERSION=<STDIN>;
chomp($PROJVERSION);
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
if ($MINOR eq '')
{
print "Enter value for minor version: ";
$MINOR=<STDIN>;
chomp($MINOR);
}
# Ask module # Ask module
print "Enter name for your module (mymodule, mywonderfulmondule, ... or 'all') : "; print "Enter name for your module (mymodule, mywonderfulmondule, ... or 'all') : ";
$PROJECTINPUT=<STDIN>; $PROJECTINPUT=<STDIN>;
@ -130,6 +118,8 @@ else
# Loop on each projects # Loop on each projects
foreach my $PROJECT (@PROJECTLIST) { foreach my $PROJECT (@PROJECTLIST) {
$PROJECTLC=lc($PROJECT);
if (! -f "makepack-".$PROJECT.".conf") if (! -f "makepack-".$PROJECT.".conf")
{ {
print "Error: can't open conf file makepack-".$PROJECT.".conf\n"; print "Error: can't open conf file makepack-".$PROJECT.".conf\n";
@ -141,9 +131,28 @@ foreach my $PROJECT (@PROJECTLIST) {
exit 2; exit 2;
} }
$FILENAME="$PROJECT"; # Get version $MAJOR, $MINOR and $BUILD
$FILENAMETGZ="module_$PROJECT-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":""); print "Version detected for module ".$PROJECT.": ";
$FILENAMEZIP="module_$PROJECT-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":""); $result=open(IN,"<".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php");
if (! $result) { die "Error: Can't open descriptor file ".$SOURCE."/htdocs/".$PROJECTLC."/core/modules/mod".$PROJECT.".class.php for reading.\n"; }
while(<IN>)
{
if ($_ =~ /this->version\s*=\s*'([\d\.]+)'/) { $PROJVERSION=$1; break; }
}
close IN;
print $PROJVERSION."\n";
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
if ($MINOR eq '')
{
print "Enter value for minor version for module ".$PROJECT.": ";
$MINOR=<STDIN>;
chomp($MINOR);
}
$FILENAME="$PROJECTLC";
$FILENAMETGZ="module_$PROJECTLC-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":"");
$FILENAMEZIP="module_$PROJECTLC-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":"");
if (-d "/usr/src/redhat") { if (-d "/usr/src/redhat") {
# redhat # redhat
$RPMDIR="/usr/src/redhat"; $RPMDIR="/usr/src/redhat";
@ -230,7 +239,7 @@ foreach my $PROJECT (@PROJECTLIST) {
$ret=`rm -fr "$BUILDROOT"`; $ret=`rm -fr "$BUILDROOT"`;
mkdir "$BUILDROOT"; mkdir "$BUILDROOT";
mkdir "$BUILDROOT/$PROJECT"; mkdir "$BUILDROOT/$PROJECTLC";
$result=open(IN,"<makepack-".$PROJECT.".conf"); $result=open(IN,"<makepack-".$PROJECT.".conf");
if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; } if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; }
@ -240,43 +249,44 @@ foreach my $PROJECT (@PROJECTLIST) {
$_ =~ s/\n//; $_ =~ s/\n//;
$_ =~ /^(.*)\/[^\/]+/; $_ =~ /^(.*)\/[^\/]+/;
print "Create directory $BUILDROOT/$PROJECT/$1\n"; print "Create directory $BUILDROOT/$PROJECTLC/$1\n";
$ret=`mkdir -p "$BUILDROOT/$PROJECT/$1"`; $ret=`mkdir -p "$BUILDROOT/$PROJECTLC/$1"`;
if ($_ !~ /version\-/) if ($_ !~ /version\-/)
{ {
print "Copy $SOURCE/$_ into $BUILDROOT/$PROJECT/$_\n"; print "Copy $SOURCE/$_ into $BUILDROOT/$PROJECTLC/$_\n";
$ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$PROJECT/$_"`; $ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$PROJECTLC/$_"`;
if ($? != 0) { die "Failed to make copy of a file declared into makepack-".$PROJECT.".conf file (Fails on line ".$_.")\n"; }
} }
} }
close IN; close IN;
@timearray=localtime(time()); @timearray=localtime(time());
$fulldate=($timearray[5]+1900).'-'.($timearray[4]+1).'-'.$timearray[3].' '.$timearray[2].':'.$timearray[1]; $fulldate=($timearray[5]+1900).'-'.($timearray[4]+1).'-'.$timearray[3].' '.$timearray[2].':'.$timearray[1];
open(VF,">$BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt"); open(VF,">$BUILDROOT/$PROJECTLC/build/version-".$PROJECTLC.".txt");
print "Create version file $BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt with date ".$fulldate."\n"; print "Create version file $BUILDROOT/$PROJECTLC/build/version-".$PROJECTLC.".txt with date ".$fulldate."\n";
$ret=`mkdir -p "$BUILDROOT/$PROJECT/build"`; $ret=`mkdir -p "$BUILDROOT/$PROJECTLC/build"`;
print VF "Version: ".$MAJOR.".".$MINOR.($BUILD ne ''?".$BUILD":"")."\n"; print VF "Version: ".$MAJOR.".".$MINOR.($BUILD ne ''?".$BUILD":"")."\n";
print VF "Build : ".$fulldate."\n"; print VF "Build : ".$fulldate."\n";
close VF; close VF;
} }
print "Clean $BUILDROOT\n"; print "Clean $BUILDROOT\n";
$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.cache`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.project`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/.settings`;
$ret=`rm -fr $BUILDROOT/$PROJECT/index.php`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/index.php`;
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/build/html`;
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/document`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.mysql`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.old`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf.php.postgres`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/conf/conf*sav*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/htdocs/custom2`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/Thumbs.db $BUILDROOT/$PROJECTLC/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/Thumbs.db $BUILDROOT/$PROJECTLC/*/*/*/*/Thumbs.db`;
$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`; $ret=`rm -fr $BUILDROOT/$PROJECTLC/CVS* $BUILDROOT/$PROJECTLC/*/CVS* $BUILDROOT/$PROJECTLC/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/CVS* $BUILDROOT/$PROJECTLC/*/*/*/*/*/CVS*`;
} }
# Build package for each target # Build package for each target
@ -314,9 +324,9 @@ foreach my $PROJECT (@PROJECTLIST) {
unlink "$NEWDESTI/$FILENAMEZIP.zip"; unlink "$NEWDESTI/$FILENAMEZIP.zip";
print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n"; print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
print "Go to directory $BUILDROOT/$PROJECT\n"; print "Go to directory $BUILDROOT/$PROJECTLC\n";
$olddir=getcwd(); $olddir=getcwd();
chdir("$BUILDROOT/$PROJECT"); chdir("$BUILDROOT/$PROJECTLC");
$cmd= "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *"; $cmd= "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *";
print $cmd."\n"; print $cmd."\n";
$ret= `$cmd`; $ret= `$cmd`;

View File

@ -1272,10 +1272,10 @@ else
// Cree un tableau formulaire // Cree un tableau formulaire
$formquestion=array(); $formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false)); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_MAILMAN)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>'');
} }
if (! empty($conf->global->ADHERENT_USE_SPIP)) { if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
} }
print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1); print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);

View File

@ -80,6 +80,7 @@ $workflowcodes=array(
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'), 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'),
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'),

View File

@ -586,11 +586,10 @@ if ($action == 'create')
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
$formproject=new FormProjets($db); $formproject=new FormProjets($db);
// Projet associe // Projet associe
$langs->load("project"); $langs->load("projects");
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
@ -626,7 +625,7 @@ if ($action == 'create')
// Other attributes // Other attributes
$parameters=array(); $parameters=array('id'=>$actioncomm->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$actioncomm,$action); // Note that $action and $object may have been modified by hook
@ -861,7 +860,7 @@ if ($id > 0)
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$act->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
@ -1043,7 +1042,7 @@ if ($id > 0)
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); $parameters=array('colspan'=>' colspan="3"', 'colspanvalue'=>'3', 'id'=>$act->id);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
print '</table>'; print '</table>';

View File

@ -1,34 +1,34 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/commande/fiche.php * \file htdocs/commande/fiche.php
* \ingroup commande * \ingroup commande
* \brief Page to show customer order * \brief Page to show customer order
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@ -2483,15 +2483,15 @@ else
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>';
} }
// Create bill and Classify billed // Create bill and Classify billed
if (! empty($conf->facture->enabled) && $object->statut > 0 && ! $object->billed) // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > 0 && ! $object->billed)
{ {
if ($user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER))
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a></div>';
} }
if ($user->rights->commande->creer && $object->statut > 2 && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORsKFLOW_BILL_ON_SHIPMENT)) if ($user->rights->commande->creer && $object->statut > 2 && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a></div>';
} }

View File

@ -744,11 +744,17 @@ else
print $form->selectarray('priv',$selectarray,$object->priv,0); print $form->selectarray('priv',$selectarray,$object->priv,0);
print '</td></tr>'; print '</td></tr>';
// Note // Note Public
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
print '<textarea name="note" cols="70" rows="'.ROWS_3.'">'; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print isset($_POST["note"])?$_POST["note"]:$object->note; print $doleditor->Create(1);
print '</textarea></td></tr>'; print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
$doleditor = new DolEditor('note_private', $object->note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
print $doleditor->Create(1);
print '</td></tr>';
// Statut // Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
@ -961,11 +967,15 @@ else
print $object->LibPubPriv($object->priv); print $object->LibPubPriv($object->priv);
print '</td></tr>'; print '</td></tr>';
// Note // Note Public
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="3">'; print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td><td colspan="3">';
print nl2br($object->note); print nl2br($object->note_public);
print '</td></tr>'; print '</td></tr>';
// Note Private
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td><td colspan="3">';
print nl2br($object->note_private);
// Statut // Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>'; print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>'; print '<td>';

View File

@ -242,7 +242,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
{ {
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
if ($product_type == 1) { //only services if ($product_type == 1) { //only services // TODO Exclude also deee
// service prédéfini // service prédéfini
if ($lines[$i]->fk_product > 0) if ($lines[$i]->fk_product > 0)
{ {
@ -286,8 +286,8 @@ if ($action == 'add' && $user->rights->contrat->creer)
$lines[$i]->localtax2_tx, $lines[$i]->localtax2_tx,
$lines[$i]->fk_product, $lines[$i]->fk_product,
$lines[$i]->remise_percent, $lines[$i]->remise_percent,
$date_start =0, $lines[$i]->date_start,
$date_end =0, $lines[$i]->date_end,
'HT', 'HT',
0, 0,
$lines[$i]->info_bits, $lines[$i]->info_bits,
@ -303,7 +303,6 @@ if ($action == 'add' && $user->rights->contrat->creer)
} }
} }
} }
else else
{ {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005 Christophe /* Copyright (C) 2005 Christophe
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -122,7 +123,7 @@ class box_comptes extends ModeleBoxes
); );
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => price($solde, 1, $langs, 0, -1, 0, $objp->currency_code) 'text' => price($solde, 0, $langs, 0, 0, -1, $objp->currency_code)
); );
$listofcurrencies[$objp->currency_code]=1; $listofcurrencies[$objp->currency_code]=1;

View File

@ -122,12 +122,12 @@ class box_graph_product_distribution extends ModeleBoxes
$socid=empty($user->societe_id)?0:$user->societe_id; $socid=empty($user->societe_id)?0:$user->societe_id;
$userid=0; // No filter on user creation $userid=0; // No filter on user creation
if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
{
$WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320'; $WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320';
$HEIGHT='192'; $HEIGHT='192';
if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
{
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showinvoicenb) if ($showinvoicenb)
{ {

View File

@ -3735,15 +3735,16 @@ class Form
* @param int $maxlen Length maximum for labels * @param int $maxlen Length maximum for labels
* @param int $disabled Html select box is disabled * @param int $disabled Html select box is disabled
* @param int $sort 'ASC' or 'DESC' =Sort on label, '' or 'NONE'=Do not sort * @param int $sort 'ASC' or 'DESC' =Sort on label, '' or 'NONE'=Do not sort
* @param string $morecss Add more class to css styles
* @return string HTML select string * @return string HTML select string
*/ */
function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0, $sort='') function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $option='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='')
{ {
global $langs; global $langs;
if ($value_as_key) $array=array_combine($array, $array); if ($value_as_key) $array=array_combine($array, $array);
$out='<select id="'.$htmlname.'" '.($disabled?'disabled="disabled" ':'').'class="flat" name="'.$htmlname.'" '.($option != ''?$option:'').'>'; $out='<select id="'.$htmlname.'" '.($disabled?'disabled="disabled" ':'').'class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" '.($option != ''?$option:'').'>';
if ($show_empty) if ($show_empty)
{ {

View File

@ -66,7 +66,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("ActionsAskedBy"); print $langs->trans("ActionsAskedBy");
print ' &nbsp;</td><td class="nowrap">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit); print $form->select_dolusers($filtera, 'userasked', 1, '', ! $canedit);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -74,14 +74,14 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy"); print $langs->trans("or") . ' ' . $langs->trans("ActionsToDoBy");
print ' &nbsp;</td><td class="nowrap">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit); print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit);
print '</td></tr>'; print '</td></tr>';
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy"); print $langs->trans("or") . ' ' . $langs->trans("ActionsDoneBy");
print ' &nbsp;</td><td class="nowrap">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit); print $form->select_dolusers($filterd, 'userdone', 1, '', ! $canedit);
print '</td></tr>'; print '</td></tr>';
@ -90,7 +90,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("Type"); print $langs->trans("Type");
print ' &nbsp;</td><td class="nowrap">'; print ' &nbsp;</td><td class="nowrap maxwidthonsmartphone">';
print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0)); print $formactions->select_type_actions($actioncode, "actioncode", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0));
@ -105,7 +105,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr>'; print '<tr>';
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("Project").' &nbsp; '; print $langs->trans("Project").' &nbsp; ';
print '</td><td class="nowrap">'; print '</td><td class="nowrap maxwidthonsmartphone">';
$formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64); $formproject->select_projects($socid?$socid:-1, $pid, 'projectid', 64);
print '</td></tr>'; print '</td></tr>';
} }
@ -144,16 +144,18 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
foreach ($showextcals as $val) foreach ($showextcals as $val)
{ {
$htmlname = dol_string_nospecial($val['name']); $htmlname = dol_string_nospecial($val['name']);
print '<tr><td>';
print '<script type="text/javascript">' . "\n"; print '<script type="text/javascript">' . "\n";
print 'jQuery(document).ready(function () {' . "\n"; print 'jQuery(document).ready(function () {' . "\n";
print 'jQuery("#check_' . $htmlname . '").click(function() { jQuery(".family_' . $htmlname . '").toggle(); });' . "\n"; print 'jQuery("#check_' . $htmlname . '").click(function() { jQuery(".family_' . $htmlname . '").toggle(); });' . "\n";
print '});' . "\n"; print '});' . "\n";
print '</script>' . "\n"; print '</script>' . "\n";
print '<tr><td><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . '</td></tr>'; print '<input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'];
print '</td></tr>';
} }
} }
} }
print '<tr><td><input type="checkbox" id="check_birthday" name="check_birthday checked="false"> ' . $langs->trans("AgendaShowBirthdayEvents") . '</td></tr>'; print '<tr><td>'.$langs->trans("AgendaShowBirthdayEvents").' <input type="checkbox" id="check_birthday" name="check_birthday"></td></tr>';
print '</table>'; print '</table>';
print '</td>'; print '</td>';
} }

View File

@ -127,7 +127,7 @@ function societe_prepare_head($object)
// Attached files // Attached files
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->societe->dir_output . "/" . $object->id; $upload_dir = $conf->societe->dir_output . "/" . $object->id;
$nbFiles = count(dol_dir_list($upload_dir)); $nbFiles = count(dol_dir_list($upload_dir,'files'));
$head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Documents"); $head[$h][1] = $langs->trans("Documents");
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';

View File

@ -551,9 +551,9 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
// For debugging // For debugging
//include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'); //include_once(DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php');
//$mask='{yyyy}-{0000}'; //$mask='FA{yy}{mm}-{0000@99}';
//$date=dol_mktime(12, 0, 0, 1, 1, 1900); //$date=dol_mktime(12, 0, 0, 1, 1, 1900);
//$date=dol_stringtotime('20121001'); //$date=dol_stringtotime('20130101');
// Extract value for mask counter, mask raz and mask offset // Extract value for mask counter, mask raz and mask offset
if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask';

View File

@ -120,7 +120,7 @@ function product_prepare_head($object, $user)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); if (! empty($conf->product->enabled)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); elseif (! empty($conf->service->enabled)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir)); $nbFiles = count(dol_dir_list($upload_dir,'files'));
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')'; if($nbFiles > 0) $head[$h][1].= ' ('.$nbFiles.')';

View File

@ -443,7 +443,7 @@ class ImportCsv extends ModeleImports
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull') elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifnull')
{ {
if (empty($newval) || $newval='auto') if (empty($newval) || $newval=='auto')
{ {
$this->thirpartyobject->get_codeclient(0,0); $this->thirpartyobject->get_codeclient(0,0);
$newval=$this->thirpartyobject->code_client; $newval=$this->thirpartyobject->code_client;
@ -452,7 +452,7 @@ class ImportCsv extends ModeleImports
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull') elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsuppliercodeifnull')
{ {
if (empty($newval) || $newval='auto') if (empty($newval) || $newval=='auto')
{ {
$newval=$this->thirpartyobject->get_codefournisseur(0,1); $newval=$this->thirpartyobject->get_codefournisseur(0,1);
$newval=$this->thirpartyobject->code_fournisseur; $newval=$this->thirpartyobject->code_fournisseur;
@ -461,7 +461,7 @@ class ImportCsv extends ModeleImports
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull') elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomeraccountancycodeifnull')
{ {
if (empty($newval) || $newval='auto') if (empty($newval) || $newval=='auto')
{ {
$this->thirpartyobject->get_codecompta('customer'); $this->thirpartyobject->get_codecompta('customer');
$newval=$this->thirpartyobject->code_compta; $newval=$this->thirpartyobject->code_compta;
@ -470,7 +470,7 @@ class ImportCsv extends ModeleImports
} }
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull') elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getsupplieraccountancycodeifnull')
{ {
if (empty($newval) || $newval='auto') if (empty($newval) || $newval=='auto')
{ {
$this->thirpartyobject->get_codecompta('supplier'); $this->thirpartyobject->get_codecompta('supplier');
$newval=$this->thirpartyobject->code_compta_fournisseur; $newval=$this->thirpartyobject->code_compta_fournisseur;

View File

@ -111,12 +111,12 @@ class modBarcode extends DolibarrModules
$this->remove($options); $this->remove($options);
$sql = array( $sql = array(
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN8', 'EAN8', 0, '1234567', __ENTITY__)",'ignoreerror'=>1), array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN8', 'EAN8', 0, '1234567', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN13', 'EAN13', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1), array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('EAN13', 'EAN13', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('UPC', 'UPC', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1), array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('UPC', 'UPC', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('ISBN', 'ISBN', 0, '123456789', __ENTITY__)",'ignoreerror'=>1), array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('ISBN', 'ISBN', 0, '123456789', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('C39', 'Code 39', 0, '1234567890', __ENTITY__)",'ignoreerror'=>1), array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C39', 'Code 39', 0, '1234567890', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO llx_c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1) array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1)
); );
return $this->_init($sql, $options); return $this->_init($sql, $options);

View File

@ -144,6 +144,13 @@ class modProjet extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'supprimer'; $this->rights[$r][4] = 'supprimer';
$r++;
$this->rights[$r][0] = 45; // id de la permission
$this->rights[$r][1] = "Exporter les projets"; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'export';
$r++; $r++;
$this->rights[$r][0] = 141; // id de la permission $this->rights[$r][0] = 141; // id de la permission
$this->rights[$r][1] = "Lire tous les projets et tâches (y compris prives qui ne me sont pas affectes)"; // libelle de la permission $this->rights[$r][1] = "Lire tous les projets et tâches (y compris prives qui ne me sont pas affectes)"; // libelle de la permission

View File

@ -25,6 +25,7 @@ $langs->load("link");
if ($action == 'delete') if ($action == 'delete')
{ {
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
$ret = $form->form_confirm( $ret = $form->form_confirm(
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'), $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
$langs->trans('DeleteFile'), $langs->trans('DeleteFile'),

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2008-2010 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -401,8 +401,9 @@ llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,
// Add sections to manage // Add sections to manage
$rowspan=0; $rowspan=0;
$sectionauto=array(); $sectionauto=array();
if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { if (! empty($conf->global->ECM_AUTO_TREE_ENABLED))
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } {
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'product', 'test'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); } if (! empty($conf->societe->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); } if (! empty($conf->propal->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Prop"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); } if (! empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'contract','test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
@ -410,7 +411,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (! empty($conf->facture->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); } if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); } if (! empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
if (! empty($conf->tax->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); } if (! empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); }
if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); } if (! empty($conf->projet->enabled)) { $rowspan++; $sectionauto[]=array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); }
} }

View File

@ -305,8 +305,11 @@ class PaiementFourn extends Paiement
if ($bank_line_id) if ($bank_line_id)
{ {
$accline = new AccountLine($this->db); $accline = new AccountLine($this->db);
$accline->fetch($bank_line_id); $result=$accline->fetch($bank_line_id);
if ($result > 0) // If result = 0, record not found, we don't try to delete
{
$result=$accline->delete(); $result=$accline->delete();
}
if ($result < 0) if ($result < 0)
{ {
$this->error=$accline->error; $this->error=$accline->error;

View File

@ -253,14 +253,14 @@ elseif ($action == 'setnote_private' && $user->rights->fournisseur->facture->cre
} }
// Delete payment // Delete payment
elseif ($action == 'deletepaiement') elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
if ($object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) if ($object->statut == 1 && $object->paye == 0)
{ {
$paiementfourn = new PaiementFourn($db); $paiementfourn = new PaiementFourn($db);
$paiementfourn->fetch(GETPOST('paiement_id')); $result=$paiementfourn->fetch(GETPOST('paiement_id'));
$result=$paiementfourn->delete(); if ($result > 0) $result=$paiementfourn->delete(); // If fetch ok and found
if ($result < 0) $mesg='<div class="error">'.$paiementfourn->error.'</div>'; if ($result < 0) $mesg='<div class="error">'.$paiementfourn->error.'</div>';
} }
} }
@ -1631,7 +1631,7 @@ else
$bankaccountstatic->ref=$objp->ref; $bankaccountstatic->ref=$objp->ref;
$bankaccountstatic->label=$objp->ref; $bankaccountstatic->label=$objp->ref;
print '<td align="right">'; print '<td align="right">';
print $bankaccountstatic->getNomUrl(1,'transactions'); if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1,'transactions');
print '</td>'; print '</td>';
} }
print '<td align="right">'.price($objp->amount).'</td>'; print '<td align="right">'.price($objp->amount).'</td>';

View File

@ -52,7 +52,11 @@ if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_IN
* View * View
*/ */
llxHeader('',$langs->trans("HomeArea")); // Title
$title=$langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
llxHeader('',$title);
print_fiche_titre($langs->trans("HomeArea")); print_fiche_titre($langs->trans("HomeArea"));
@ -238,20 +242,15 @@ if (empty($user->societe_id))
$var=!$var; $var=!$var;
if ($langfile[$key]) $langs->load($langfile[$key]); if ($langfile[$key]) $langs->load($langfile[$key]);
$title=$langs->trans($titres[$key]); $text=$langs->trans($titres[$key]);
/*print '<tr '.$bc[$var].'><td width="16">'.img_object($title,$icons[$key]).'</td>';
print '<td>'.$title.'</td>';
print '<td align="right"><a href="'.$links[$key].'">'.$board->nb[$val].'</a></td>';
print '</tr>';
*/
print '<div class="boxstats">'; print '<div class="boxstats">';
print '<a href="'.$links[$key].'" class="nobold nounderline">'; print '<a href="'.$links[$key].'" class="nobold nounderline">';
print img_object($title,$icons[$key]).' '.$title.'<br>'; print img_object($text,$icons[$key]).' '.$text.'<br>';
print '</a>'; print '</a>';
print '<a href="'.$links[$key].'">'; print '<a href="'.$links[$key].'">';
print $board->nb[$val]; print $board->nb[$val];
print '</div>';
print '</a>'; print '</a>';
print '</div>';
} }
} }
} }

View File

@ -0,0 +1,9 @@
CHARSET=UTF-8
LinkANewFile=Enllaçar un nou arxiu/document
LinkedFiles=Arxius i documents enllaçats
NoLinkFound=No hi ha enllaços associats
LinkComplete=L'arxiu s'ha enllaçat correctament
ErrorFileNotLinked=L'arxiu no ha pogut ser enllaçat
LinkRemoved=Ha estat eliminat l'enllaç %s
ErrorFailedToDeleteLink=Impossible eliminar l'enllaç '<b>%s</b>'
ErrorFailedToUpdateLink=Impossible modificar l'enllaç '<b>%s</b>'

View File

@ -7,7 +7,7 @@ DIRECTION=ltr
FONTFORPDF=helvetica FONTFORPDF=helvetica
FONTSIZEFORPDF=10 FONTSIZEFORPDF=10
SeparatorDecimal=, SeparatorDecimal=,
SeparatorThousand=None SeparatorThousand=
FormatDateShort=%d/%m/%Y FormatDateShort=%d/%m/%Y
FormatDateShortInput=%d/%m/%Y FormatDateShortInput=%d/%m/%Y
FormatDateShortJava=dd/MM/yyyy FormatDateShortJava=dd/MM/yyyy

View File

@ -0,0 +1,9 @@
CHARSET=UTF-8
LinkANewFile=Enlazar un nuevo archivo/documento
LinkedFiles=Archivos y documentos enlazados
NoLinkFound=No hay enlaces asociados
LinkComplete=El archivo se ha enlazado correctamente
ErrorFileNotLinked=El archivo no ha podido ser enlazado
LinkRemoved=Ha sido eliminado el enlace %s
ErrorFailedToDeleteLink=Imposible eliminar el enlace '<b>%s</b>'
ErrorFailedToUpdateLink=Imposible actualizar el enlace '<b>%s</b>'

View File

@ -7,7 +7,7 @@ DIRECTION=ltr
FONTFORPDF=helvetica FONTFORPDF=helvetica
FONTSIZEFORPDF=10 FONTSIZEFORPDF=10
SeparatorDecimal=, SeparatorDecimal=,
SeparatorThousand=None SeparatorThousand=
FormatDateShort=%d/%m/%Y FormatDateShort=%d/%m/%Y
FormatDateShortInput=%d/%m/%Y FormatDateShortInput=%d/%m/%Y
FormatDateShortJava=dd/MM/yyyy FormatDateShortJava=dd/MM/yyyy

View File

@ -7,7 +7,7 @@ DIRECTION=ltr
FONTFORPDF=helvetica FONTFORPDF=helvetica
FONTSIZEFORPDF=10 FONTSIZEFORPDF=10
SeparatorDecimal=, SeparatorDecimal=,
SeparatorThousand=None SeparatorThousand=
FormatDateShort=%d/%m/%Y FormatDateShort=%d/%m/%Y
FormatDateShortInput=%d/%m/%Y FormatDateShortInput=%d/%m/%Y
FormatDateShortJava=dd/MM/yyyy FormatDateShortJava=dd/MM/yyyy

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2008 Matteli * Copyright (C) 2008 Matteli
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
@ -138,7 +138,7 @@ function analyse_sql_and_script(&$var, $type)
} }
// Check consitency of NOREQUIREXXX DEFINES // Check consistency of NOREQUIREXXX DEFINES
if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them'); if ((defined('NOREQUIREDB') || defined('NOREQUIRETRAN')) && ! defined('NOREQUIREMENU')) dol_print_error('','If define NOREQUIREDB or NOREQUIRETRAN are set, you must also set NOREQUIREMENU or not use them');
// Sanity check on URL // Sanity check on URL
@ -162,7 +162,7 @@ if (! empty($_SERVER['DOCUMENT_ROOT'])) set_include_path($_SERVER['DOCUMENT_ROOT
// Include the conf.php and functions.lib.php // Include the conf.php and functions.lib.php
require_once 'filefunc.inc.php'; require_once 'filefunc.inc.php';
// If there is a POST parameter to tell to save automatically some POST params into a cookies, we do it // If there is a POST parameter to tell to save automatically some POST parameters into a cookies, we do it
if (! empty($_POST["DOL_AUTOSET_COOKIE"])) if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
@ -261,7 +261,7 @@ if (! empty($conf->file->main_force_https))
} }
// Chargement des includes complementaires de presentation // Loading of additional presentation includes
if (! defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) if (! defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2)
if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory if (! defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory
@ -292,7 +292,7 @@ if ((! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_V
// Creation of a token against CSRF vulnerabilities // Creation of a token against CSRF vulnerabilities
if (! defined('NOTOKENRENEWAL')) if (! defined('NOTOKENRENEWAL'))
{ {
$token = dol_hash(uniqid(mt_rand(),TRUE)); // Genere un hash d'un nombre aleatoire $token = dol_hash(uniqid(mt_rand(),TRUE)); // Generates a hash of a random number
// roulement des jetons car cree a chaque appel // roulement des jetons car cree a chaque appel
if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken']; if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken'];
$_SESSION['newtoken'] = $token; $_SESSION['newtoken'] = $token;
@ -396,7 +396,7 @@ if (! defined('NOLOGIN'))
$sessionkey = 'dol_antispam_value'; $sessionkey = 'dol_antispam_value';
$ok=(array_key_exists($sessionkey, $_SESSION) === TRUE && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); $ok=(array_key_exists($sessionkey, $_SESSION) === TRUE && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
// Verifie code // Check code
if (! $ok) if (! $ok)
{ {
dol_syslog('Bad value for code, connexion refused'); dol_syslog('Bad value for code, connexion refused');
@ -407,14 +407,14 @@ if (! defined('NOLOGIN'))
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode"); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadValueForCode");
$test=false; $test=false;
// Appel des triggers // Call of triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST('entity','int')); $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST('entity','int'));
if ($result < 0) { if ($result < 0) {
$error++; $error++;
} }
// Fin appel triggers // End Call of triggers
} }
} }
@ -468,14 +468,14 @@ if (! defined('NOLOGIN'))
$user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2); $user->trigger_mesg=$langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username","alpha",2);
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
// Appel des triggers // Call of triggers
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST("username","alpha",2)); $result=$interface->run_triggers('USER_LOGIN_FAILED',$user,$user,$langs,$conf,GETPOST("username","alpha",2));
if ($result < 0) { if ($result < 0) {
$error++; $error++;
} }
// Fin appel triggers // End Call of triggers
} }
} }

View File

@ -38,7 +38,7 @@ class Product extends CommonObject
public $element='product'; public $element='product';
public $table_element='product'; public $table_element='product';
public $fk_element='fk_product'; public $fk_element='fk_product';
protected $childtables=array('propaldet','commandedet','facturedet','contratdet'); // To test if we can delete object protected $childtables=array('propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
protected $isnolinkedbythird = 1; // No field fk_soc protected $isnolinkedbythird = 1; // No field fk_soc
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador.gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador.gpcsolutions.fr>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -41,8 +42,8 @@ $action=GETPOST("action");
$cancel=GETPOST('cancel'); $cancel=GETPOST('cancel');
// Security check // Security check
$id = GETPOST('id')?GETPOST('id'):GETPOST('ref'); $id=GETPOST('id', 'int');
$ref = GETPOST('ref'); $ref=GETPOST('ref', 'alpha');
$stocklimit = GETPOST('stocklimit'); $stocklimit = GETPOST('stocklimit');
$desiredstock = GETPOST('desiredstock'); $desiredstock = GETPOST('desiredstock');
$cancel = GETPOST('cancel'); $cancel = GETPOST('cancel');

View File

@ -308,7 +308,7 @@ llxHeaderVierge($langs->trans("DolibarrDemo"), $head);
print "\n"; print "\n";
print '<table style="font-size:14px;" summary="Main table for Dolibarr demos">'; print '<table style="font-size:14px;" class="centpercent" summary="Main table for Dolibarr demos">';
print '<tr><td>'; print '<tr><td>';
print '<center><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" alt="Dolibarr logo"></center><br>'; print '<center><img src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.png" alt="Dolibarr logo"></center><br>';

View File

@ -4,7 +4,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
require '../../main.inc.php'; require '../../main.inc.php';
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) if (empty($conf->global->MAIN_FEATURES_LEVEL))
{ {
print "Page available onto dev environment only"; print "Page available onto dev environment only";
exit; exit;

View File

@ -303,6 +303,7 @@ class Societe extends CommonObject
$contact->name = $this->name_bis; $contact->name = $this->name_bis;
$contact->firstname = $this->firstname; $contact->firstname = $this->firstname;
$contact->civilite_id = $this->civility_id;
$contact->socid = $this->id; // fk_soc $contact->socid = $this->id; // fk_soc
$contact->statut = 1; $contact->statut = 1;
$contact->priv = 0; $contact->priv = 0;

View File

@ -118,7 +118,7 @@ if (empty($reshook))
$object->particulier = GETPOST("private"); $object->particulier = GETPOST("private");
$object->name = dolGetFirstLastname(GETPOST('firstname'),GETPOST('nom')?GETPOST('nom'):GETPOST('name')); $object->name = dolGetFirstLastname(GETPOST('firstname'),GETPOST('nom')?GETPOST('nom'):GETPOST('name'));
$object->civilite_id = GETPOST('civilite_id'); $object->civility_id = GETPOST('civilite_id');
// Add non official properties // Add non official properties
$object->name_bis = GETPOST('name')?GETPOST('name'):GETPOST('nom'); $object->name_bis = GETPOST('name')?GETPOST('name'):GETPOST('nom');
$object->firstname = GETPOST('firstname'); $object->firstname = GETPOST('firstname');

View File

@ -70,7 +70,6 @@ if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global-
$fontlist='helvetica,arial,tahoma,verdana'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; $fontlist='helvetica,arial,tahoma,verdana'; //$fontlist='Verdana,Helvetica,Arial,sans-serif';
//'/theme/auguria/img/menus/trtitle.png'; //'/theme/auguria/img/menus/trtitle.png';
$img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1);
$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1);
$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1);
$dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_topmenu=$conf->dol_hide_topmenu;
$dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu;

View File

@ -1007,12 +1007,15 @@ class User extends CommonObject
$this->db->begin(); $this->db->begin();
// Cree et positionne $this->id // Create and set $this->id
$result=$this->create($user); $result=$this->create($user);
if ($result > 0) if ($result > 0)
{ {
$result=$this->setPassword($user,$this->pass); $newpass=$this->setPassword($user,$this->pass);
if ($member->fk_soc) { if (is_numeric($newpass) && $newpass < 0) $result=-2;
if ($result > 0 && $member->fk_soc) // If member is linked to a thirdparty
{
$sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET fk_societe=".$member->fk_soc; $sql.= " SET fk_societe=".$member->fk_soc;
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
@ -1026,7 +1029,7 @@ class User extends CommonObject
} }
else else
{ {
$this->error=$this->db->error(); $this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::create_from_member - 1 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create_from_member - 1 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
@ -1034,13 +1037,19 @@ class User extends CommonObject
} }
} }
} }
if ($result > 0)
{
$this->db->commit();
return $this->id;
}
else else
{ {
// $this->error deja positionne // $this->error deja positionne
dol_syslog(get_class($this)."::create_from_member - 2 - ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::create_from_member - 2 - ".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return $result; return -2;
} }
} }