Merge branch '3.9' into bug-5537

This commit is contained in:
Marcos García de La Fuente 2016-07-25 11:50:08 +02:00
commit 3ef3a038cf
31 changed files with 5362 additions and 102 deletions

View File

@ -12,6 +12,41 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade. make a Dolibarr upgrade.
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
FIX: #4383 $userid not defined
FIX: #4448 $filebonprev is not used, $this->filename now
FIX: #4455
FIX: #4749
FIX: #4756
FIX: #4828
FIX: #4926
FIX: #4964 buyprice in customer from shipping buyprice wasn't load in expedition::fetch_lines
FIX: #5004
FIX: #5068
FIX: #5170 tva sign with INVOICE_POSITIVE_CREDIT_NOTE option
FIX: #5338 use of not initialized var $aphour, $apmin, etc
FIX: #5343
FIX: #5380
FIX: #5383 bad object id on don delete
FIX: #5414
FIX: #5470 User of expense report in bank transactions page is not correct
FIX: a case of corrupted ODT by Word that insert <text:s> when it should not.
FIX: Can't create thirdparty or validate invoice if profid is mandatory and profid does not exists for other countries
FIX: dasboard wrong for late invoice
FIX: duplicate jquery.js files
FIX: extrafield cloned on project clone
FIX: Failed to open file
FIX: Filter on opportunity amount and budget
FIX: form_confirm to delete payment on supplier invoice
FIX: javascript error with german-switzerland language
FIX: large expense note
FIX: Missing original .js file (license violation if sources are not provided)
FIX: Option strict mode compatibility
FIX: product stats all bloc module without enbaled test
FIX: receiving link never works
FIX: task ODT company object not correctly retrieved
FIX: Translate group perms as it is done into user perms
FIX: We must take the last recent defined price when using price level
***** ChangeLog for 3.9.2 compared to 3.9.1 ***** ***** ChangeLog for 3.9.2 compared to 3.9.1 *****
FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN

View File

@ -1,2 +1 @@
README.md README.md
README-FR.md

View File

@ -2,4 +2,4 @@
version=3 version=3
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz #http://sf.net/dolibarr/dolibarr-(.+)\.tgz
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.orig\.tar\.gz

View File

