Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop6

This commit is contained in:
Laurent Destailleur 2016-12-31 17:24:14 +01:00
commit 2c4e8926f8
39 changed files with 623 additions and 286 deletions

22
build/generate_filelist_xml.php Normal file → Executable file
View File

@ -65,6 +65,8 @@ fputs($fp, '<checksum_list version="'.$release.'">'."\n");
fputs($fp, '<dolibarr_htdocs_dir>'."\n"); fputs($fp, '<dolibarr_htdocs_dir>'."\n");
$checksumconcat=array();
$dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/'); $dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/');
$iterator1 = new RecursiveIteratorIterator($dir_iterator1); $iterator1 = new RecursiveIteratorIterator($dir_iterator1);
// need to ignore document custom etc // need to ignore document custom etc
@ -81,12 +83,22 @@ foreach ($files as $file) {
$needtoclose=1; $needtoclose=1;
} }
if (filetype($file)=="file") { if (filetype($file)=="file") {
fputs($fp, '<md5file name="'.basename($file).'">'.md5_file($file).'</md5file>'."\n"); $md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, '<md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
} }
} }
fputs($fp, '</dir>'."\n"); fputs($fp, '</dir>'."\n");
fputs($fp, '</dolibarr_htdocs_dir>'."\n"); fputs($fp, '</dolibarr_htdocs_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
//var_dump($checksumconcat);
fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n");
fputs($fp, md5(join(',',$checksumconcat))."\n");
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n");
$checksumconcat=array();
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n"); fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
@ -106,12 +118,18 @@ foreach ($files as $file) {
$needtoclose=1; $needtoclose=1;
} }
if (filetype($file)=="file") { if (filetype($file)=="file") {
fputs($fp, '<md5file name="'.basename($file).'">'.md5_file($file).'</md5file>'."\n"); $md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, '<md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
} }
} }
fputs($fp, '</dir>'."\n"); fputs($fp, '</dir>'."\n");
fputs($fp, '</dolibarr_script_dir>'."\n"); fputs($fp, '</dolibarr_script_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
fputs($fp, '<dolibarr_script_dir_checksum>'."\n");
fputs($fp, md5(join(',',$checksumconcat))."\n");
fputs($fp, '</dolibarr_script_dir_checksum>'."\n");
fputs($fp, '</checksum_list>'."\n"); fputs($fp, '</checksum_list>'."\n");
fclose($fp); fclose($fp);

View File

@ -75,9 +75,9 @@ $file_list = array('missing' => array(), 'updated' => array());
// File to analyze // File to analyze
//$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist-'.DOL_VERSION.'.xml'; //$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist-'.DOL_VERSION.'.xml';
$xmlshortfile = '/install/filelist-'.DOL_VERSION.'.xml'; $xmlshortfile = GETPOST('xmlshortfile')?GETPOST('xmlshortfile'):'/install/filelist-'.DOL_VERSION.'.xml';
$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile; $xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; $xmlremote = GETPOST('xmlremote')?GETPOST('xmlremote'):'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
// Test if remote test is ok // Test if remote test is ok
@ -87,21 +87,27 @@ if (preg_match('/beta|alpha/i', DOL_VERSION)) $enableremotecheck=False;
print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">';
print $langs->trans("MakeIntegrityAnalysisFrom").':<br>'; print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
print '<!-- for a local check target=local&xmlshortfile=... -->'."\n";
if (dol_is_file($xmlfile)) if (dol_is_file($xmlfile))
{ {
print '<input type="radio" name="target" value="local"'.((! GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"':'').'"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>'; print '<input type="radio" name="target" value="local"'.((! GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"':'').'"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>';
} }
else else
{ {
print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span><br>'; print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile;
if (! GETPOST('xmlshortfile')) print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span>';
print '<br>';
} }
print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
if ($enableremotecheck) if ($enableremotecheck)
{ {
print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"':'').'> '.$langs->trans("RemoteSignature").' = '.$xmlremote.'<br>'; print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"':'').'> '.$langs->trans("RemoteSignature").' = '.$xmlremote.'<br>';
} }
else else
{ {
print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.$xmlremote.' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span><br>'; print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.$xmlremote;
if (! GETPOST('xmlremote')) print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>';
print '<br>';
} }
print '<br><div class="center"><input type="submit" name="check" class="button" value="'.$langs->trans("Check").'"></div>'; print '<br><div class="center"><input type="submit" name="check" class="button" value="'.$langs->trans("Check").'"></div>';
print '</form>'; print '</form>';
@ -128,7 +134,8 @@ if (GETPOST('target') == 'remote')
if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404') if (! $xmlarray['curl_error_no'] && $xmlarray['http_code'] != '404')
{ {
$xmlfile = $xmlarray['content']; $xmlfile = $xmlarray['content'];
$xml = simplexml_load_file($xmlfile); //print "eee".$xmlfile."eee";
$xml = simplexml_load_string($xmlfile);
} }
else else
{ {
@ -141,10 +148,13 @@ if (GETPOST('target') == 'remote')
if ($xml) if ($xml)
{ {
$checksumconcat = array();
// Scan htdocs
if (is_object($xml->dolibarr_htdocs_dir[0])) if (is_object($xml->dolibarr_htdocs_dir[0]))
{ {
$file_list = array(); $file_list = array();
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0]); // Fill array $file_list $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -181,10 +191,10 @@ if ($xml)
print '<td align="right">' . $langs->trans("DateModification") . '</td>'; print '<td align="right">' . $langs->trans("DateModification") . '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
$var = true; $var = true;
$tmpfilelist = dol_sort_array($file_list['updated'], 'filename'); $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
if (is_array($tmpfilelist) && count($tmpfilelist)) if (is_array($tmpfilelist2) && count($tmpfilelist2))
{ {
foreach ($tmpfilelist as $file) foreach ($tmpfilelist2 as $file)
{ {
$var = !$var; $var = !$var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
@ -201,12 +211,44 @@ if ($xml)
print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
print '</table>'; print '</table>';
if (empty($tmpfilelist) && empty($tmpfilelist2))
{
setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference"));
}
else
{
setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings');
}
} }
else else
{ {
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
$error++; $error++;
} }
// Scan scripts
/*
if (is_object($xml->dolibarr_script_dir[0]))
{
$file_list = array();
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list
}*/
asort($checksumconcat); // Sort list of checksum
//var_dump($checksumconcat);
$checksumget = md5(join(',',$checksumconcat));
$checksumtoget = $xml->dolibarr_htdocs_dir_checksum;
if ($checksumtoget)
{
print '<br>';
print '<strong>'.$langs->trans("GlobalChecksum").'</strong><br>';
print $langs->trans("ExpectedChecksum").' = '.$checksumtoget.'<br>';
print $langs->trans("CurrentChecksum").' = '.$checksumget;
}
} }
@ -223,12 +265,14 @@ exit($error);
* Function to get list of updated or modified files. * Function to get list of updated or modified files.
* $file_list is used as global variable * $file_list is used as global variable
* *
* @param array $file_list Array for response * @param array $file_list Array for response
* @param SimpleXMLElement $dir SimpleXMLElement of files to test * @param SimpleXMLElement $dir SimpleXMLElement of files to test
* @param string $path Path of file * @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
* @return array Array of filenames * @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
* @param array $checksumconcat Array of checksum
* @return array Array of filenames
*/ */
function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '') function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathref = '', &$checksumconcat = array())
{ {
$exclude = 'install'; $exclude = 'install';
@ -236,20 +280,21 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '')
{ {
$filename = $path.$file['name']; $filename = $path.$file['name'];
if (preg_match('#'.$exclude.'#', $filename)) continue; //if (preg_match('#'.$exclude.'#', $filename)) continue;
if (!file_exists(DOL_DOCUMENT_ROOT.'/'.$filename)) if (!file_exists($pathref.'/'.$filename))
{ {
$file_list['missing'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file); $file_list['missing'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file);
} }
else else
{ {
$md5_local = md5_file(DOL_DOCUMENT_ROOT.'/'.$filename); $md5_local = md5_file($pathref.'/'.$filename);
if ($md5_local != (string) $file) $file_list['updated'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file, 'md5'=>(string) $md5_local); if ($md5_local != (string) $file) $file_list['updated'][] = array('filename'=>$filename, 'expectedmd5'=>(string) $file, 'md5'=>(string) $md5_local);
} $checksumconcat[] = $md5_local;
}
} }
foreach ($dir->dir as $subdir) getFilesUpdated($file_list, $subdir, $path.$subdir['name'].'/'); foreach ($dir->dir as $subdir) getFilesUpdated($file_list, $subdir, $path.$subdir['name'].'/', $pathref, $checksumconcat);
return $file_list; return $file_list;
} }

View File

@ -105,7 +105,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
} }
if (! $error) if (! $error)
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUE ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')";
$result = $db->query($sql); $result = $db->query($sql);
if ($result > 0) if ($result > 0)
{ {

View File

@ -278,7 +278,7 @@ if ($action == 'add')
if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int"); if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int");
} }
$object->note = trim($_POST["note"]); $object->note = trim(GETPOST("note"));
if (isset($_POST["contactid"])) $object->contact = $contact; if (isset($_POST["contactid"])) $object->contact = $contact;
@ -290,11 +290,6 @@ if ($action == 'add')
$object->societe = $object->thirdparty; // For backward compatibility $object->societe = $object->thirdparty; // For backward compatibility
} }
// Special for module webcal and phenix
// TODO external modules
if (! empty($conf->webcalendar->enabled) && GETPOST('add_webcal') == 'on') $object->use_webcal=1;
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
// Check parameters // Check parameters
if (empty($object->userownerid) && empty($_SESSION['assignedtouser'])) if (empty($object->userownerid) && empty($_SESSION['assignedtouser']))
{ {

View File

@ -2025,7 +2025,7 @@ if ($action == 'create')
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else { } else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == 0) { if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; '; print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>'; print '</div>';

View File

@ -2219,7 +2219,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else { } else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == 0) { if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; '; print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>'; print '</div>';

View File

@ -3257,7 +3257,7 @@ else if ($id > 0 || ! empty($ref))
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else { } else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == 0) { if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; '; print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>'; print '</div>';
@ -3723,7 +3723,7 @@ else if ($id > 0 || ! empty($ref))
else else
print $langs->trans('ExcessReceived'); print $langs->trans('ExcessReceived');
print ' :</td>'; print ' :</td>';
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':$cssforamountpaymentcomplete).'>' . price($resteapayeraffiche) . '</td>'; print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>'; print '<td class="nowrap">&nbsp;</td></tr>';
} }
else // Credit note else // Credit note

View File

@ -646,7 +646,7 @@ print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="center" colspan="2" class="borderrightlight">'; print '<td align="center" colspan="2" class="liste_titre borderrightlight">';
print '<a href="clientfourn.php?year='.$annee.'">'; print '<a href="clientfourn.php?year='.$annee.'">';
print $annee; print $annee;
if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1); if ($conf->global->SOCIETE_FISCAL_MONTH_START > 1) print '-'.($annee+1);
@ -656,8 +656,8 @@ print '</tr>';
print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>'; print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
print '<td align="center">'.$langs->trans("Outcome").'</td>'; print '<td class="liste_titre" align="center">'.$langs->trans("Outcome").'</td>';
print '<td align="center" class="borderrightlight">'.$langs->trans("Income").'</td>'; print '<td class="liste_titre" align="center" class="borderrightlight">'.$langs->trans("Income").'</td>';
} }
print '</tr>'; print '</tr>';
@ -678,7 +678,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
if($mois>12) {$annee_decalage=$annee+1;} if($mois>12) {$annee_decalage=$annee+1;}
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage)); $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage));
print '<td align="right">&nbsp;'; print '<td class="liste_titre" align="right">&nbsp;';
if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0)
{ {
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss_ttc[$case],'MT')).'</a>'; print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss_ttc[$case],'MT')).'</a>';
@ -687,7 +687,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
} }
print "</td>"; print "</td>";
print '<td align="right" class="borderrightlight">&nbsp;'; print '<td align="right" class="liste_titre borderrightlight">&nbsp;';
//if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0) //if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0)
if (isset($encaiss_ttc[$case])) if (isset($encaiss_ttc[$case]))
{ {
@ -704,7 +704,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
// Total // Total
$var=!$var; $var=!$var;
$nbcols=0; $nbcols=0;
print '<tr class="liste_total"><td>'.$langs->trans("TotalTTC").'</td>'; print '<tr class="liste_total impair"><td>'.$langs->trans("TotalTTC").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
$nbcols+=2; $nbcols+=2;
@ -714,7 +714,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
print "</tr>\n"; print "</tr>\n";
// Empty line // Empty line
print '<tr><td>&nbsp;</td>'; print '<tr class="impair"><td>&nbsp;</td>';
print '<td colspan="'.$nbcols.'">&nbsp;</td>'; print '<td colspan="'.$nbcols.'">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -556,34 +556,42 @@ if ($id > 0)
print '<td>'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("Date").'</td>';
print '<td>'.$langs->trans("Type").'</td>'; print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>'; print '<td align="right">'.$langs->trans("Amount").'</td>';
print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$var=True; $var=true;
while ($i < $num) if ($num > 0)
{
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var]."><td>";
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount)."</td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$i++;
}
}
else
{ {
$objp = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr ".$bc[$var]."><td>"; print '<tr '.$bc[$var].'><td colspan="'.$nbcols.'" class="opacitymedium">'.$langs->trans("None").'</td><td></td><td></td><td></td></tr>';
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
$labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n";
print "</tr>";
$totalpaye += $objp->amount;
$i++;
} }
if ($object->paye == 0) if ($object->paye == 0)
{ {
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td></tr>\n"; print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AlreadyPaid")." :</td><td align=\"right\">".price($totalpaye)."</td></tr>\n";
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td></tr>\n"; print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("AmountExpected")." :</td><td align=\"right\">".price($object->amount)."</td></tr>\n";
$resteapayer = $object->amount - $totalpaye; $resteapayer = $object->amount - $totalpaye;
$cssforamountpaymentcomplete = 'amountpaymentcomplete';
print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>"; print "<tr><td colspan=\"3\" align=\"right\">".$langs->trans("RemainderToPay")." :</td>";
print "<td align=\"right\">".price($resteapayer)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td></tr>\n"; print '<td align="right"'.($resteapayer?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>'.price($resteapayer)."</td></tr>\n";
} }
print "</table>"; print "</table>";
$db->free($resql); $db->free($resql);