@ -173,6 +173,7 @@ $build =~ s/-.*$//g;
# now build is 0+nmu1 for example # now build is 0+nmu1 for example
$FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}"; $FILENAMEDEBNATIVE="${PROJECT}_${MAJOR}.${MINOR}.${build}";
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}"; $FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${newbuild}";
$FILENAMEDEBSHORT="${PROJECT}_${MAJOR}.${MINOR}.${build}";
my $copyalreadydone=0; my $copyalreadydone=0;
@ -388,10 +389,15 @@ if ($nboftargetok) {
{ {
print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
$ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`;
print 'Run git push -f --tags'."\n";
$ret=`git push -f --tags`;
} }
} }
print 'Run git push --tags'."\n"; else
$ret=`git push --tags`; {
print 'Run git push --tags'."\n";
$ret=`git push --tags`;
}
chdir("$olddir"); chdir("$olddir");
} }
@ -807,7 +813,7 @@ if ($nboftargetok) {
$ret=`$cmd`; $ret=`$cmd`;
print "Remove other files\n"; print "Remove other files\n";
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/README-FR.md`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README`;
$ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`; $ret=`rm -f $BUILDROOT/$PROJECT.tmp/build/README-FR`;
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/build/aps`;
@ -1104,6 +1110,7 @@ if ($nboftargetok) {
%filestoscansf=( %filestoscansf=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM', "$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
@ -1111,6 +1118,7 @@ if ($nboftargetok) {
%filestoscanstableasso=( %filestoscanstableasso=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows', "$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard', "$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard' "$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
@ -1156,7 +1164,7 @@ if ($nboftargetok) {
print "\n"; print "\n";
if ($target eq 'SF') { if ($target eq 'SF' && $filestoscan{$file} ne 'none') {
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
} }
elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) { elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) {

View File

@ -31,8 +31,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-facture.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-commande.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-produit.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-propale.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");

View File

@ -32,8 +32,8 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
} }
// Recupere root dolibarr // Recupere root dolibarr
$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]); //$path=preg_replace('/generate-societe.php/i','',$_SERVER["PHP_SELF"]);
require ($path."../../htdocs/master.inc.php"); require (__DIR__. '/../../htdocs/master.inc.php');
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';

View File

@ -81,7 +81,7 @@ $extrafields = new ExtraFields($db);
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'd.rowid'=>'Ref', 'd.rowid'=>'Ref',
//'d.ref'=>'Ref', 'd.login'=>'Login',
'd.lastname'=>'Lastname', 'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname', 'd.firstname'=>'Firstname',
'd.societe'=>"Company", 'd.societe'=>"Company",

View File

@ -130,7 +130,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
} }
} }
if ($action == 'setremise') if ($action == 'setremise' && $user->rights->societe->creer)
{ {
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->creer) //if ($user->rights->facture->creer)
@ -257,38 +257,48 @@ if ($socid > 0)
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>'; if (! empty($user->fk_soc)) // No need to show this for external users
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; {
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
}
print '</table>'; print '</table>';
print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
print '<table class="border" width="100%">';
print '<tr><td width="38%">'.$langs->trans("AmountHT").'</td>';
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print "</table>";
if ($user->rights->societe->creer)
{
print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
print '<table class="border" width="100%">';
print '<tr><td width="38%">'.$langs->trans("AmountHT").'</td>';
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'">';
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print "</table>";
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; if ($user->rights->societe->creer)
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">'; {
if (! empty($backtopage)) print '<div class="center">';
{ print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; if (! empty($backtopage))
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; {
} print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '</div>'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</div>';
}
print '</form>'; print '</form>';
@ -414,7 +424,7 @@ if ($socid > 0)
print '<br>'; print '<br>';
/* /*
* Liste ristournes appliquees (=liees a une ligne de facture ou facture) * List discount consumed (=liees a une ligne de facture ou facture)
*/ */
// Remises liees a lignes de factures // Remises liees a lignes de factures

View File

@ -407,7 +407,7 @@ if (empty($reshook))
} }
} }
} }
$qualified_for_stock_change = 0; $qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
$qualified_for_stock_change = $object->hasProductsOrServices(2); $qualified_for_stock_change = $object->hasProductsOrServices(2);
@ -962,7 +962,7 @@ if (empty($reshook))
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines or deposit lines"); dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines or deposit lines");
$result = $srcobject->fetch($object->origin_id); $result = $srcobject->fetch($object->origin_id);
// If deposit invoice // If deposit invoice
if ($_POST['type'] == Facture::TYPE_DEPOSIT) if ($_POST['type'] == Facture::TYPE_DEPOSIT)
{ {
@ -1130,7 +1130,7 @@ if (empty($reshook))
$error ++; $error ++;
} }
} }
// Now we create same links to contact than the ones found on origin object // Now we create same links to contact than the ones found on origin object
if (empty($conf->global->INVOICE_NO_PROPAGATE_CONTACTS_FROM_ORIGIN)) if (empty($conf->global->INVOICE_NO_PROPAGATE_CONTACTS_FROM_ORIGIN))
{ {
@ -1143,24 +1143,24 @@ if (empty($reshook))
} }
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; $sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $db->query($sqlcontact); $resqlcontact = $db->query($sqlcontact);
if ($resqlcontact) if ($resqlcontact)
{ {
while($objcontact = $db->fetch_object($resqlcontact)) while($objcontact = $db->fetch_object($resqlcontact))
{ {
//print $objcontact->code.'-'.$objcontact->fk_socpeople."\n"; //print $objcontact->code.'-'.$objcontact->fk_socpeople."\n";
$object->add_contact($objcontact->fk_socpeople, $objcontact->code); $object->add_contact($objcontact->fk_socpeople, $objcontact->code);
} }
} }
else dol_print_error($resqlcontact); else dol_print_error($resqlcontact);
} }
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error ++; $error ++;
} }
} }
else else
{ // If some invoice's lines coming from page { // If some invoice's lines coming from page
$id = $object->create($user); $id = $object->create($user);
@ -1317,7 +1317,7 @@ if (empty($reshook))
// Ecrase $txtva par celui du produit // Ecrase $txtva par celui du produit
// Ecrase $base_price_type par celui du produit // Ecrase $base_price_type par celui du produit
// Replaces $fk_unit with the product's // Replaces $fk_unit with the product's
if (! empty($idprod)) if (! empty($idprod))
{ {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($idprod); $prod->fetch($idprod);
@ -1328,7 +1328,7 @@ if (empty($reshook))
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) $tva_npr=0; if (empty($tva_tx)) $tva_npr=0;
$pu_ht = $prod->price; $pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc; $pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min; $price_min = $prod->price_min;
@ -1375,13 +1375,13 @@ if (empty($reshook))
} }
// On reevalue prix selon taux tva car taux tva transaction peut etre different // On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
elseif ($tva_tx != $prod->tva_tx) elseif ($tva_tx != $prod->tva_tx)
{ {
if ($price_base_type != 'HT') if ($price_base_type != 'HT')
{ {
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU');
} }
else else
{ {
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
} }
@ -1443,7 +1443,7 @@ if (empty($reshook))
// Local Taxes // Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr); $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
$info_bits = 0; $info_bits = 0;
if ($tva_npr) if ($tva_npr)
$info_bits |= 0x01; $info_bits |= 0x01;
@ -1546,7 +1546,7 @@ if (empty($reshook))
// Add buying price // Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : ''); $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
// Extrafields // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
@ -2028,7 +2028,7 @@ if ($action == 'create')
{ {
$invoice_predefined = new FactureRec($db); $invoice_predefined = new FactureRec($db);
$invoice_predefined->fetch(GETPOST('fac_rec','int')); $invoice_predefined->fetch(GETPOST('fac_rec','int'));
$sql = 'SELECT r.rowid, r.titre, r.total_ttc'; $sql = 'SELECT r.rowid, r.titre, r.total_ttc';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid; $sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
@ -2983,7 +2983,7 @@ else if ($id > 0 || ! empty($ref))
// Remise dispo de type avoir // Remise dispo de type avoir
if (! $absolute_discount) if (! $absolute_discount)
print '<br>'; print '<br>';
// $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer
$more=' ('.$addcreditnote.')'; $more=' ('.$addcreditnote.')';
$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher
} }
@ -3316,7 +3316,7 @@ else if ($id > 0 || ! empty($ref))
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount'); print $langs->trans('BankAccount');
print '<td>'; print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
@ -3754,7 +3754,7 @@ else if ($id > 0 || ! empty($ref))
print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&amp;action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="facture/fiche-rec.php?facid=' . $object->id . '&amp;action=create">' . $langs->trans("ChangeIntoRepeatableInvoice") . '</a></div>';
} }
} }
// Create a credit note // Create a credit note
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer) if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut > 0 && $user->rights->facture->creer)
{ {
@ -3912,7 +3912,7 @@ else if ($id > 0 || ! empty($ref))
{ {
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id); $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'inv'.$object->id);
} }
$formmail->withfrom = 1; $formmail->withfrom = 1;
$liste = array(); $liste = array();
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {

View File

@ -387,8 +387,8 @@ class Facture extends CommonInvoice
{ {
$newinvoiceline=$this->lines[$i]; $newinvoiceline=$this->lines[$i];
$newinvoiceline->fk_facture=$this->id; $newinvoiceline->fk_facture=$this->id;
$newinvoiceline->origin = $this->element; $newinvoiceline->origin = $this->element; // TODO This seems not used. Here we but origin 'facture' but after
$newinvoiceline->origin_id = $this->lines[$i]->id; $newinvoiceline->origin_id = $this->lines[$i]->id; // we put an id of object !
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
{ {
// Reset fk_parent_line for no child products and special product // Reset fk_parent_line for no child products and special product
@ -3212,7 +3212,7 @@ class Facture extends CommonInvoice
$clause = " WHERE"; $clause = " WHERE";
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin"; $sql = "SELECT f.rowid, f.date_lim_reglement as datefin,f.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -3242,6 +3242,7 @@ class Facture extends CommonInvoice
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin); $generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
$generic_facture->statut = $obj->fk_statut;
$response->nbtodo++; $response->nbtodo++;
@ -3249,7 +3250,7 @@ class Facture extends CommonInvoice
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
return $response; return $response;
} }
else else
@ -3727,7 +3728,7 @@ class Facture extends CommonInvoice
global $conf; global $conf;
$now = dol_now(); $now = dol_now();
// Paid invoices have status STATUS_CLOSED // Paid invoices have status STATUS_CLOSED
if ($this->statut != Facture::STATUS_VALIDATED) return false; if ($this->statut != Facture::STATUS_VALIDATED) return false;

View File

@ -1896,8 +1896,8 @@ class Form
$sql.= " WHERE fk_product='".$objp->rowid."'"; $sql.= " WHERE fk_product='".$objp->rowid."'";
$sql.= " AND entity IN (".getEntity('productprice', 1).")"; $sql.= " AND entity IN (".getEntity('productprice', 1).")";
$sql.= " AND price_level=".$price_level; $sql.= " AND price_level=".$price_level;
$sql.= " ORDER BY date_price, rowid"; $sql.= " ORDER BY date_price DESC, rowid DESC";
$sql.= " DESC LIMIT 1"; $sql.= " LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG); dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
$result2 = $this->db->query($sql); $result2 = $this->db->query($sql);

View File

@ -79,7 +79,9 @@ function societe_prepare_head(Societe $object)
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
{ {
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][1] = $langs->trans("ContactsAddresses"); $head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
} }

View File

@ -5079,7 +5079,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg)) if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
{ {
$substitutionarray=array(); $substitutionarray=array();
complete_substitutions_array($substitutionarray,$langs,$object); complete_substitutions_array($substitutionarray,$langs,$object,array('needforkey'=>$values[2]));
$label=make_substitutions($reg[1], $substitutionarray); $label=make_substitutions($reg[1], $substitutionarray);
} }
else $label=$langs->trans($values[2]); else $label=$langs->trans($values[2]);
@ -5099,7 +5099,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg)) if (preg_match('/SUBSTITUTION_([^_]+)/i',$values[2],$reg))
{ {
$substitutionarray=array(); $substitutionarray=array();
complete_substitutions_array($substitutionarray,$langs,$object); complete_substitutions_array($substitutionarray,$langs,$object,array('needforkey'=>$values[2]));
$label=make_substitutions($reg[1], $substitutionarray); $label=make_substitutions($reg[1], $substitutionarray);
} }
else $label=$langs->trans($values[2]); else $label=$langs->trans($values[2]);

View File

@ -4,6 +4,7 @@
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 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
@ -633,7 +634,7 @@ class Don extends CommonObject
$this->town = $obj->town; $this->town = $obj->town;
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
$this->country_id = $obj->country_id; $this->country_id = $obj->fk_country;
$this->country_code = $obj->country_code; $this->country_code = $obj->country_code;
$this->country = $obj->country; $this->country = $obj->country;
$this->country_olddata= $obj->country_olddata; // deprecated $this->country_olddata= $obj->country_olddata; // deprecated

View File

@ -1768,6 +1768,7 @@ class ExpenseReportLine
// Clean parameters // Clean parameters
$this->comments=trim($this->comments); $this->comments=trim($this->comments);
$this->vatrate = price2num($this->vatrate); $this->vatrate = price2num($this->vatrate);
$this->value_unit = price2num($this->value_unit);
$this->db->begin(); $this->db->begin();

View File

@ -57,6 +57,9 @@ if ($action == 'add_payment')
exit; exit;
} }
$expensereport = new ExpenseReport($db);
$expensereport->fetch($chid);
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
if (! $_POST["fk_typepayment"] > 0) if (! $_POST["fk_typepayment"] > 0)
@ -85,8 +88,7 @@ if ($action == 'add_payment')
{ {
if (substr($key,0,7) == 'amount_') if (substr($key,0,7) == 'amount_')
{ {
$other_chid = substr($key,7); $amounts[$expensereport->fk_user_author] = price2num($_POST[$key]);
$amounts[$other_chid] = price2num($_POST[$key]);
$total += price2num($_POST[$key]); $total += price2num($_POST[$key]);
} }
} }

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.2'); if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.3');
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -432,3 +432,4 @@ MergeThirdparties=Merge third parties
ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one. ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one ? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one.
ThirdpartiesMergeSuccess=Thirdparties have been merged ThirdpartiesMergeSuccess=Thirdparties have been merged
ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted. ErrorThirdpartiesMerge=There was an error when deleting the thirdparties. Please check the log. Changes have been reverted.
NewCustomerSupplierCodeProposed=New customer or supplier proposed on duplicate code

View File

@ -609,8 +609,20 @@ if (empty($reshook))
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tva_tx / 100)), 'MU');
} }
} }
if (GETPOST('propalid') > 0) { if (GETPOST('propalid') > 0) {
// Define cost price for margin calculation
$buyprice=0;
if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{
dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors');
}
else
{
$buyprice = $result;
}
$result = $propal->addline( $result = $propal->addline(
$desc, $desc,
$pu_ht, $pu_ht,
@ -628,7 +640,7 @@ if (empty($reshook))
0, 0,
0, 0,
0, 0,
0, $buyprice,
'', '',
'', '',
'', '',
@ -642,6 +654,18 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors'); setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
} elseif (GETPOST('commandeid') > 0) { } elseif (GETPOST('commandeid') > 0) {
// Define cost price for margin calculation
$buyprice=0;
if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{
dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors');
}
else
{
$buyprice = $result;
}
$result = $commande->addline( $result = $commande->addline(
$desc, $desc,
$pu_ht, $pu_ht,
@ -662,7 +686,7 @@ if (empty($reshook))
0, 0,
0, 0,
null, null,
0, $buyprice,
'', '',
0, 0,
$object->fk_unit $object->fk_unit
@ -673,6 +697,18 @@ if (empty($reshook))
exit; exit;
} }
} elseif (GETPOST('factureid') > 0) { } elseif (GETPOST('factureid') > 0) {
// Define cost price for margin calculation
$buyprice=0;
if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0)
{
dol_syslog($langs->trans('FailedToGetCostPrice'));
setEventMessage($langs->trans('FailedToGetCostPrice'), 'errors');
}
else
{
$buyprice = $result;
}
$result = $facture->addline( $result = $facture->addline(
$desc, $desc,
$pu_ht, $pu_ht,
@ -696,7 +732,7 @@ if (empty($reshook))
0, 0,
0, 0,
null, null,
0, $buyprice,
'', '',
0, 0,
100, 100,

View File

@ -376,14 +376,13 @@ function activitytrim($product_type)
// breakdown by quarter // breakdown by quarter
$sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot"; $sql = "SELECT DATE_FORMAT(p.datep,'%Y') as annee, DATE_FORMAT(p.datep,'%m') as mois, SUM(fd.total_ht) as Mnttot";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= " , ".MAIN_DB_PREFIX."paiement as p,".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.entity = " . $conf->entity;
$sql.= " AND f.rowid = fd.fk_facture"; $sql.= " AND f.rowid = fd.fk_facture";
$sql.= " AND pf.fk_facture = f.rowid"; $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND pf.fk_paiement= p.rowid"; $sql.= " AND pf.fk_paiement= p.rowid";
$sql.= " AND fd.product_type=".$product_type; $sql.= " AND fd.product_type=".$product_type;
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'"; $sql.= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate),1)."'";
$sql.= " GROUP BY annee, mois "; $sql.= " GROUP BY annee, mois ";
$sql.= " ORDER BY annee, mois "; $sql.= " ORDER BY annee, mois ";

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2013 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -272,7 +272,7 @@ else
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,";
$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
$sql.= ' p.datec, p.tms'; $sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_buy';
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
// Add fields from hooks // Add fields from hooks

View File

@ -112,8 +112,12 @@ if ($action == "correct_stock")
if ($product->hasbatch()) if ($product->hasbatch())
{ {
$batch=GETPOST('batch_number'); $batch=GETPOST('batch_number');
$eatby=GETPOST('eatby');
$sellby=GETPOST('sellby'); //$eatby=GETPOST('eatby');
//$sellby=GETPOST('sellby');
$eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
$sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
$result=$product->correct_stock_batch( $result=$product->correct_stock_batch(
$user, $user,
$id, $id,

View File

@ -63,13 +63,13 @@
{ {
print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Product").'</td>'; print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Product").'</td>';
print '<td width="20%">'; print '<td width="20%">';
print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''),20,0,-1);
print '</td>'; print '</td>';
} }
print '<td width="20%">'; print '<td width="20%">';
print '<select name="mouvement" id="mouvement" class="flat">'; print '<select name="mouvement" id="mouvement" class="flat">';
print '<option value="0">'.$langs->trans("Add").'</option>'; print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1">'.$langs->trans("Delete").'</option>'; print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
print '</select></td>'; print '</select></td>';
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>'; print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input class="flat" name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>'; print '</tr>';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 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
@ -352,16 +353,17 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " , ".MAIN_DB_PREFIX."societe_extrafields as ef ";
// We'll need this table joined to the select in order to filter by sale // We'll need this table joined to the select in order to filter by sale
if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
// We'll need this table joined to the select in order to filter by categ // We'll need this table joined to the select in order to filter by categ
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_".($type=='f'?"fournisseur":"societe")." as cs"; if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_".($type=='f'?"fournisseur":"societe")." as cs";
$sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " AND s.rowid = ef.fk_object";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale

View File

@ -437,7 +437,7 @@ if (empty($reshook))
if (empty($object->fournisseur)) $object->code_fournisseur=''; if (empty($object->fournisseur)) $object->code_fournisseur='';
$result = $object->create($user); $result = $object->create($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($object->particulier) if ($object->particulier)
{ {
@ -505,6 +505,13 @@ if (empty($reshook))
} }
else else
{ {
if($result == -3) {
$duplicate_code_error = true;
$object->code_fournisseur = null;
$object->code_client = null;
}
$error=$object->error; $errors=$object->errors; $error=$object->error; $errors=$object->errors;
} }
@ -794,8 +801,14 @@ else
$object->particulier = $private; $object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm'); $object->prefix_comm = GETPOST('prefix_comm');
$object->client = GETPOST('client')?GETPOST('client'):$object->client; $object->client = GETPOST('client')?GETPOST('client'):$object->client;
$object->code_client = GETPOST('code_client', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; if(empty($duplicate_code_error)) {
$object->code_client = GETPOST('code_client', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur;
} else {
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings');
}
$object->code_fournisseur = GETPOST('code_fournisseur', 'alpha'); $object->code_fournisseur = GETPOST('code_fournisseur', 'alpha');
$object->address = GETPOST('address', 'alpha'); $object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
@ -1000,7 +1013,7 @@ else
print '<td width="25%">'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">'; print '<td width="25%">'.fieldLabel('CustomerCode','customer_code').'</td><td width="25%">';
print '<table class="nobordernopadding"><tr><td>'; print '<table class="nobordernopadding"><tr><td>';
$tmpcode=$object->code_client; $tmpcode=$object->code_client;
if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0); if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object,0);
print '<input type="text" name="code_client" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">'; print '<input type="text" name="code_client" id="customer_code" size="16" value="'.dol_escape_htmltag($tmpcode).'" maxlength="15">';
print '</td><td>'; print '</td><td>';

View File

@ -399,4 +399,23 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".join(',',$result)."\n"; print __METHOD__." result=".join(',',$result)."\n";
$this->assertEquals(0,count($result)); $this->assertEquals(0,count($result));
} }
/**
* testDolDirList
*
* @return string
*
* @depends testDolCompressUnCompress
* The depends says test is run only if previous is ok
*/
public function testDolDirList()
{
global $conf,$user,$langs,$db;
// Scan dir to guaruante we on't have library jquery twice (we accept exception of duplicte into ckeditor because all dir is removed for debian package, so there is no duplicate).
$founddirs=dol_dir_list(DOL_DOCUMENT_ROOT.'/includes/', 'files', 1, '^jquery\.js', array('ckeditor'));
print __METHOD__." count(founddirs)=".count($founddirs)."\n";
$this->assertEquals(1,count($founddirs));
}
} }