View File

@ -510,7 +510,7 @@ class ChargeSociales extends CommonObject
function info($id) function info($id)
{ {
$sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,";
$sql.= " fk_user_author, fk_user_modif, fk_user_valid"; $sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e";
$sql.= " WHERE e.rowid = ".$id; $sql.= " WHERE e.rowid = ".$id;
@ -543,7 +543,7 @@ class ChargeSociales extends CommonObject
} }
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
if (! empty($obj->fk_user_modif)) $this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev); $this->date_validation = $this->db->jdate($obj->datev);
$this->import_key = $obj->import_key; $this->import_key = $obj->import_key;
} }

View File

@ -456,10 +456,10 @@ print '<td class="liste_titre" align="left">';
print $form->select_country($search_country, 'search_country'); print $form->select_country($search_country, 'search_country');
//print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">'; //print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '</tr>'; print '</tr>';
$var=true; $var=true;

View File

@ -197,13 +197,13 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
} }
print '</tr>'; print '</tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Month").'</td>'; print '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
{ {
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.$langs->trans("AmountHT").'</td>'; if ($modecompta == 'CREANCES-DETTES') print '<td class="liste_titre" align="right">'.$langs->trans("AmountHT").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td class="liste_titre" align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right" class="borderrightlight">'.$langs->trans("Delta").'</td>'; print '<td class="liste_titre" align="right" class="borderrightlight">'.$langs->trans("Delta").'</td>';
if ($annee != $year_end) print '<td width="15">&nbsp;</td>'; if ($annee != $year_end) print '<td class="liste_titre" width="15">&nbsp;</td>';
} }
print '</tr>'; print '</tr>';

View File

@ -993,16 +993,26 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " u.login, u.rowid as user_id"; $sql.= " u.login, u.rowid as user_id";
if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname"; if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname"; if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
if (get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; if (get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
if (get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m"; if (get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
$sql.= " WHERE u.rowid = a.fk_user_author"; $sql.= " WHERE u.rowid = a.fk_user_author";
$sql.= " AND a.entity IN (".getEntity('agenda', 1).")"; $sql.= " AND a.entity IN (".getEntity('agenda', 1).")";
if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
if (get_class($filterobj) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; if (get_class($filterobj) == 'Adherent')
if (get_class($filterobj) == 'Adherent' && $filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id; {
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
if (get_class($filterobj) == 'CommandeFournisseur')
{
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id; if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
// Condition on actioncode // Condition on actioncode
if (! empty($actioncode)) if (! empty($actioncode))
@ -1133,6 +1143,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.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';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.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.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
@ -1142,9 +1153,10 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$userstatic=new User($db); $userstatic=new User($db);
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
// TODO uniformize // TODO mutualize/uniformize
$propalstatic=new Propal($db); $propalstatic=new Propal($db);
$orderstatic=new Commande($db); $orderstatic=new Commande($db);
$supplierorderstatic=new CommandeFournisseur($db);
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; $out.='<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
@ -1286,7 +1298,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>'; //$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
// Objet lie // Objet lie
// TODO uniformize // TODO mutualize/uniformize
$out.='<td>'; $out.='<td>';
//var_dump($histo[$key]['elementtype']); //var_dump($histo[$key]['elementtype']);
if (isset($histo[$key]['elementtype'])) if (isset($histo[$key]['elementtype']))

View File

@ -101,7 +101,8 @@ function facturefourn_prepare_head($object)
*/ */
function ordersupplier_prepare_head($object) function ordersupplier_prepare_head($object)
{ {
global $db, $langs, $conf; global $db, $langs, $conf, $user;
$h = 0; $h = 0;
$head = array(); $head = array();
@ -159,7 +160,12 @@ function ordersupplier_prepare_head($object)
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1].= $langs->trans("Events");
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][1].= '/';
$head[$h][1].= $langs->trans("Agenda");
}
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove'); complete_head_from_modules($conf,$langs,$object,$head,$h,'supplier_order', 'remove');

View File

@ -110,12 +110,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink; if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
print '</td></tr>'; print '</td></tr>';
print '<tr>';
print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></td>';
print '</tr>';
print '</table>'; print '</table>';
print '<br><div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
print '</form>'; print '</form>';
dol_fiche_end(); dol_fiche_end();

View File

@ -50,8 +50,8 @@ class modAccounting extends DolibarrModules
$this->name = preg_replace('/^mod/i', '', get_class($this)); $this->name = preg_replace('/^mod/i', '', get_class($this));
$this->description = "Advanced accounting management"; $this->description = "Advanced accounting management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
$this->version = 'experimental'; $this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
$this->special = 0; $this->special = 0;

View File

@ -62,7 +62,7 @@ class modMultiCurrency extends DolibarrModules
$this->description = "Module to enter elements with a foreign currency"; $this->description = "Module to enter elements with a foreign currency";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
$this->version = 'experimental'; $this->version = 'dolibarr';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)

View File

@ -126,7 +126,7 @@ if ($object->id)
if ($user->rights->don->creer) if ($user->rights->don->creer)
{ {
if ($action != 'classify') if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -80,7 +80,7 @@ if (! empty($conf->projet->enabled))
if ($user->rights->don->creer) if ($user->rights->don->creer)
{ {
if ($action != 'classify') if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -97,7 +97,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->don->creer) if ($user->rights->don->creer)
{ {
if ($action != 'classify') if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; // $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') { if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">'; $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';

View File

@ -128,6 +128,12 @@ class CommandeFournisseur extends CommonOrder
public $multicurrency_total_tva; public $multicurrency_total_tva;
public $multicurrency_total_ttc; public $multicurrency_total_ttc;
/**
* Draft status
*/
const STATUS_DRAFT = 0;
/** /**
* Constructor * Constructor

View File

@ -1900,7 +1900,7 @@ elseif (! empty($object->id))
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else { } else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == 0) { if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; '; print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>'; print '</div>';

View File

@ -184,7 +184,7 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.='</div>'; $morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end(); dol_fiche_end();

View File

@ -625,9 +625,9 @@ if ($id > 0 || ! empty($ref)) {
// Message if nothing to dispatch // Message if nothing to dispatch
if (! $nbproduct) { if (! $nbproduct) {
if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))
print $langs->trans("NoPredefinedProductToDispatch"); // No predefined line at all print '<div class="opacitymedium">'.$langs->trans("NoPredefinedProductToDispatch").'</div>'; // No predefined line at all
else else
print $langs->trans("NoMorePredefinedProductToDispatch"); // No predefined line that remain to be dispatched. print '<div class="opacitymedium">'.$langs->trans("NoMorePredefinedProductToDispatch").'</div>'; // No predefined line that remain to be dispatched.
} }
print '</form>'; print '</form>';

View File

@ -27,6 +27,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->load("orders"); $langs->load("orders");
$langs->load("suppliers"); $langs->load("suppliers");
@ -35,11 +36,44 @@ $langs->load('stocks');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
$action = GETPOST('action','alpha');
if (GETPOST('actioncode','array'))
{
$actioncode=GETPOST('actioncode','array',3);
if (! count($actioncode)) $actioncode='0';
}
else
{
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
$search_agenda_label=GETPOST('search_agenda_label');
// Security check // Security check
$socid=''; $socid=0;
if (! empty($user->societe_id)) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, '', 'commande'); $result=restrictedArea($user,'fournisseur',$id,'', 'commande');
if (!$user->rights->fournisseur->commande->lire) accessforbidden();
/*
* Actions
*/
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$actioncode='';
$search_agenda_label='';
}
/* /*
@ -47,89 +81,143 @@ $result = restrictedArea($user, 'fournisseur', $id, '', 'commande');
*/ */
$form = new Form($db); $form = new Form($db);
$object = new CommandeFournisseur($db);
$now=dol_now();
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$soc = new Societe($db); $object->fetch($id, $ref);
$object = new CommandeFournisseur($db); $object->fetch_thirdparty();
$object->info($object->id);
$result=$object->fetch($id,$ref);
if ($result >= 0)
{
$object->info($object->id);
$soc->fetch($object->socid);
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('',$langs->trans("Order"),$help_url);
$head = ordersupplier_prepare_head($object);
$title=$langs->trans("SupplierOrder");
dol_fiche_head($head, 'info', $title, 0, 'order');
/*
* Commande
*/
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
print '</tr>';
// Fournisseur
print '<tr><td>'.$langs->trans("Supplier")."</td>";
print '<td colspan="2">'.$soc->getNomUrl(1,'supplier').'</td>';
print '</tr>';
// Statut
print '<tr>';
print '<td>'.$langs->trans("Status").'</td>';
print '<td colspan="2">';
print $object->getLibStatut(4);
print "</td></tr>";
// Date
if ($object->methode_commande_id > 0)
{
print '<tr><td>'.$langs->trans("Date").'</td><td colspan="2">';
if ($object->date_commande)
{
print dol_print_date($object->date_commande,"dayhourtext")."\n";
}
print "</td></tr>";
if ($object->methode_commande)
{
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$object->getInputMethod().'</td></tr>';
}
}
print "</table>\n";
print "<br>";
print '<table width="100%"><tr><td>';
dol_print_object_info($object, 1);
print '</td></tr></table>';
print '</div>';
}
else
{
/* Order not found */
print "OrderNotFound";
}
} }
$title=$langs->trans("SupplierOrder").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url='EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
llxHeader('',$title,$help_url);
$now=dol_now();
$head = ordersupplier_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("SupplierOrder"), 0, 'order');
// Supplier order card
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Ref supplier
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
dol_print_object_info($object, 1);
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
// Actions buttons
$out='';
$permok=$user->rights->agenda->myactions->create;
if ($permok)
{
$out.='&originid='.$object->id.'&origin=order_supplier';
}
print '<div class="tabsAction">';
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("AddAction").'</a>';
}
else
{
print '<a class="butActionRefused" href="#">'.$langs->trans("AddAction").'</a>';
}
}
print '</div>';
if (!empty($object->id))
{
$param='&id='.$object->id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnOrder"),'','');
// List of actions on element
/*include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'project',0);*/
// List of todo actions
//show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode);
// List of done actions
//show_actions_done($conf,$langs,$db,$object,null,0,$actioncode);
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters);
}
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -2152,7 +2152,7 @@ else
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
} else { } else {
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
if($object->statut == 0) { if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code != $conf->currency) {
print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; '; print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
print '</div>'; print '</div>';
@ -2269,7 +2269,7 @@ else
} }
// Amount // Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans('AmountHT').'</td><td>'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; '; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha');
else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal');

View File

@ -134,32 +134,66 @@ if ($id > 0 || ! empty($ref))
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$alreadypaid=$object->getSommePaiement();
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill'); dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill');
/* $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
* Facture synthese pour rappel
*/ $morehtmlref='<div class="refidno">';
// Ref supplier
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Reference du facture
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print "</td></tr>";
// Ref supplier
print '<tr><td class="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
print "</tr>\n";
// Third party
print "<tr><td>".$langs->trans("Supplier")."</td>";
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'supplier').'</td></tr>';
// Type // Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">'; print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td colspan="4">';
print $object->getLibType(); print $object->getLibType();
if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) if ($object->type == FactureFournisseur::TYPE_REPLACEMENT)
{ {
@ -198,33 +232,29 @@ if ($id > 0 || ! empty($ref))
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td>';
print $form->editfieldval("Label",'label',$object->label,$object,0); print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td></tr>'; print '</td></tr>';
// Status
$alreadypaid=$object->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4,$alreadypaid).'</td></tr>';
// Amount // Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="3">'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3">'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
// Amount Local Taxes // Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option //TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj=="1") //Localtax1 if ($societe->localtax1_assuj=="1") //Localtax1
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td colspan="3">'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>'; print '<td>'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
if ($societe->localtax2_assuj=="1") //Localtax2 if ($societe->localtax2_assuj=="1") //Localtax2
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td colspan="3">'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>'; print '<td>'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print "</table>"; print "</table>";

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 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) 2016 Alexandre Spangaro <aspangaro@zendsi.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
* 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
@ -90,6 +91,58 @@ if ($object->id > 0)
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill'); dol_fiche_head($head, 'documents', $langs->trans('SupplierInvoice'), 0, 'bill');
$totalpaye = $object->getSommePaiement();
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
// Ref supplier
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0; $totalsize=0;
@ -109,23 +162,8 @@ if ($object->id > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td class="titlefield nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
print "</tr>\n";
// Ref supplier
print '<tr><td class="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
print "</tr>\n";
// Thirdparty
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1,'supplier').'</td></tr>';
// Type // Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">'; print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
print $object->getLibType(); print $object->getLibType();
if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) if ($object->type == FactureFournisseur::TYPE_REPLACEMENT)
{ {
@ -166,42 +204,38 @@ if ($object->id > 0)
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td>';
print $form->editfieldval("Label",'label',$object->label,$object,0); print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td>'; print '</td>';
// Status
$alreadypaid=$object->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4,$alreadypaid).'</td></tr>';
// Amount // Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="3">'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3">'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
// Amount Local Taxes // Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option //TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj=="1") //Localtax1 if ($societe->localtax1_assuj=="1") //Localtax1
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td colspan="3">'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>'; print '<td>'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
if ($societe->localtax2_assuj=="1") //Localtax2 if ($societe->localtax2_assuj=="1") //Localtax2
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td colspan="3">'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>'; print '<td>'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '</table><br>'; print '</table><br>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Nb of files // Nb of files
print '<tr><td class="titlefield nowrap">'.$langs->trans('NbOfAttachedFiles').'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td class="titlefield nowrap">'.$langs->trans('NbOfAttachedFiles').'</td><td>'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td colspan="3">'.$totalsize.' '.$langs->trans('bytes').'</td></tr>'; print '<tr><td>'.$langs->trans('TotalSizeOfAttachedFiles').'</td><td>'.$totalsize.' '.$langs->trans('bytes').'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 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) 2016 Alexandre Spangaro <aspangaro@zendsi.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
* 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
@ -26,17 +27,19 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load('bills'); $langs->load('bills');
$id = GETPOST("facid",'int'); $id = GETPOST("facid",'int')?GETPOST("facid",'int'):GETPOST("id",'int');
$ref = GETPOST("ref",'alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db);
/* /*
@ -47,16 +50,69 @@ $title = $langs->trans('SupplierInvoice') . " - " . $langs->trans('Info');
$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; $helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);
$object = new FactureFournisseur($db); $object->fetch($id, $ref);
$object->fetch($id); $object->fetch_thirdparty();
$object->info($id);
$soc = new Societe($db); $object->info($object->id);
$soc->fetch($object->socid);
$alreadypaid=$object->getSommePaiement();
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice'); $titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill'); dol_fiche_head($head, 'info', $langs->trans('SupplierInvoice'), 0, 'bill');
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">';
// Ref supplier
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
// $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
if ($action != 'classify')
//$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
$object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -75,6 +75,8 @@ if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$alreadypaid=$object->getSommePaiement();
$head = facturefourn_prepare_head($object); $head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice'); $titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'note', $titre, 0, 'bill'); dol_fiche_head($head, 'note', $titre, 0, 'bill');
@ -82,23 +84,59 @@ if ($object->id > 0)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; // Supplier invoice card
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref $morehtmlref='<div class="refidno">';
print '<tr><td class="titlefield nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; // Ref supplier
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1);
print '</td>'; $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', null, null, '', 1);
print "</tr>\n"; // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (! empty($conf->projet->enabled))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->fournisseur->commande->creer)
{
if ($action != 'classify')
// $morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
$morehtmlref.=' : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
// Ref supplier $object->totalpaye = $alreadypaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
print '<tr><td class="nowrap">'.$langs->trans("RefSupplier").'</td><td colspan="3">'.$object->ref_supplier.'</td>';
print "</tr>\n";
// Company dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<tr><td>'.$langs->trans('Supplier').'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1,'supplier').'</td></tr>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
// Type // Type
print '<tr><td>'.$langs->trans('Type').'</td><td colspan="4">'; print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
print $object->getLibType(); print $object->getLibType();
if ($object->type == FactureFournisseur::TYPE_REPLACEMENT) if ($object->type == FactureFournisseur::TYPE_REPLACEMENT)
{ {
@ -137,38 +175,35 @@ if ($object->id > 0)
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,0).'</td><td>';
print $form->editfieldval("Label",'label',$object->label,$object,0); print $form->editfieldval("Label",'label',$object->label,$object,0);
print '</td></tr>'; print '</td></tr>';
// Status
$alreadypaid=$object->getSommePaiement();
print '<tr><td>'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4,$alreadypaid).'</td></tr>';
// Amount // Amount
print '<tr><td>'.$langs->trans('AmountHT').'</td><td colspan="3">'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td>'.$langs->trans('AmountVAT').'</td><td colspan="3">'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
// Amount Local Taxes // Amount Local Taxes
//TODO: Place into a function to control showing by country or study better option //TODO: Place into a function to control showing by country or study better option
if ($societe->localtax1_assuj=="1") //Localtax1 if ($societe->localtax1_assuj=="1") //Localtax1
{ {
print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT1",$societe->country_code).'</td>';
print '<td colspan="3">'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>'; print '<td>'.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
if ($societe->localtax2_assuj=="1") //Localtax2 if ($societe->localtax2_assuj=="1") //Localtax2
{ {
print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>'; print '<tr><td>'.$langs->transcountry("AmountLT2",$societe->country_code).'</td>';
print '<td colspan="3">'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>'; print '<td>'.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).'</td>';
print '</tr>'; print '</tr>';
} }
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="3">'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).'</td></tr>';
print "</table>"; print "</table>";
print '<br>'; print '<br>';
$cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end(); dol_fiche_end();

View File

@ -10,6 +10,9 @@ VersionUnknown=Unknown
VersionRecommanded=Recommended VersionRecommanded=Recommended
FileCheck=Files integrity checker FileCheck=Files integrity checker
FileCheckDesc=This tool allows you to check the integrity of files of your application, comparing each files with the official ones. You can use this tool to detect if some files were modified by a hacker for example. FileCheckDesc=This tool allows you to check the integrity of files of your application, comparing each files with the official ones. You can use this tool to detect if some files were modified by a hacker for example.
FileIntegrityIsStrictlyConformedWithReference=Files integrity is strictly conformed with the reference.
FileIntegritySomeFilesWereRemovedOrModified=Files integrity check has failed. Some files were modified of removed.
GlobalChecksum=Global checksum
MakeIntegrityAnalysisFrom=Make integrity analysis of application files from MakeIntegrityAnalysisFrom=Make integrity analysis of application files from
LocalSignature=Embedded local signature (less reliable) LocalSignature=Embedded local signature (less reliable)
RemoteSignature=Remote distant signature (more reliable) RemoteSignature=Remote distant signature (more reliable)

View File

@ -753,6 +753,7 @@ RemoveString=Remove string '%s'
SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">http://transifex.com/projects/p/dolibarr/</a>. SomeTranslationAreUncomplete=Some languages may be partially translated or may contains errors. If you detect some, you can fix language files registering to <a href="https://transifex.com/projects/p/dolibarr/" target="_blank">http://transifex.com/projects/p/dolibarr/</a>.
DirectDownloadLink=Direct download link DirectDownloadLink=Direct download link
Download=Download Download=Download
ActualizeCurrency=Update currency rate
# Week day # Week day
Monday=Monday Monday=Monday
Tuesday=Tuesday Tuesday=Tuesday

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> /* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.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
* 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
@ -70,6 +70,8 @@ dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0,
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<br>';
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -168,7 +168,7 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',0,0,''); print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,'');
$i = 0; $i = 0;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";

View File

@ -205,7 +205,7 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',0,0,''); print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,$num,'');
$i = 0; $i = 0;
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";

View File

@ -201,7 +201,7 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
print '<br>'; print '<br>';
print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&amp;id=".$id,$sortfield,$sortorder,'',0,0,''); print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&amp;id=".$id,$sortfield,$sortorder,'',$num,$num,'');
$moreforfilter=''; $moreforfilter='';
@ -301,16 +301,10 @@ if ($result)
// affichage totaux marges // affichage totaux marges
$var=!$var; $var=!$var;
$totalMargin = $cumul_vente - $cumul_achat; $totalMargin = $cumul_vente - $cumul_achat;
/*if ($totalMargin < 0)
{ $marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
$marginRate = ($cumul_achat != 0)?-1*(100 * $totalMargin / $cumul_achat):''; $markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
$markRate = ($cumul_vente != 0)?-1*(100 * $totalMargin / $cumul_vente):'';
}
else
{*/
$marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):'';
$markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):'';
//}
print '<tr class="liste_total">'; print '<tr class="liste_total">';
if ($id > 0) if ($id > 0)
print '<td colspan=2>'; print '<td colspan=2>';

View File

@ -58,6 +58,10 @@ $fieldid = isset($_GET["ref"])?'ref':'rowid';
$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); $d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$pdluoid=GETPOST('pdluoid','int'); $pdluoid=GETPOST('pdluoid','int');
$batchnumber=GETPOST('batch_number','san_alpha');
if (!empty($batchnumber)) {
$batchnumber=trim($batchnumber);
}
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -203,7 +207,7 @@ if ($action == "correct_stock" && ! $cancel)
$object = new Product($db); $object = new Product($db);
$result=$object->fetch($id); $result=$object->fetch($id);
if ($object->hasbatch() && ! GETPOST("batch_number")) if ($object->hasbatch() && ! $batchnumber)
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
$error++; $error++;
@ -231,7 +235,7 @@ if ($action == "correct_stock" && ! $cancel)
$priceunit, $priceunit,
$d_eatby, $d_eatby,
$d_sellby, $d_sellby,
GETPOST('batch_number'), $batchnumber,
GETPOST('inventorycode') GETPOST('inventorycode')
); // We do not change value of stock for a correction ); // We do not change value of stock for a correction
} }
@ -296,7 +300,7 @@ if ($action == "transfert_stock" && ! $cancel)
$object = new Product($db); $object = new Product($db);
$result=$object->fetch($id); $result=$object->fetch($id);
if ($object->hasbatch() && ! GETPOST("batch_number")) if ($object->hasbatch() && ! $batchnumber)
{ {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors');
$error++; $error++;
@ -343,7 +347,7 @@ if ($action == "transfert_stock" && ! $cancel)
else else
{ {
$srcwarehouseid=GETPOST('id_entrepot','int'); $srcwarehouseid=GETPOST('id_entrepot','int');
$batch=GETPOST('batch_number'); $batch=$batchnumber;
$eatby=$d_eatby; $eatby=$d_eatby;
$sellby=$d_sellby; $sellby=$d_sellby;
} }
@ -448,14 +452,14 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save'))
{ {
if ($pdluo->id) if ($pdluo->id)
{ {
if ((! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) { if ((! GETPOST("sellby")) && (! GETPOST("eatby")) && (! $batchnumber)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors');
} }
else else
{ {
$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); $d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
$pdluo->batch=GETPOST("batch_number",'san_alpha'); $pdluo->batch=$batchnumber;
$pdluo->eatby=$d_eatby; $pdluo->eatby=$d_eatby;
$pdluo->sellby=$d_sellby; $pdluo->sellby=$d_sellby;
$result=$pdluo->update($user); $result=$pdluo->update($user);

View File

@ -48,7 +48,6 @@ $search_agenda_label=GETPOST('search_agenda_label');
// Security check // Security check
$socid=0; $socid=0;
$id = GETPOST("id",'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'projet',$id,''); $result=restrictedArea($user,'projet',$id,'');
@ -80,11 +79,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$form = new Form($db); $form = new Form($db);
$object = new Project($db); $object = new Project($db);
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("",$title,$help_url);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$object->fetch($id, $ref); $object->fetch($id, $ref);
@ -92,6 +86,11 @@ if ($id > 0 || ! empty($ref))
$object->info($object->id); $object->info($object->id);
} }
$title=$langs->trans("Project").' - '.$object->ref.' '.$object->name;
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->ref.' '.$object->name.' - '.$langs->trans("Info");
$help_url="EN:Module_Projects|FR:Module_Projets|ES:M&oacute;dulo_Proyectos";
llxHeader("",$title,$help_url);
$head = project_prepare_head($object); $head = project_prepare_head($object);
dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
@ -162,6 +161,10 @@ print '</div>';
if (!empty($object->id)) if (!empty($object->id))
{ {
$param='&id='.$object->id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print load_fiche_titre($langs->trans("ActionsOnProject"),'',''); print load_fiche_titre($langs->trans("ActionsOnProject"),'','');
// List of actions on element // List of actions on element

View File

@ -58,7 +58,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
$form = new Form($db); $form = new Form($db);
$title=$langs->trans("ThirdParty").' - '.$langs->trans("Notes"); $title=$langs->trans("ThirdParty").' - '.$langs->trans("Notes");
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Files"); if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Notes");
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url); llxHeader('',$title,$help_url);