Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
f760b20bde
commit
208740c9c4
@ -54,113 +54,113 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
|||||||
|
|
||||||
if ($action == 'updateMask')
|
if ($action == 'updateMask')
|
||||||
{
|
{
|
||||||
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha');
|
$maskconstdelivery = GETPOST('maskconstdelivery', 'alpha');
|
||||||
$maskdelivery = GETPOST('maskdelivery', 'alpha');
|
$maskdelivery = GETPOST('maskdelivery', 'alpha');
|
||||||
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
|
if ($maskconstdelivery) $res = dolibarr_set_const($db, $maskconstdelivery, $maskdelivery, 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if (!$res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'set_DELIVERY_FREE_TEXT')
|
if ($action == 'set_DELIVERY_FREE_TEXT')
|
||||||
{
|
{
|
||||||
$free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
|
$free = GETPOST('DELIVERY_FREE_TEXT', 'restricthtml'); // No alpha here, we want exact string
|
||||||
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
if (!$res > 0) $error++;
|
if (!$res > 0) $error++;
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'specimen')
|
if ($action == 'specimen')
|
||||||
{
|
{
|
||||||
$modele = GETPOST('module', 'alpha');
|
$modele = GETPOST('module', 'alpha');
|
||||||
|
|
||||||
$sending = new Delivery($db);
|
$sending = new Delivery($db);
|
||||||
$sending->initAsSpecimen();
|
$sending->initAsSpecimen();
|
||||||
|
|
||||||
// Search template files
|
// Search template files
|
||||||
$file = ''; $classname = ''; $filefound = 0;
|
$file = ''; $classname = ''; $filefound = 0;
|
||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0);
|
$file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound = 1;
|
$filefound = 1;
|
||||||
$classname = "pdf_".$modele;
|
$classname = "pdf_".$modele;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filefound)
|
if ($filefound)
|
||||||
{
|
{
|
||||||
require_once $file;
|
require_once $file;
|
||||||
|
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
if ($module->write_file($sending, $langs) > 0)
|
if ($module->write_file($sending, $langs) > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=delivery&file=SPECIMEN.pdf");
|
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=delivery&file=SPECIMEN.pdf");
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($module->error, $module->errors, 'errors');
|
setEventMessages($module->error, $module->errors, 'errors');
|
||||||
dol_syslog($module->error, LOG_ERR);
|
dol_syslog($module->error, LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'del')
|
if ($action == 'del')
|
||||||
{
|
{
|
||||||
$ret = delDocumentModel($value, $type);
|
$ret = delDocumentModel($value, $type);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
{
|
{
|
||||||
if ($conf->global->DELIVERY_ADDON_PDF == "$value") dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity);
|
if ($conf->global->DELIVERY_ADDON_PDF == "$value") dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdoc')
|
if ($action == 'setdoc')
|
||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, "DELIVERY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
|
if (dolibarr_set_const($db, "DELIVERY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
|
||||||
{
|
{
|
||||||
// La constante qui a ete lue en avant du nouveau set
|
// La constante qui a ete lue en avant du nouveau set
|
||||||
// on passe donc par une variable pour avoir un affichage coherent
|
// on passe donc par une variable pour avoir un affichage coherent
|
||||||
$conf->global->DELIVERY_ADDON_PDF = $value;
|
$conf->global->DELIVERY_ADDON_PDF = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On active le modele
|
// On active le modele
|
||||||
$ret = delDocumentModel($value, $type);
|
$ret = delDocumentModel($value, $type);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
{
|
{
|
||||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setmod')
|
if ($action == 'setmod')
|
||||||
{
|
{
|
||||||
// TODO Verifier si module numerotation choisi peut etre active
|
// TODO Verifier si module numerotation choisi peut etre active
|
||||||
// par appel methode canBeActivated
|
// par appel methode canBeActivated
|
||||||
|
|
||||||
dolibarr_set_const($db, "DELIVERY_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "DELIVERY_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,79 +199,79 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/delivery/");
|
$dir = dol_buildpath($reldir."core/modules/delivery/");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle)) !== false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
if (preg_match('/^mod_delivery_([a-z0-9_]*)\.php$/', $file)) {
|
if (preg_match('/^mod_delivery_([a-z0-9_]*)\.php$/', $file)) {
|
||||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
if ($module->isEnabled())
|
if ($module->isEnabled())
|
||||||
{
|
{
|
||||||
// Show modules according to features level
|
// Show modules according to features level
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||||
print $module->info();
|
print $module->info();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Show example of numbering module
|
// Show example of numbering module
|
||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
$tmp = $module->getExample();
|
$tmp = $module->getExample();
|
||||||
if (preg_match('/^Error/', $tmp)) {
|
if (preg_match('/^Error/', $tmp)) {
|
||||||
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||||
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||||
else print $tmp;
|
else print $tmp;
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($conf->global->DELIVERY_ADDON_NUMBER == "$file")
|
if ($conf->global->DELIVERY_ADDON_NUMBER == "$file")
|
||||||
{
|
{
|
||||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.urlencode($file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$delivery = new Delivery($db);
|
$delivery = new Delivery($db);
|
||||||
$delivery->initAsSpecimen();
|
$delivery->initAsSpecimen();
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip = '';
|
$htmltooltip = '';
|
||||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
$nextval = $module->getNextValue($mysoc, $delivery);
|
$nextval = $module->getNextValue($mysoc, $delivery);
|
||||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||||
if ($nextval) {
|
if ($nextval) {
|
||||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||||
$nextval = $langs->trans($nextval);
|
$nextval = $langs->trans($nextval);
|
||||||
$htmltooltip .= $nextval.'<br>';
|
$htmltooltip .= $nextval.'<br>';
|
||||||
} else {
|
} else {
|
||||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -321,14 +321,14 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/delivery/doc/");
|
$dir = dol_buildpath($reldir."core/modules/delivery/doc/");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle)) !== false)
|
while (($file = readdir($handle)) !== false)
|
||||||
{
|
{
|
||||||
$filelist[] = $file;
|
$filelist[] = $file;
|
||||||
}
|
}
|
||||||
@ -337,79 +337,79 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
foreach ($filelist as $file)
|
foreach ($filelist as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||||
{
|
{
|
||||||
if (file_exists($dir.'/'.$file))
|
if (file_exists($dir.'/'.$file))
|
||||||
{
|
{
|
||||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||||
|
|
||||||
require_once $dir.'/'.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
$modulequalified = 1;
|
$modulequalified = 1;
|
||||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||||
|
|
||||||
if ($modulequalified)
|
if ($modulequalified)
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven"><td width="100">';
|
print '<tr class="oddeven"><td width="100">';
|
||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
if (method_exists($module, 'info')) print $module->info($langs);
|
if (method_exists($module, 'info')) print $module->info($langs);
|
||||||
else print $module->description;
|
else print $module->description;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
if (in_array($name, $def))
|
if (in_array($name, $def))
|
||||||
{
|
{
|
||||||
print "<td align=\"center\">\n";
|
print "<td align=\"center\">\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
|
||||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
} else {
|
} else {
|
||||||
print "<td align=\"center\">\n";
|
print "<td align=\"center\">\n";
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default
|
// Default
|
||||||
print "<td align=\"center\">";
|
print "<td align=\"center\">";
|
||||||
if ($conf->global->DELIVERY_ADDON_PDF == "$name")
|
if ($conf->global->DELIVERY_ADDON_PDF == "$name")
|
||||||
{
|
{
|
||||||
print img_picto($langs->trans("Default"), 'on');
|
print img_picto($langs->trans("Default"), 'on');
|
||||||
} else {
|
} else {
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip = ''.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
$htmltooltip = ''.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").'</u>:';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Preview
|
// Preview
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($module->type == 'pdf')
|
if ($module->type == 'pdf')
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
|
||||||
} else {
|
} else {
|
||||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -440,11 +440,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $la
|
|||||||
$variablename = 'DELIVERY_FREE_TEXT';
|
$variablename = 'DELIVERY_FREE_TEXT';
|
||||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||||
{
|
{
|
||||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||||
} else {
|
} else {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||||
print $doleditor->Create();
|
print $doleditor->Create();
|
||||||
}
|
}
|
||||||
print '</td><td class="right">';
|
print '</td><td class="right">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
|||||||
@ -124,9 +124,9 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $datec;
|
public $datec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string $date_creation;
|
* @var integer|string $date_creation;
|
||||||
*/
|
*/
|
||||||
public $date_creation;
|
public $date_creation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,13 +136,13 @@ class Propal extends CommonObject
|
|||||||
public $datev;
|
public $datev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string $date_validation;
|
* @var integer|string $date_validation;
|
||||||
*/
|
*/
|
||||||
public $date_validation;
|
public $date_validation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string date of the quote;
|
* @var integer|string date of the quote;
|
||||||
*/
|
*/
|
||||||
public $date;
|
public $date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,9 +186,9 @@ class Propal extends CommonObject
|
|||||||
public $remise_absolue = 0;
|
public $remise_absolue = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public $fk_address;
|
public $fk_address;
|
||||||
|
|
||||||
public $address_type;
|
public $address_type;
|
||||||
@ -218,8 +218,8 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
public $fk_multicurrency;
|
public $fk_multicurrency;
|
||||||
|
|
||||||
public $multicurrency_code;
|
public $multicurrency_code;
|
||||||
@ -342,7 +342,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $socid Id third party
|
* @param int $socid Id third party
|
||||||
* @param int $propalid Id proposal
|
* @param int $propalid Id proposal
|
||||||
*/
|
*/
|
||||||
public function __construct($db, $socid = 0, $propalid = 0)
|
public function __construct($db, $socid = 0, $propalid = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Add line into array products
|
* Add line into array products
|
||||||
* $this->thirdparty should be loaded
|
* $this->thirdparty should be loaded
|
||||||
@ -370,9 +370,9 @@ class Propal extends CommonObject
|
|||||||
* TODO Replace calls to this function by generation objet Ligne
|
* TODO Replace calls to this function by generation objet Ligne
|
||||||
* inserted into table $this->products
|
* inserted into table $this->products
|
||||||
*/
|
*/
|
||||||
public function add_product($idproduct, $qty, $remise_percent = 0)
|
public function add_product($idproduct, $qty, $remise_percent = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $mysoc;
|
global $conf, $mysoc;
|
||||||
|
|
||||||
if (!$qty) $qty = 1;
|
if (!$qty) $qty = 1;
|
||||||
@ -417,16 +417,16 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Adding line of fixed discount in the proposal in DB
|
* Adding line of fixed discount in the proposal in DB
|
||||||
*
|
*
|
||||||
* @param int $idremise Id of fixed discount
|
* @param int $idremise Id of fixed discount
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function insert_discount($idremise)
|
public function insert_discount($idremise)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
@ -493,43 +493,43 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a proposal line into database (linked to product/service or not)
|
* Add a proposal line into database (linked to product/service or not)
|
||||||
* The parameters are already supposed to be appropriate and with final values to the call
|
* The parameters are already supposed to be appropriate and with final values to the call
|
||||||
* of this method. Also, for the VAT rate, it must have already been defined
|
* of this method. Also, for the VAT rate, it must have already been defined
|
||||||
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
|
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
|
||||||
* and desc must already have the right value (it's up to the caller to manage multilanguage)
|
* and desc must already have the right value (it's up to the caller to manage multilanguage)
|
||||||
*
|
*
|
||||||
* @param string $desc Description of line
|
* @param string $desc Description of line
|
||||||
* @param float $pu_ht Unit price
|
* @param float $pu_ht Unit price
|
||||||
* @param float $qty Quantity
|
* @param float $qty Quantity
|
||||||
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
|
* @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
|
||||||
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
|
* @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
|
||||||
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
|
* @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
|
||||||
* @param int $fk_product Product/Service ID predefined
|
* @param int $fk_product Product/Service ID predefined
|
||||||
* @param float $remise_percent Pourcentage de remise de la ligne
|
* @param float $remise_percent Pourcentage de remise de la ligne
|
||||||
* @param string $price_base_type HT or TTC
|
* @param string $price_base_type HT or TTC
|
||||||
* @param float $pu_ttc Prix unitaire TTC
|
* @param float $pu_ttc Prix unitaire TTC
|
||||||
* @param int $info_bits Bits for type of lines
|
* @param int $info_bits Bits for type of lines
|
||||||
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
|
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
|
||||||
* @param int $rang Position of line
|
* @param int $rang Position of line
|
||||||
* @param int $special_code Special code (also used by externals modules!)
|
* @param int $special_code Special code (also used by externals modules!)
|
||||||
* @param int $fk_parent_line Id of parent line
|
* @param int $fk_parent_line Id of parent line
|
||||||
* @param int $fk_fournprice Id supplier price
|
* @param int $fk_fournprice Id supplier price
|
||||||
* @param int $pa_ht Buying price without tax
|
* @param int $pa_ht Buying price without tax
|
||||||
* @param string $label ???
|
* @param string $label ???
|
||||||
* @param int $date_start Start date of the line
|
* @param int $date_start Start date of the line
|
||||||
* @param int $date_end End date of the line
|
* @param int $date_end End date of the line
|
||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||||
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
||||||
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
|
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
|
||||||
* @param double $pu_ht_devise Unit price in currency
|
* @param double $pu_ht_devise Unit price in currency
|
||||||
* @param int $fk_remise_except Id discount if line is from a discount
|
* @param int $fk_remise_except Id discount if line is from a discount
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
* @see add_product()
|
* @see add_product()
|
||||||
*/
|
*/
|
||||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
|
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0)
|
||||||
{
|
{
|
||||||
global $mysoc, $conf, $langs;
|
global $mysoc, $conf, $langs;
|
||||||
|
|
||||||
@ -706,27 +706,27 @@ class Propal extends CommonObject
|
|||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
if (!empty($fk_parent_line)) $this->line_order(true, 'DESC');
|
if (!empty($fk_parent_line)) $this->line_order(true, 'DESC');
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||||
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
$result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->line->id;
|
return $this->line->id;
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->error();
|
$this->error = $this->db->error();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->line->error;
|
$this->error = $this->line->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_syslog(get_class($this)."::addline status of proposal must be Draft to allow use of ->addline()", LOG_ERR);
|
dol_syslog(get_class($this)."::addline status of proposal must be Draft to allow use of ->addline()", LOG_ERR);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -757,11 +757,11 @@ class Propal extends CommonObject
|
|||||||
* @param int $notrigger disable line update trigger
|
* @param int $notrigger disable line update trigger
|
||||||
* @return int 0 if OK, <0 if KO
|
* @return int 0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
|
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $mysoc, $langs;
|
global $mysoc, $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
||||||
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
@ -778,11 +778,11 @@ class Propal extends CommonObject
|
|||||||
if (!empty($qty) && $special_code == 3) $special_code = 0; // Remove option tag
|
if (!empty($qty) && $special_code == 3) $special_code = 0; // Remove option tag
|
||||||
if (empty($type)) $type = 0;
|
if (empty($type)) $type = 0;
|
||||||
|
|
||||||
if ($date_start && $date_end && $date_start > $date_end) {
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$this->error = $langs->trans('ErrorStartDateGreaterEnd');
|
$this->error = $langs->trans('ErrorStartDateGreaterEnd');
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
@ -926,7 +926,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $lineid Id of line to delete
|
* @param int $lineid Id of line to delete
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function deleteline($lineid)
|
public function deleteline($lineid)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
@ -964,7 +964,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if KO, >=0 if OK
|
* @return int <0 if KO, >=0 if OK
|
||||||
*/
|
*/
|
||||||
public function create($user, $notrigger = 0)
|
public function create($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -1102,62 +1102,62 @@ class Propal extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql) $error++;
|
if (!$resql) $error++;
|
||||||
|
|
||||||
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
|
||||||
{
|
{
|
||||||
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
|
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
foreach ($this->linked_objects as $origin => $tmp_origin_id)
|
foreach ($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
{
|
{
|
||||||
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
{
|
{
|
||||||
foreach ($tmp_origin_id as $origin_id)
|
foreach ($tmp_origin_id as $origin_id)
|
||||||
{
|
{
|
||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (!$ret)
|
if (!$ret)
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
} else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||||
{
|
{
|
||||||
$origin_id = $tmp_origin_id;
|
$origin_id = $tmp_origin_id;
|
||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (!$ret)
|
if (!$ret)
|
||||||
{
|
{
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insertion du detail des produits dans la base
|
* Insertion du detail des produits dans la base
|
||||||
* Insert products detail in database
|
* Insert products detail in database
|
||||||
*/
|
*/
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
$num = count($this->lines);
|
$num = count($this->lines);
|
||||||
|
|
||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
if (!is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API
|
if (!is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API
|
||||||
{ // Convert into object this->lines[$i].
|
{ // Convert into object this->lines[$i].
|
||||||
$line = (object) $this->lines[$i];
|
$line = (object) $this->lines[$i];
|
||||||
} else {
|
} else {
|
||||||
$line = $this->lines[$i];
|
$line = $this->lines[$i];
|
||||||
}
|
}
|
||||||
// Reset fk_parent_line for line that are not child lines or special product
|
// Reset fk_parent_line for line that are not child lines or special product
|
||||||
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
|
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
}
|
}
|
||||||
// Complete vat rate with code
|
// Complete vat rate with code
|
||||||
$vatrate = $line->tva_tx;
|
$vatrate = $line->tva_tx;
|
||||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||||
|
|
||||||
@ -1273,7 +1273,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Insert into DB a proposal object completely defined by its data members (ex, results from copy).
|
* Insert into DB a proposal object completely defined by its data members (ex, results from copy).
|
||||||
*
|
*
|
||||||
@ -1281,9 +1281,9 @@ class Propal extends CommonObject
|
|||||||
* @return int Id of the new object if ok, <0 if ko
|
* @return int Id of the new object if ok, <0 if ko
|
||||||
* @see create()
|
* @see create()
|
||||||
*/
|
*/
|
||||||
public function create_from($user)
|
public function create_from($user)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
// i love this function because $this->products is not used in create function...
|
// i love this function because $this->products is not used in create function...
|
||||||
$this->products = $this->lines;
|
$this->products = $this->lines;
|
||||||
|
|
||||||
@ -1324,10 +1324,10 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($objsoc->fetch($socid) > 0)
|
if ($objsoc->fetch($socid) > 0)
|
||||||
{
|
{
|
||||||
$object->socid = $objsoc->id;
|
$object->socid = $objsoc->id;
|
||||||
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
$object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
|
||||||
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
$object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
|
||||||
$object->fk_delivery_address = '';
|
$object->fk_delivery_address = '';
|
||||||
|
|
||||||
/*if (!empty($conf->projet->enabled))
|
/*if (!empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
@ -1339,7 +1339,7 @@ class Propal extends CommonObject
|
|||||||
$clonedObj->fk_project = '';
|
$clonedObj->fk_project = '';
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
$object->fk_project = ''; // A cloned proposal is set by default to no project.
|
$object->fk_project = ''; // A cloned proposal is set by default to no project.
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset ref_client
|
// reset ref_client
|
||||||
@ -1347,7 +1347,7 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
// TODO Change product price if multi-prices
|
// TODO Change product price if multi-prices
|
||||||
} else {
|
} else {
|
||||||
$objsoc->fetch($object->socid);
|
$objsoc->fetch($object->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->id = 0;
|
$object->id = 0;
|
||||||
@ -1372,18 +1372,18 @@ class Propal extends CommonObject
|
|||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = array_merge($this->errors, $object->errors);
|
$this->errors = array_merge($this->errors, $object->errors);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// copy internal contacts
|
// copy internal contacts
|
||||||
if ($object->copy_linked_contact($this, 'internal') < 0)
|
if ($object->copy_linked_contact($this, 'internal') < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -1391,7 +1391,7 @@ class Propal extends CommonObject
|
|||||||
// copy external contacts if same company
|
// copy external contacts if same company
|
||||||
if ($this->socid == $object->socid)
|
if ($this->socid == $object->socid)
|
||||||
{
|
{
|
||||||
if ($object->copy_linked_contact($this, 'external') < 0)
|
if ($object->copy_linked_contact($this, 'external') < 0)
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1429,7 +1429,7 @@ class Propal extends CommonObject
|
|||||||
* @param string $ref_ext Ref ext of proposal
|
* @param string $ref_ext Ref ext of proposal
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function fetch($rowid, $ref = '', $ref_ext = '')
|
public function fetch($rowid, $ref = '', $ref_ext = '')
|
||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
||||||
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
|
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
|
||||||
@ -1595,7 +1595,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update(User $user, $notrigger = 0)
|
public function update(User $user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -1684,7 +1684,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Load array lines
|
* Load array lines
|
||||||
*
|
*
|
||||||
@ -1696,7 +1696,7 @@ class Propal extends CommonObject
|
|||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
||||||
@ -1790,11 +1790,11 @@ class Propal extends CommonObject
|
|||||||
$line->fetch_optionals();
|
$line->fetch_optionals();
|
||||||
|
|
||||||
// multilangs
|
// multilangs
|
||||||
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($objp->fk_product) && !empty($loadalsotranslation)) {
|
||||||
$line = new Product($this->db);
|
$line = new Product($this->db);
|
||||||
$line->fetch($objp->fk_product);
|
$line->fetch($objp->fk_product);
|
||||||
$line->getMultiLangs();
|
$line->getMultiLangs();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lines[$i] = $line;
|
$this->lines[$i] = $line;
|
||||||
//dol_syslog("1 ".$line->fk_product);
|
//dol_syslog("1 ".$line->fk_product);
|
||||||
@ -1818,7 +1818,7 @@ class Propal extends CommonObject
|
|||||||
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
|
||||||
* @return int <0 if KO, 0=Nothing done, >=0 if OK
|
* @return int <0 if KO, 0=Nothing done, >=0 if OK
|
||||||
*/
|
*/
|
||||||
public function valid($user, $notrigger = 0)
|
public function valid($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -1933,7 +1933,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Define proposal date
|
* Define proposal date
|
||||||
*
|
*
|
||||||
@ -1942,9 +1942,9 @@ class Propal extends CommonObject
|
|||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function set_date($user, $date, $notrigger = 0)
|
public function set_date($user, $date, $notrigger = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
if (empty($date))
|
if (empty($date))
|
||||||
{
|
{
|
||||||
$this->error = 'ErrorBadParameter';
|
$this->error = 'ErrorBadParameter';
|
||||||
@ -2000,7 +2000,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Define end validity date
|
* Define end validity date
|
||||||
*
|
*
|
||||||
@ -2009,9 +2009,9 @@ class Propal extends CommonObject
|
|||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function set_echeance($user, $date_fin_validite, $notrigger = 0)
|
public function set_echeance($user, $date_fin_validite, $notrigger = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
if (!empty($user->rights->propal->creer))
|
if (!empty($user->rights->propal->creer))
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -2134,7 +2134,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set delivery
|
* Set delivery
|
||||||
*
|
*
|
||||||
@ -2201,7 +2201,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set source of demand
|
* Set source of demand
|
||||||
*
|
*
|
||||||
@ -2270,7 +2270,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set customer reference number
|
* Set customer reference number
|
||||||
*
|
*
|
||||||
@ -2331,7 +2331,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set an overall discount on the proposal
|
* Set an overall discount on the proposal
|
||||||
*
|
*
|
||||||
@ -2396,7 +2396,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set an absolute overall discount on the proposal
|
* Set an absolute overall discount on the proposal
|
||||||
*
|
*
|
||||||
@ -2676,7 +2676,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Set draft status
|
* Set draft status
|
||||||
*
|
*
|
||||||
@ -2825,7 +2825,7 @@ class Propal extends CommonObject
|
|||||||
return $this->InvoiceArrayList($this->id);
|
return $this->InvoiceArrayList($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Returns an array with id and ref of related invoices
|
* Returns an array with id and ref of related invoices
|
||||||
*
|
*
|
||||||
@ -3091,7 +3091,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Change source demand
|
* Change source demand
|
||||||
*
|
*
|
||||||
@ -3446,7 +3446,7 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Charge indicateurs this->nb de tableau de bord
|
* Charge indicateurs this->nb de tableau de bord
|
||||||
*
|
*
|
||||||
@ -4260,7 +4260,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Update DB line fields total_xxx
|
* Update DB line fields total_xxx
|
||||||
* Used by migration
|
* Used by migration
|
||||||
|
|||||||
@ -242,7 +242,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||||
$selectedLines = GETPOST('toselect', 'array');
|
$selectedLines = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
if ($datecommande == '') {
|
if ($datecommande == '') {
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
|
||||||
@ -349,7 +349,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
|
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
|
||||||
|
|
||||||
$label = (!empty($lines[$i]->label) ? $lines[$i]->label : '');
|
$label = (!empty($lines[$i]->label) ? $lines[$i]->label : '');
|
||||||
$desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc : '');
|
$desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc : '');
|
||||||
@ -738,8 +738,8 @@ if (empty($reshook))
|
|||||||
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
|
||||||
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||||
{
|
{
|
||||||
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
|
||||||
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If price per customer
|
// If price per customer
|
||||||
@ -1284,82 +1284,82 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// add lines from objectlinked
|
// add lines from objectlinked
|
||||||
if ($action == 'import_lines_from_object'
|
if ($action == 'import_lines_from_object'
|
||||||
&& $usercancreate
|
&& $usercancreate
|
||||||
&& $object->statut == Commande::STATUS_DRAFT
|
&& $object->statut == Commande::STATUS_DRAFT
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$fromElement = GETPOST('fromelement');
|
$fromElement = GETPOST('fromelement');
|
||||||
$fromElementid = GETPOST('fromelementid');
|
$fromElementid = GETPOST('fromelementid');
|
||||||
$importLines = GETPOST('line_checkbox');
|
$importLines = GETPOST('line_checkbox');
|
||||||
|
|
||||||
if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
|
if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
|
||||||
{
|
{
|
||||||
if ($fromElement == 'commande')
|
if ($fromElement == 'commande')
|
||||||
{
|
{
|
||||||
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
||||||
$lineClassName = 'OrderLine';
|
$lineClassName = 'OrderLine';
|
||||||
} elseif ($fromElement == 'propal')
|
} elseif ($fromElement == 'propal')
|
||||||
{
|
{
|
||||||
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
|
||||||
$lineClassName = 'PropaleLigne';
|
$lineClassName = 'PropaleLigne';
|
||||||
}
|
}
|
||||||
$nextRang = count($object->lines) + 1;
|
$nextRang = count($object->lines) + 1;
|
||||||
$importCount = 0;
|
$importCount = 0;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($importLines as $lineId)
|
foreach ($importLines as $lineId)
|
||||||
{
|
{
|
||||||
$lineId = intval($lineId);
|
$lineId = intval($lineId);
|
||||||
$originLine = new $lineClassName($db);
|
$originLine = new $lineClassName($db);
|
||||||
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
|
if (intval($fromElementid) > 0 && $originLine->fetch($lineId) > 0)
|
||||||
{
|
{
|
||||||
$originLine->fetch_optionals();
|
$originLine->fetch_optionals();
|
||||||
$desc = $originLine->desc;
|
$desc = $originLine->desc;
|
||||||
$pu_ht = $originLine->subprice;
|
$pu_ht = $originLine->subprice;
|
||||||
$qty = $originLine->qty;
|
$qty = $originLine->qty;
|
||||||
$txtva = $originLine->tva_tx;
|
$txtva = $originLine->tva_tx;
|
||||||
$txlocaltax1 = $originLine->localtax1_tx;
|
$txlocaltax1 = $originLine->localtax1_tx;
|
||||||
$txlocaltax2 = $originLine->localtax2_tx;
|
$txlocaltax2 = $originLine->localtax2_tx;
|
||||||
$fk_product = $originLine->fk_product;
|
$fk_product = $originLine->fk_product;
|
||||||
$remise_percent = $originLine->remise_percent;
|
$remise_percent = $originLine->remise_percent;
|
||||||
$date_start = $originLine->date_start;
|
$date_start = $originLine->date_start;
|
||||||
$date_end = $originLine->date_end;
|
$date_end = $originLine->date_end;
|
||||||
$ventil = 0;
|
$ventil = 0;
|
||||||
$info_bits = $originLine->info_bits;
|
$info_bits = $originLine->info_bits;
|
||||||
$fk_remise_except = $originLine->fk_remise_except;
|
$fk_remise_except = $originLine->fk_remise_except;
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
$pu_ttc = 0;
|
$pu_ttc = 0;
|
||||||
$type = $originLine->product_type;
|
$type = $originLine->product_type;
|
||||||
$rang = $nextRang++;
|
$rang = $nextRang++;
|
||||||
$special_code = $originLine->special_code;
|
$special_code = $originLine->special_code;
|
||||||
$origin = $originLine->element;
|
$origin = $originLine->element;
|
||||||
$origin_id = $originLine->id;
|
$origin_id = $originLine->id;
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
$fk_fournprice = $originLine->fk_fournprice;
|
$fk_fournprice = $originLine->fk_fournprice;
|
||||||
$pa_ht = $originLine->pa_ht;
|
$pa_ht = $originLine->pa_ht;
|
||||||
$label = $originLine->label;
|
$label = $originLine->label;
|
||||||
$array_options = $originLine->array_options;
|
$array_options = $originLine->array_options;
|
||||||
$situation_percent = 100;
|
$situation_percent = 100;
|
||||||
$fk_prev_id = '';
|
$fk_prev_id = '';
|
||||||
$fk_unit = $originLine->fk_unit;
|
$fk_unit = $originLine->fk_unit;
|
||||||
$pu_ht_devise = $originLine->multicurrency_subprice;
|
$pu_ht_devise = $originLine->multicurrency_subprice;
|
||||||
|
|
||||||
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise);
|
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label, $array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise);
|
||||||
|
|
||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$importCount++;
|
$importCount++;
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('ErrorsOnXLines', $error), null, 'errors');
|
setEventMessages($langs->trans('ErrorsOnXLines', $error), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions when printing a doc from card
|
// Actions when printing a doc from card
|
||||||
@ -1849,7 +1849,7 @@ if ($action == 'create' && $usercancreate)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
} else {
|
} else {
|
||||||
// Mode view
|
// Mode view
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
@ -2635,9 +2635,9 @@ if ($action == 'create' && $usercancreate)
|
|||||||
|
|
||||||
$compatibleImportElementsList = false;
|
$compatibleImportElementsList = false;
|
||||||
if ($usercancreate
|
if ($usercancreate
|
||||||
&& $object->statut == Commande::STATUS_DRAFT)
|
&& $object->statut == Commande::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
$compatibleImportElementsList = array('commande', 'propal'); // import from linked elements
|
$compatibleImportElementsList = array('commande', 'propal'); // import from linked elements
|
||||||
}
|
}
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
||||||
|
|
||||||
|
|||||||
@ -31,166 +31,166 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
|||||||
class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
class box_supplier_orders_awaiting_reception extends ModeleBoxes
|
||||||
{
|
{
|
||||||
|
|
||||||
public $boxcode = "supplierordersawaitingreception";
|
public $boxcode = "supplierordersawaitingreception";
|
||||||
public $boximg = "object_order";
|
public $boximg = "object_order";
|
||||||
public $boxlabel = "BoxLatestSupplierOrdersAwaitingReception";
|
public $boxlabel = "BoxLatestSupplierOrdersAwaitingReception";
|
||||||
public $depends = array("fournisseur");
|
public $depends = array("fournisseur");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DoliDB Database handler.
|
* @var DoliDB Database handler.
|
||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
public $param;
|
public $param;
|
||||||
public $info_box_head = array();
|
public $info_box_head = array();
|
||||||
public $info_box_contents = array();
|
public $info_box_contents = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $param More parameters
|
* @param string $param More parameters
|
||||||
*/
|
*/
|
||||||
public function __construct($db, $param)
|
public function __construct($db, $param)
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->hidden = !($user->rights->fournisseur->commande->lire);
|
$this->hidden = !($user->rights->fournisseur->commande->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load data into info_box_contents array to show array later.
|
* Load data into info_box_contents array to show array later.
|
||||||
*
|
*
|
||||||
* @param int $max Maximum number of records to load
|
* @param int $max Maximum number of records to load
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function loadBox($max = 5)
|
public function loadBox($max = 5)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
global $conf, $user, $langs;
|
||||||
$langs->loadLangs(array("boxes", "sendings", "orders"));
|
$langs->loadLangs(array("boxes", "sendings", "orders"));
|
||||||
|
|
||||||
$this->max = $max;
|
$this->max = $max;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||||
$supplierorderstatic = new CommandeFournisseur($this->db);
|
$supplierorderstatic = new CommandeFournisseur($this->db);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||||
$thirdpartytmp = new Fournisseur($this->db);
|
$thirdpartytmp = new Fournisseur($this->db);
|
||||||
|
|
||||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleSupplierOrdersAwaitingReception", $max));
|
$this->info_box_head = array('text' => $langs->trans("BoxTitleSupplierOrdersAwaitingReception", $max));
|
||||||
|
|
||||||
if ($user->rights->fournisseur->commande->lire)
|
if ($user->rights->fournisseur->commande->lire)
|
||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||||
$sql .= " s.code_client, s.code_fournisseur, s.email,";
|
$sql .= " s.code_client, s.code_fournisseur, s.email,";
|
||||||
$sql .= " s.logo,";
|
$sql .= " s.logo,";
|
||||||
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
|
$sql .= " c.rowid, c.ref, c.tms, c.date_commande, c.date_livraison, ";
|
||||||
$sql .= " c.total_ht,";
|
$sql .= " c.total_ht,";
|
||||||
$sql .= " c.tva as total_tva,";
|
$sql .= " c.tva as total_tva,";
|
||||||
$sql .= " c.total_ttc,";
|
$sql .= " c.total_ttc,";
|
||||||
$sql .= " c.fk_statut";
|
$sql .= " c.fk_statut";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||||
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
|
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
|
||||||
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
|
$sql .= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||||
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
|
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY c.date_commande DESC, c.ref DESC ";
|
||||||
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC ";
|
else $sql .= " ORDER BY c.date_livraison ASC, c.fk_statut ASC ";
|
||||||
$sql .= $this->db->plimit($max, 0);
|
$sql .= $this->db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
|
|
||||||
$line = 0;
|
$line = 0;
|
||||||
while ($line < $num) {
|
while ($line < $num) {
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
$date = $this->db->jdate($objp->date_commande);
|
$date = $this->db->jdate($objp->date_commande);
|
||||||
$delivery_date = $this->db->jdate($objp->date_livraison);
|
$delivery_date = $this->db->jdate($objp->date_livraison);
|
||||||
$datem = $this->db->jdate($objp->tms);
|
$datem = $this->db->jdate($objp->tms);
|
||||||
|
|
||||||
$supplierorderstatic->date_livraison = $delivery_date;
|
$supplierorderstatic->date_livraison = $delivery_date;
|
||||||
$supplierorderstatic->statut = $objp->fk_statut;
|
$supplierorderstatic->statut = $objp->fk_statut;
|
||||||
|
|
||||||
$supplierorderstatic->id = $objp->rowid;
|
$supplierorderstatic->id = $objp->rowid;
|
||||||
$supplierorderstatic->ref = $objp->ref;
|
$supplierorderstatic->ref = $objp->ref;
|
||||||
|
|
||||||
$thirdpartytmp->id = $objp->socid;
|
$thirdpartytmp->id = $objp->socid;
|
||||||
$thirdpartytmp->name = $objp->name;
|
$thirdpartytmp->name = $objp->name;
|
||||||
$thirdpartytmp->email = $objp->email;
|
$thirdpartytmp->email = $objp->email;
|
||||||
$thirdpartytmp->fournisseur = 1;
|
$thirdpartytmp->fournisseur = 1;
|
||||||
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
|
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
|
||||||
$thirdpartytmp->logo = $objp->logo;
|
$thirdpartytmp->logo = $objp->logo;
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => 'class="nowraponall"',
|
'td' => 'class="nowraponall"',
|
||||||
'text' => $supplierorderstatic->getNomUrl(1),
|
'text' => $supplierorderstatic->getNomUrl(1),
|
||||||
'asis' => 1
|
'asis' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"',
|
||||||
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
|
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
|
||||||
'asis' => 1,
|
'asis' => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => 'class="right nowraponall"',
|
'td' => 'class="right nowraponall"',
|
||||||
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
|
||||||
);
|
);
|
||||||
|
|
||||||
$delayIcon = '';
|
$delayIcon = '';
|
||||||
if ($supplierorderstatic->hasDelay()) {
|
if ($supplierorderstatic->hasDelay()) {
|
||||||
$delayIcon = img_warning($langs->trans("Late"));
|
$delayIcon = img_warning($langs->trans("Late"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => 'class="right"',
|
'td' => 'class="right"',
|
||||||
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-dolly" ></i> '.dol_print_date($delivery_date, 'day').'</span>',
|
'text' => $delayIcon.'<span class="classfortooltip" title="'.$langs->trans('DateDeliveryPlanned').'"><i class="fa fa-dolly" ></i> '.dol_print_date($delivery_date, 'day').'</span>',
|
||||||
'asis' => 1
|
'asis' => 1
|
||||||
);
|
);
|
||||||
|
|
||||||
$line++;
|
$line++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
$this->info_box_contents[$line][] = array(
|
$this->info_box_contents[$line][] = array(
|
||||||
'td' => 'class="center"',
|
'td' => 'class="center"',
|
||||||
'text' => $langs->trans("NoSupplierOrder"),
|
'text' => $langs->trans("NoSupplierOrder"),
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
} else {
|
} else {
|
||||||
$this->info_box_contents[0][] = array(
|
$this->info_box_contents[0][] = array(
|
||||||
'td' => '',
|
'td' => '',
|
||||||
'maxlength'=>500,
|
'maxlength'=>500,
|
||||||
'text' => ($this->db->error().' sql='.$sql),
|
'text' => ($this->db->error().' sql='.$sql),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->info_box_contents[0][] = array(
|
$this->info_box_contents[0][] = array(
|
||||||
'td' => 'class="nohover opacitymedium left"',
|
'td' => 'class="nohover opacitymedium left"',
|
||||||
'text' => $langs->trans("ReadPermissionNotAllowed")
|
'text' => $langs->trans("ReadPermissionNotAllowed")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to show box
|
* Method to show box
|
||||||
*
|
*
|
||||||
* @param array $head Array with properties of box title
|
* @param array $head Array with properties of box title
|
||||||
* @param array $contents Array with properties of box lines
|
* @param array $contents Array with properties of box lines
|
||||||
* @param int $nooutput No print, only return string
|
* @param int $nooutput No print, only return string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function showBox($head = null, $contents = null, $nooutput = 0)
|
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||||
{
|
{
|
||||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -296,11 +296,11 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public $cond_reglement_id;
|
public $cond_reglement_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Transport mode ID (For module intracomm report)
|
* @var int Transport mode ID (For module intracomm report)
|
||||||
* @see setTransportMode()
|
* @see setTransportMode()
|
||||||
*/
|
*/
|
||||||
public $transport_mode_id;
|
public $transport_mode_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Payment terms ID
|
* @var int Payment terms ID
|
||||||
@ -2196,42 +2196,42 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the transport mode methods
|
* Change the transport mode methods
|
||||||
*
|
*
|
||||||
* @param int $id Id of new payment method
|
* @param int $id Id of new payment method
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function setTransportMode($id)
|
public function setTransportMode($id)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this).'::setTransportMode('.$id.')');
|
dol_syslog(get_class($this).'::setTransportMode('.$id.')');
|
||||||
if ($this->statut >= 0 || $this->element == 'societe')
|
if ($this->statut >= 0 || $this->element == 'societe')
|
||||||
{
|
{
|
||||||
$fieldname = 'fk_transport_mode';
|
$fieldname = 'fk_transport_mode';
|
||||||
if ($this->element == 'societe') $fieldname = 'transport_mode';
|
if ($this->element == 'societe') $fieldname = 'transport_mode';
|
||||||
if (get_class($this) == 'Fournisseur') $fieldname = 'transport_mode_supplier';
|
if (get_class($this) == 'Fournisseur') $fieldname = 'transport_mode_supplier';
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
|
$sql .= ' SET '.$fieldname.' = '.(($id > 0 || $id == '0') ? $id : 'NULL');
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
$this->transport_mode_id = $id;
|
$this->transport_mode_id = $id;
|
||||||
// for supplier
|
// for supplier
|
||||||
if (get_class($this) == 'Fournisseur') $this->transport_mode_supplier_id = $id;
|
if (get_class($this) == 'Fournisseur') $this->transport_mode_supplier_id = $id;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
dol_syslog(get_class($this).'::setTransportMode Error '.$sql.' - '.$this->db->error());
|
dol_syslog(get_class($this).'::setTransportMode Error '.$sql.' - '.$this->db->error());
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_syslog(get_class($this).'::setTransportMode, status of the object is incompatible');
|
dol_syslog(get_class($this).'::setTransportMode, status of the object is incompatible');
|
||||||
$this->error='Status of the object is incompatible '.$this->statut;
|
$this->error='Status of the object is incompatible '.$this->statut;
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the retained warranty payments terms
|
* Change the retained warranty payments terms
|
||||||
@ -2785,8 +2785,8 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
public function line_max($fk_parent_line = 0)
|
public function line_max($fk_parent_line = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$positionfield = 'rang';
|
$positionfield = 'rang';
|
||||||
if ($this->table_element == 'bom_bom') $positionfield = 'position';
|
if ($this->table_element == 'bom_bom') $positionfield = 'position';
|
||||||
|
|
||||||
// Search the last rang with fk_parent_line
|
// Search the last rang with fk_parent_line
|
||||||
|
|||||||
@ -43,7 +43,7 @@ function propal_prepare_head($object)
|
|||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire)
|
if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire)
|
||||||
|| (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire))))
|
|| (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire))))
|
||||||
{
|
{
|
||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
$text = '';
|
$text = '';
|
||||||
@ -57,7 +57,7 @@ function propal_prepare_head($object)
|
|||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||||
{
|
{
|
||||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||||
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||||
@ -65,29 +65,29 @@ function propal_prepare_head($object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'propal');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'propal');
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
{
|
{
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
if (!empty($object->note_private)) $nbNote++;
|
if (!empty($object->note_private)) $nbNote++;
|
||||||
if (!empty($object->note_public)) $nbNote++;
|
if (!empty($object->note_public)) $nbNote++;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Notes');
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||||
$head[$h][2] = 'note';
|
$head[$h][2] = 'note';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||||
@ -129,13 +129,13 @@ function propal_admin_prepare_head()
|
|||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFields");
|
$head[$h][1] = $langs->trans("ExtraFields");
|
||||||
$head[$h][2] = 'attributes';
|
$head[$h][2] = 'attributes';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
|
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php';
|
||||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||||
$head[$h][2] = 'attributeslines';
|
$head[$h][2] = 'attributeslines';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'propal_admin', 'remove');
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'propal_admin', 'remove');
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ function shipping_prepare_head($object)
|
|||||||
global $db, $langs, $conf, $user;
|
global $db, $langs, $conf, $user;
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("sendings", "deliveries"));
|
$langs->loadLangs(array("sendings", "deliveries"));
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
@ -53,8 +53,8 @@ function shipping_prepare_head($object)
|
|||||||
$object->fetchObjectLinked($object->id, $object->element);
|
$object->fetchObjectLinked($object->id, $object->element);
|
||||||
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
|
if (is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery
|
||||||
{
|
{
|
||||||
// Take first one element of array
|
// Take first one element of array
|
||||||
$tmp = reset($object->linkedObjectsIds['delivery']);
|
$tmp = reset($object->linkedObjectsIds['delivery']);
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".$tmp;
|
$head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".$tmp;
|
||||||
$head[$h][1] = $langs->trans("DeliveryCard");
|
$head[$h][1] = $langs->trans("DeliveryCard");
|
||||||
@ -65,34 +65,34 @@ function shipping_prepare_head($object)
|
|||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||||
{
|
{
|
||||||
$objectsrc = $object;
|
$objectsrc = $object;
|
||||||
if ($object->origin == 'commande' && $object->origin_id > 0)
|
if ($object->origin == 'commande' && $object->origin_id > 0)
|
||||||
{
|
{
|
||||||
$objectsrc = new Commande($db);
|
$objectsrc = new Commande($db);
|
||||||
$objectsrc->fetch($object->origin_id);
|
$objectsrc->fetch($object->origin_id);
|
||||||
}
|
}
|
||||||
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
|
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
|
||||||
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||||
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||||
$head[$h][2] = 'contact';
|
$head[$h][2] = 'contact';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||||
$upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;
|
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||||
$head[$h][2] = 'documents';
|
$head[$h][2] = 'documents';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
$nbNote = 0;
|
$nbNote = 0;
|
||||||
if (!empty($object->note_private)) $nbNote++;
|
if (!empty($object->note_private)) $nbNote++;
|
||||||
if (!empty($object->note_public)) $nbNote++;
|
if (!empty($object->note_public)) $nbNote++;
|
||||||
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("Notes");
|
$head[$h][1] = $langs->trans("Notes");
|
||||||
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||||
@ -101,8 +101,8 @@ function shipping_prepare_head($object)
|
|||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
|
||||||
@ -122,7 +122,7 @@ function delivery_prepare_head($object)
|
|||||||
global $langs, $db, $conf, $user;
|
global $langs, $db, $conf, $user;
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("sendings", "deliveries"));
|
$langs->loadLangs(array("sendings", "deliveries"));
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
@ -195,7 +195,7 @@ function delivery_prepare_head($object)
|
|||||||
|
|
||||||
$object->id = $tmpobject->id;
|
$object->id = $tmpobject->id;
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
|
||||||
|
|
||||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
|
|||||||
print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>';
|
print '<td class="center">'.$langs->trans("QtyPreparedOrShipped").'</td>';
|
||||||
if (!empty($conf->stock->enabled))
|
if (!empty($conf->stock->enabled))
|
||||||
{
|
{
|
||||||
print '<td>'.$langs->trans("Warehouse").'</td>';
|
print '<td>'.$langs->trans("Warehouse").'</td>';
|
||||||
}
|
}
|
||||||
/*TODO Add link to expeditiondet_batch
|
/*TODO Add link to expeditiondet_batch
|
||||||
if (! empty($conf->productbatch->enabled))
|
if (! empty($conf->productbatch->enabled))
|
||||||
@ -371,13 +371,13 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
|
|||||||
// Warehouse
|
// Warehouse
|
||||||
if (!empty($conf->stock->enabled))
|
if (!empty($conf->stock->enabled))
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->warehouse_id > 0)
|
if ($objp->warehouse_id > 0)
|
||||||
{
|
{
|
||||||
$warehousestatic->fetch($objp->warehouse_id);
|
$warehousestatic->fetch($objp->warehouse_id);
|
||||||
print $warehousestatic->getNomUrl(1);
|
print $warehousestatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Batch number managment
|
// Batch number managment
|
||||||
|
|||||||
@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php';
|
|||||||
class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Dolibarr version of the loaded document
|
* Dolibarr version of the loaded document
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,14 +55,14 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
|||||||
public $name = 'Saphir';
|
public $name = 'Saphir';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the description of the numbering model
|
* Returns the description of the numbering model
|
||||||
*
|
*
|
||||||
* @return string Texte descripif
|
* @return string Texte descripif
|
||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
global $conf, $langs, $db;
|
global $conf, $langs, $db;
|
||||||
|
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
|
|
||||||
@ -93,28 +93,28 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
|||||||
$texte .= '</form>';
|
$texte .= '</form>';
|
||||||
|
|
||||||
return $texte;
|
return $texte;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an example of number
|
* Return an example of number
|
||||||
*
|
*
|
||||||
* @return string Example
|
* @return string Example
|
||||||
*/
|
*/
|
||||||
public function getExample()
|
public function getExample()
|
||||||
{
|
{
|
||||||
global $conf, $langs, $mysoc;
|
global $conf, $langs, $mysoc;
|
||||||
|
|
||||||
$old_code_client = $mysoc->code_client;
|
$old_code_client = $mysoc->code_client;
|
||||||
$mysoc->code_client = 'CCCCCCCCCC';
|
$mysoc->code_client = 'CCCCCCCCCC';
|
||||||
$numExample = $this->getNextValue($mysoc, '');
|
$numExample = $this->getNextValue($mysoc, '');
|
||||||
$mysoc->code_client = $old_code_client;
|
$mysoc->code_client = $old_code_client;
|
||||||
|
|
||||||
if (!$numExample)
|
if (!$numExample)
|
||||||
{
|
{
|
||||||
$numExample = $langs->trans('NotConfigured');
|
$numExample = $langs->trans('NotConfigured');
|
||||||
}
|
}
|
||||||
return $numExample;
|
return $numExample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,8 +124,8 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
|||||||
* @param Object $object Object delivery
|
* @param Object $object Object delivery
|
||||||
* @return string Value if OK, 0 if KO
|
* @return string Value if OK, 0 if KO
|
||||||
*/
|
*/
|
||||||
public function getNextValue($objsoc, $object)
|
public function getNextValue($objsoc, $object)
|
||||||
{
|
{
|
||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
@ -142,33 +142,33 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
|
|||||||
$numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison);
|
$numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison);
|
||||||
|
|
||||||
return $numFinal;
|
return $numFinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return next free value
|
* Return next free value
|
||||||
*
|
*
|
||||||
* @param Societe $objsoc Object third party
|
* @param Societe $objsoc Object third party
|
||||||
* @param string $objforref Object for number to search
|
* @param string $objforref Object for number to search
|
||||||
* @return string Next free value
|
* @return string Next free value
|
||||||
*/
|
*/
|
||||||
public function getNumRef($objsoc, $objforref)
|
public function getNumRef($objsoc, $objforref)
|
||||||
{
|
{
|
||||||
return $this->getNextValue($objsoc, $objforref);
|
return $this->getNextValue($objsoc, $objforref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Return next free ref
|
* Return next free ref
|
||||||
*
|
*
|
||||||
* @param Societe $objsoc Object thirdparty
|
* @param Societe $objsoc Object thirdparty
|
||||||
* @param Object $object Objet livraison
|
* @param Object $object Objet livraison
|
||||||
* @return string Texte descripif
|
* @return string Texte descripif
|
||||||
*/
|
*/
|
||||||
public function delivery_get_num($objsoc = 0, $object = '')
|
public function delivery_get_num($objsoc = 0, $object = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
return $this->getNextValue($objsoc, $object);
|
return $this->getNextValue($objsoc, $object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,8 +41,8 @@ if (!empty($conf->expedition_bon->enabled))
|
|||||||
if (!empty($conf->stock->enabled))
|
if (!empty($conf->stock->enabled))
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
if (!empty($conf->projet->enabled)) {
|
if (!empty($conf->projet->enabled)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -126,8 +126,8 @@ if ($action == 'add')
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
} elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
|
} elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|
||||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
|
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
@ -310,13 +310,13 @@ if ($action == 'create') // Create. Seems to no be used
|
|||||||
|
|
||||||
if ($typeobject == 'commande' && $expedition->origin_id > 0 && !empty($conf->commande->enabled))
|
if ($typeobject == 'commande' && $expedition->origin_id > 0 && !empty($conf->commande->enabled))
|
||||||
{
|
{
|
||||||
$objectsrc = new Commande($db);
|
$objectsrc = new Commande($db);
|
||||||
$objectsrc->fetch($expedition->origin_id);
|
$objectsrc->fetch($expedition->origin_id);
|
||||||
}
|
}
|
||||||
if ($typeobject == 'propal' && $expedition->origin_id > 0 && !empty($conf->propal->enabled))
|
if ($typeobject == 'propal' && $expedition->origin_id > 0 && !empty($conf->propal->enabled))
|
||||||
{
|
{
|
||||||
$objectsrc = new Propal($db);
|
$objectsrc = new Propal($db);
|
||||||
$objectsrc->fetch($expedition->origin_id);
|
$objectsrc->fetch($expedition->origin_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shipment card
|
// Shipment card
|
||||||
@ -331,35 +331,35 @@ if ($action == 'create') // Create. Seems to no be used
|
|||||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$expedition->thirdparty->getNomUrl(1);
|
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$expedition->thirdparty->getNomUrl(1);
|
||||||
// Project
|
// Project
|
||||||
if (!empty($conf->projet->enabled)) {
|
if (!empty($conf->projet->enabled)) {
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||||
if (0) { // Do not change on shipment
|
if (0) { // Do not change on shipment
|
||||||
if ($action != 'classify') {
|
if ($action != 'classify') {
|
||||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$expedition->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$expedition->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||||
}
|
}
|
||||||
if ($action == 'classify') {
|
if ($action == 'classify') {
|
||||||
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1);
|
// $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $expedition->id, $expedition->socid, $expedition->fk_project, 'projectid', 0, 0, 1, 1);
|
||||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$expedition->id.'">';
|
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$expedition->id.'">';
|
||||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
$morehtmlref .= $formproject->select_projects($expedition->socid, $expedition->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$morehtmlref .= $formproject->select_projects($expedition->socid, $expedition->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||||
$morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
$morehtmlref .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref .= '</form>';
|
$morehtmlref .= '</form>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1);
|
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$expedition->id, $expedition->socid, $expedition->fk_project, 'none', 0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref .= ' : ';
|
$morehtmlref .= ' : ';
|
||||||
if (!empty($objectsrc->fk_project)) {
|
if (!empty($objectsrc->fk_project)) {
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
$proj->fetch($objectsrc->fk_project);
|
$proj->fetch($objectsrc->fk_project);
|
||||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$objectsrc->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||||
$morehtmlref .= $proj->ref;
|
$morehtmlref .= $proj->ref;
|
||||||
$morehtmlref .= '</a>';
|
$morehtmlref .= '</a>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref .= '';
|
$morehtmlref .= '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ if ($action == 'create') // Create. Seems to no be used
|
|||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Shipment
|
// Shipment
|
||||||
/*
|
/*
|
||||||
@ -454,21 +454,21 @@ if ($action == 'create') // Create. Seems to no be used
|
|||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
print $langs->trans('IncotermLabel');
|
||||||
print '<td><td class="right">';
|
print '<td><td class="right">';
|
||||||
if ($user->rights->expedition->delivery->creer) print '<a class="editfielda" href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
if ($user->rights->expedition->delivery->creer) print '<a class="editfielda" href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($action != 'editincoterm')
|
if ($action != 'editincoterm')
|
||||||
{
|
{
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
|
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
|
||||||
} else {
|
} else {
|
||||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A delivery note should be just more properties of a shipment, so notes are on shipment
|
/* A delivery note should be just more properties of a shipment, so notes are on shipment
|
||||||
@ -690,9 +690,9 @@ if ($action == 'create') // Create. Seems to no be used
|
|||||||
$shipment = new Expedition($db);
|
$shipment = new Expedition($db);
|
||||||
$shipment->fetch($object->origin_id);
|
$shipment->fetch($object->origin_id);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -88,8 +88,8 @@ class Delivery extends CommonObject
|
|||||||
public $date_delivery;
|
public $date_delivery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string date_creation
|
* @var integer|string date_creation
|
||||||
*/
|
*/
|
||||||
public $date_creation;
|
public $date_creation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +108,7 @@ class Delivery extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
@ -126,7 +126,7 @@ class Delivery extends CommonObject
|
|||||||
* @param User $user Objet du user qui cree
|
* @param User $user Objet du user qui cree
|
||||||
* @return int <0 si erreur, id delivery cree si ok
|
* @return int <0 si erreur, id delivery cree si ok
|
||||||
*/
|
*/
|
||||||
public function create($user)
|
public function create($user)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ class Delivery extends CommonObject
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
/* Delivery note as draft On positionne en mode draft le bon de livraison */
|
/* Delivery note as draft On positionne en mode draft le bon de livraison */
|
||||||
$this->draft = 1;
|
$this->draft = 1;
|
||||||
@ -170,8 +170,8 @@ class Delivery extends CommonObject
|
|||||||
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
|
$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||||
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
|
$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||||
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
|
$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
|
||||||
$sql .= ", ".(int) $this->fk_incoterms;
|
$sql .= ", ".(int) $this->fk_incoterms;
|
||||||
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
|
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|
||||||
dol_syslog("Delivery::create", LOG_DEBUG);
|
dol_syslog("Delivery::create", LOG_DEBUG);
|
||||||
@ -256,7 +256,7 @@ class Delivery extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Create a line
|
* Create a line
|
||||||
*
|
*
|
||||||
@ -266,9 +266,9 @@ class Delivery extends CommonObject
|
|||||||
* @param string $description Description
|
* @param string $description Description
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function create_line($origin_id, $qty, $fk_product, $description)
|
public function create_line($origin_id, $qty, $fk_product, $description)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$idprod = $fk_product;
|
$idprod = $fk_product;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
@ -298,7 +298,7 @@ class Delivery extends CommonObject
|
|||||||
* @param int $id Id of object to load
|
* @param int $id Id of object to load
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function fetch($id)
|
public function fetch($id)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -306,8 +306,8 @@ class Delivery extends CommonObject
|
|||||||
$sql .= " l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public";
|
$sql .= " l.total_ht, l.fk_statut, l.fk_user_valid, l.note_private, l.note_public";
|
||||||
$sql .= ", l.date_delivery, l.fk_address, l.model_pdf";
|
$sql .= ", l.date_delivery, l.fk_address, l.model_pdf";
|
||||||
$sql .= ", el.fk_source as origin_id, el.sourcetype as origin";
|
$sql .= ", el.fk_source as origin_id, el.sourcetype as origin";
|
||||||
$sql .= ', l.fk_incoterms, l.location_incoterms';
|
$sql .= ', l.fk_incoterms, l.location_incoterms';
|
||||||
$sql .= ", i.libelle as label_incoterms";
|
$sql .= ", i.libelle as label_incoterms";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."delivery as l";
|
$sql .= " FROM ".MAIN_DB_PREFIX."delivery as l";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->db->escape($this->element)."'";
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON l.fk_incoterms = i.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON l.fk_incoterms = i.rowid';
|
||||||
@ -374,14 +374,14 @@ class Delivery extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Validate object and update stock if option enabled
|
* Validate object and update stock if option enabled
|
||||||
*
|
*
|
||||||
* @param User $user Object user that validate
|
* @param User $user Object user that validate
|
||||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function valid($user, $notrigger = 0)
|
public function valid($user, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::valid begin");
|
dol_syslog(get_class($this)."::valid begin");
|
||||||
|
|
||||||
@ -389,8 +389,8 @@ class Delivery extends CommonObject
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|
||||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
|
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate)))
|
||||||
{
|
{
|
||||||
if (!empty($conf->global->DELIVERY_ADDON_NUMBER))
|
if (!empty($conf->global->DELIVERY_ADDON_NUMBER))
|
||||||
{
|
{
|
||||||
@ -409,12 +409,12 @@ class Delivery extends CommonObject
|
|||||||
$soc->fetch($this->socid);
|
$soc->fetch($this->socid);
|
||||||
|
|
||||||
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
|
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
|
||||||
{
|
{
|
||||||
$numref = $objMod->delivery_get_num($soc, $this);
|
$numref = $objMod->delivery_get_num($soc, $this);
|
||||||
} else {
|
} else {
|
||||||
$numref = $this->ref;
|
$numref = $this->ref;
|
||||||
}
|
}
|
||||||
$this->newref = dol_sanitizeFileName($numref);
|
$this->newref = dol_sanitizeFileName($numref);
|
||||||
|
|
||||||
// Test if is not already in valid status. If so, we stop to avoid decrementing the stock twice.
|
// Test if is not already in valid status. If so, we stop to avoid decrementing the stock twice.
|
||||||
$sql = "SELECT ref";
|
$sql = "SELECT ref";
|
||||||
@ -442,24 +442,24 @@ class Delivery extends CommonObject
|
|||||||
$sql .= " AND fk_statut = 0";
|
$sql .= " AND fk_statut = 0";
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger)
|
if (!$error && !$notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('DELIVERY_VALIDATE', $user);
|
$result = $this->call_trigger('DELIVERY_VALIDATE', $user);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->oldref = $this->ref;
|
$this->oldref = $this->ref;
|
||||||
|
|
||||||
// Rename directory if dir was a temporary ref
|
// Rename directory if dir was a temporary ref
|
||||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||||
@ -481,17 +481,17 @@ class Delivery extends CommonObject
|
|||||||
|
|
||||||
if (@rename($dirsource, $dirdest))
|
if (@rename($dirsource, $dirdest))
|
||||||
{
|
{
|
||||||
dol_syslog("Rename ok");
|
dol_syslog("Rename ok");
|
||||||
// Rename docs starting with $oldref with $newref
|
// Rename docs starting with $oldref with $newref
|
||||||
$listoffiles = dol_dir_list($conf->expedition->dir_output.'/receipt/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
$listoffiles = dol_dir_list($conf->expedition->dir_output.'/receipt/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||||
foreach ($listoffiles as $fileentry)
|
foreach ($listoffiles as $fileentry)
|
||||||
{
|
{
|
||||||
$dirsource = $fileentry['name'];
|
$dirsource = $fileentry['name'];
|
||||||
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
|
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
|
||||||
$dirsource = $fileentry['path'].'/'.$dirsource;
|
$dirsource = $fileentry['path'].'/'.$dirsource;
|
||||||
$dirdest = $fileentry['path'].'/'.$dirdest;
|
$dirdest = $fileentry['path'].'/'.$dirdest;
|
||||||
@rename($dirsource, $dirdest);
|
@rename($dirsource, $dirdest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -506,14 +506,14 @@ class Delivery extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::valid ok");
|
dol_syslog(get_class($this)."::valid ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -523,7 +523,7 @@ class Delivery extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Creating the delivery slip from an existing shipment
|
* Creating the delivery slip from an existing shipment
|
||||||
*
|
*
|
||||||
@ -531,9 +531,9 @@ class Delivery extends CommonObject
|
|||||||
* @param int $sending_id Id of the expedition that serves as a model
|
* @param int $sending_id Id of the expedition that serves as a model
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function create_from_sending($user, $sending_id)
|
public function create_from_sending($user, $sending_id)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$expedition = new Expedition($this->db);
|
$expedition = new Expedition($this->db);
|
||||||
$result = $expedition->fetch($sending_id);
|
$result = $expedition->fetch($sending_id);
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ class Delivery extends CommonObject
|
|||||||
return $this->create($user);
|
return $this->create($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Update a livraison line (only extrafields)
|
* Update a livraison line (only extrafields)
|
||||||
*
|
*
|
||||||
@ -577,9 +577,9 @@ class Delivery extends CommonObject
|
|||||||
* @param array $array_options extrafields array
|
* @param array $array_options extrafields array
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update_line($id, $array_options = 0)
|
public function update_line($id, $array_options = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -609,7 +609,7 @@ class Delivery extends CommonObject
|
|||||||
* @param int $qty Qty
|
* @param int $qty Qty
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addline($origin_id, $qty)
|
public function addline($origin_id, $qty)
|
||||||
{
|
{
|
||||||
$num = count($this->lines);
|
$num = count($this->lines);
|
||||||
$line = new DeliveryLine($this->db);
|
$line = new DeliveryLine($this->db);
|
||||||
@ -626,7 +626,7 @@ class Delivery extends CommonObject
|
|||||||
* @param int $lineid Line id
|
* @param int $lineid Line id
|
||||||
* @return integer|null
|
* @return integer|null
|
||||||
*/
|
*/
|
||||||
public function deleteline($lineid)
|
public function deleteline($lineid)
|
||||||
{
|
{
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
{
|
{
|
||||||
@ -649,11 +649,11 @@ class Delivery extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -697,14 +697,14 @@ class Delivery extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('DELIVERY_DELETE', $user);
|
$result = $this->call_trigger('DELIVERY_DELETE', $user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@ -728,10 +728,10 @@ class Delivery extends CommonObject
|
|||||||
* Return clicable name (with picto eventually)
|
* Return clicable name (with picto eventually)
|
||||||
*
|
*
|
||||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
|
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -742,16 +742,16 @@ class Delivery extends CommonObject
|
|||||||
|
|
||||||
$url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id;
|
||||||
|
|
||||||
//if ($option !== 'nolink')
|
//if ($option !== 'nolink')
|
||||||
//{
|
//{
|
||||||
// Add param to save lastsearch_values or not
|
// Add param to save lastsearch_values or not
|
||||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
$linkstart = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||||
$linkend = '</a>';
|
$linkend = '</a>';
|
||||||
|
|
||||||
if ($withpicto) $result .= ($linkstart.img_object($label, $this->picto, 'class="classfortooltip"').$linkend);
|
if ($withpicto) $result .= ($linkstart.img_object($label, $this->picto, 'class="classfortooltip"').$linkend);
|
||||||
@ -760,15 +760,15 @@ class Delivery extends CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Load lines
|
* Load lines
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function fetch_lines()
|
public function fetch_lines()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, ";
|
$sql = "SELECT ld.rowid, ld.fk_product, ld.description, ld.subprice, ld.total_ht, ld.qty as qty_shipped, ld.fk_origin_line, ";
|
||||||
@ -844,12 +844,12 @@ class Delivery extends CommonObject
|
|||||||
* @param int $mode Mode
|
* @param int $mode Mode
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function getLibStatut($mode = 0)
|
public function getLibStatut($mode = 0)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut, $mode);
|
return $this->LibStatut($this->statut, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Renvoi le libelle d'un statut donne
|
* Renvoi le libelle d'un statut donne
|
||||||
*
|
*
|
||||||
@ -857,9 +857,9 @@ class Delivery extends CommonObject
|
|||||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
|
||||||
* @return string Label
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
public function LibStatut($status, $mode)
|
public function LibStatut($status, $mode)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
if (empty($this->labelStatus) || empty($this->labelStatusShort))
|
||||||
@ -883,19 +883,19 @@ class Delivery extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise an instance with random values.
|
* Initialise an instance with random values.
|
||||||
* Used to build previews or test instances.
|
* Used to build previews or test instances.
|
||||||
* id must be 0 if object instance is a specimen.
|
* id must be 0 if object instance is a specimen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initAsSpecimen()
|
public function initAsSpecimen()
|
||||||
{
|
{
|
||||||
global $user, $langs, $conf;
|
global $user, $langs, $conf;
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
// Load array of products prodids
|
// Load array of products prodids
|
||||||
$num_prods = 0;
|
$num_prods = 0;
|
||||||
$prodids = array();
|
$prodids = array();
|
||||||
$sql = "SELECT rowid";
|
$sql = "SELECT rowid";
|
||||||
@ -946,7 +946,7 @@ class Delivery extends CommonObject
|
|||||||
* @return array Product remaining to be delivered
|
* @return array Product remaining to be delivered
|
||||||
* TODO use new function
|
* TODO use new function
|
||||||
*/
|
*/
|
||||||
public function getRemainingDelivered()
|
public function getRemainingDelivered()
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -1148,13 +1148,13 @@ class DeliveryLine extends CommonObjectLine
|
|||||||
public $product_ref;
|
public $product_ref;
|
||||||
public $product_label;
|
public $product_label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -159,8 +159,8 @@ class Expedition extends CommonObject
|
|||||||
public $date_shipping;
|
public $date_shipping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer|string date_creation
|
* @var integer|string date_creation
|
||||||
*/
|
*/
|
||||||
public $date_creation;
|
public $date_creation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,7 +171,7 @@ class Expedition extends CommonObject
|
|||||||
public $meths;
|
public $meths;
|
||||||
public $listmeths; // List of carriers
|
public $listmeths; // List of carriers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draft status
|
* Draft status
|
||||||
*/
|
*/
|
||||||
const STATUS_DRAFT = 0;
|
const STATUS_DRAFT = 0;
|
||||||
@ -441,7 +441,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Create a expedition line
|
* Create a expedition line
|
||||||
*
|
*
|
||||||
@ -473,7 +473,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Create the detail (eat-by date) of the expedition line
|
* Create the detail (eat-by date) of the expedition line
|
||||||
*
|
*
|
||||||
@ -483,7 +483,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function create_line_batch($line_ext, $array_options = 0)
|
public function create_line_batch($line_ext, $array_options = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$stockLocationQty = array(); // associated array with batch qty in stock location
|
$stockLocationQty = array(); // associated array with batch qty in stock location
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ class Expedition extends CommonObject
|
|||||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||||
|
|
||||||
$sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
|
$sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
|
||||||
$sql .= ", e.date_valid";
|
$sql .= ", e.date_valid";
|
||||||
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
|
||||||
$sql .= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
|
$sql .= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_address, e.date_delivery";
|
||||||
$sql .= ", e.fk_shipping_method, e.tracking_number";
|
$sql .= ", e.fk_shipping_method, e.tracking_number";
|
||||||
@ -574,7 +574,7 @@ class Expedition extends CommonObject
|
|||||||
$this->statut = $obj->fk_statut;
|
$this->statut = $obj->fk_statut;
|
||||||
$this->user_author_id = $obj->fk_user_author;
|
$this->user_author_id = $obj->fk_user_author;
|
||||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||||
$this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
$this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
||||||
$this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
$this->date_expedition = $this->db->jdate($obj->date_expedition); // TODO deprecated
|
||||||
$this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
|
$this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real
|
||||||
@ -868,7 +868,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Create a delivery receipt from a shipment
|
* Create a delivery receipt from a shipment
|
||||||
*
|
*
|
||||||
@ -877,7 +877,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function create_delivery($user)
|
public function create_delivery($user)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if ($conf->delivery_note->enabled)
|
if ($conf->delivery_note->enabled)
|
||||||
@ -974,7 +974,7 @@ class Expedition extends CommonObject
|
|||||||
$this->lines[$num] = $line;
|
$this->lines[$num] = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Add a shipment line with batch record
|
* Add a shipment line with batch record
|
||||||
*
|
*
|
||||||
@ -984,7 +984,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function addline_batch($dbatch, $array_options = 0)
|
public function addline_batch($dbatch, $array_options = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$num = count($this->lines);
|
$num = count($this->lines);
|
||||||
@ -1154,7 +1154,7 @@ class Expedition extends CommonObject
|
|||||||
* Cancel shipment.
|
* Cancel shipment.
|
||||||
*
|
*
|
||||||
* @param int $notrigger Disable triggers
|
* @param int $notrigger Disable triggers
|
||||||
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
||||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function cancel($notrigger = 0, $also_update_stock = false)
|
public function cancel($notrigger = 0, $also_update_stock = false)
|
||||||
@ -1360,7 +1360,7 @@ class Expedition extends CommonObject
|
|||||||
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
|
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
|
||||||
*
|
*
|
||||||
* @param int $notrigger Disable triggers
|
* @param int $notrigger Disable triggers
|
||||||
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
||||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function delete($notrigger = 0, $also_update_stock = false)
|
public function delete($notrigger = 0, $also_update_stock = false)
|
||||||
@ -1474,9 +1474,9 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
$main = MAIN_DB_PREFIX.'expeditiondet';
|
$main = MAIN_DB_PREFIX.'expeditiondet';
|
||||||
$ef = $main."_extrafields";
|
$ef = $main."_extrafields";
|
||||||
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".$this->id.")";
|
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = ".$this->id.")";
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
|
||||||
$sql .= " WHERE fk_expedition = ".$this->id;
|
$sql .= " WHERE fk_expedition = ".$this->id;
|
||||||
@ -1487,9 +1487,9 @@ class Expedition extends CommonObject
|
|||||||
$res = $this->deleteObjectLinked();
|
$res = $this->deleteObjectLinked();
|
||||||
if ($res < 0) $error++;
|
if ($res < 0) $error++;
|
||||||
|
|
||||||
// delete extrafields
|
// delete extrafields
|
||||||
$res = $this->deleteExtraFields();
|
$res = $this->deleteExtraFields();
|
||||||
if ($res < 0) $error++;
|
if ($res < 0) $error++;
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
@ -1570,7 +1570,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Load lines
|
* Load lines
|
||||||
*
|
*
|
||||||
@ -1578,7 +1578,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines()
|
public function fetch_lines()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $mysoc;
|
global $conf, $mysoc;
|
||||||
// TODO: recuperer les champs du document associe a part
|
// TODO: recuperer les champs du document associe a part
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
@ -1854,7 +1854,7 @@ class Expedition extends CommonObject
|
|||||||
return $this->LibStatut($this->statut, $mode);
|
return $this->LibStatut($this->statut, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Return label of a status
|
* Return label of a status
|
||||||
*
|
*
|
||||||
@ -1864,8 +1864,8 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function LibStatut($status, $mode)
|
public function LibStatut($status, $mode)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$labelStatus = $langs->trans($this->statuts[$status]);
|
$labelStatus = $langs->trans($this->statuts[$status]);
|
||||||
$labelStatusShort = $langs->trans($this->statutshorts[$status]);
|
$labelStatusShort = $langs->trans($this->statutshorts[$status]);
|
||||||
@ -2002,7 +2002,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
|
* Fetch deliveries method and return an array. Load array this->meths(rowid=>label).
|
||||||
*
|
*
|
||||||
@ -2030,7 +2030,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Fetch all deliveries method and return an array. Load array this->listmeths.
|
* Fetch all deliveries method and return an array. Load array this->listmeths.
|
||||||
*
|
*
|
||||||
@ -2039,7 +2039,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function list_delivery_methods($id = '')
|
public function list_delivery_methods($id = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$this->listmeths = array();
|
$this->listmeths = array();
|
||||||
@ -2066,7 +2066,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Update/create delivery method.
|
* Update/create delivery method.
|
||||||
*
|
*
|
||||||
@ -2110,7 +2110,7 @@ class Expedition extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* DesActivate delivery method.
|
* DesActivate delivery method.
|
||||||
*
|
*
|
||||||
@ -2308,7 +2308,7 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
|
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
|
||||||
*
|
*
|
||||||
@ -2316,7 +2316,7 @@ class Expedition extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function set_billed()
|
public function set_billed()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user;
|
global $user;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -2450,13 +2450,13 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('SHIPPING_REOPEN', $user);
|
$result = $this->call_trigger('SHIPPING_REOPEN', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors[] = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
@ -2482,7 +2482,7 @@ class Expedition extends CommonObject
|
|||||||
* @param int $hidedetails Hide details of lines
|
* @param int $hidedetails Hide details of lines
|
||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @param null|array $moreparams Array to provide more information
|
* @param null|array $moreparams Array to provide more information
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
*/
|
*/
|
||||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||||
@ -2550,8 +2550,8 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
public $origin_line_id;
|
public $origin_line_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
public $fk_origin_line;
|
public $fk_origin_line;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2560,42 +2560,42 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
public $fk_expedition;
|
public $fk_expedition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DoliDB Database handler.
|
* @var DoliDB Database handler.
|
||||||
*/
|
*/
|
||||||
public $db;
|
public $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float qty asked From llx_expeditiondet
|
* @var float qty asked From llx_expeditiondet
|
||||||
*/
|
*/
|
||||||
public $qty;
|
public $qty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float qty shipped
|
* @var float qty shipped
|
||||||
*/
|
*/
|
||||||
public $qty_shipped;
|
public $qty_shipped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Id of product
|
* @var int Id of product
|
||||||
*/
|
*/
|
||||||
public $fk_product;
|
public $fk_product;
|
||||||
public $detail_batch;
|
public $detail_batch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int Id of warehouse
|
* @var int Id of warehouse
|
||||||
*/
|
*/
|
||||||
public $entrepot_id;
|
public $entrepot_id;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float qty asked From llx_commandedet or llx_propaldet
|
* @var float qty asked From llx_commandedet or llx_propaldet
|
||||||
*/
|
*/
|
||||||
public $qty_asked;
|
public $qty_asked;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see $product_ref
|
* @see $product_ref
|
||||||
*/
|
*/
|
||||||
public $ref;
|
public $ref;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string product ref
|
* @var string product ref
|
||||||
@ -2608,87 +2608,87 @@ class ExpeditionLigne extends CommonObjectLine
|
|||||||
*/
|
*/
|
||||||
public $libelle;
|
public $libelle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string product label
|
* @var string product label
|
||||||
*/
|
*/
|
||||||
public $product_label;
|
public $product_label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string product description
|
* @var string product description
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see $product_desc
|
* @see $product_desc
|
||||||
*/
|
*/
|
||||||
public $desc;
|
public $desc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string product description
|
* @var string product description
|
||||||
*/
|
*/
|
||||||
public $product_desc;
|
public $product_desc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int rang of line
|
* @var int rang of line
|
||||||
*/
|
*/
|
||||||
public $rang;
|
public $rang;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float weight
|
* @var float weight
|
||||||
*/
|
*/
|
||||||
public $weight;
|
public $weight;
|
||||||
public $weight_units;
|
public $weight_units;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float weight
|
* @var float weight
|
||||||
*/
|
*/
|
||||||
public $length;
|
public $length;
|
||||||
public $length_units;
|
public $length_units;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float weight
|
* @var float weight
|
||||||
*/
|
*/
|
||||||
public $surface;
|
public $surface;
|
||||||
public $surface_units;
|
public $surface_units;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float weight
|
* @var float weight
|
||||||
*/
|
*/
|
||||||
public $volume;
|
public $volume;
|
||||||
public $volume_units;
|
public $volume_units;
|
||||||
|
|
||||||
// Invoicing
|
// Invoicing
|
||||||
public $remise_percent;
|
public $remise_percent;
|
||||||
public $tva_tx;
|
public $tva_tx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float total without tax
|
* @var float total without tax
|
||||||
*/
|
*/
|
||||||
public $total_ht;
|
public $total_ht;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float total with tax
|
* @var float total with tax
|
||||||
*/
|
*/
|
||||||
public $total_ttc;
|
public $total_ttc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float total vat
|
* @var float total vat
|
||||||
*/
|
*/
|
||||||
public $total_tva;
|
public $total_tva;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float total localtax 1
|
* @var float total localtax 1
|
||||||
*/
|
*/
|
||||||
public $total_localtax1;
|
public $total_localtax1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float total localtax 2
|
* @var float total localtax 2
|
||||||
*/
|
*/
|
||||||
public $total_localtax2;
|
public $total_localtax2;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|||||||
@ -124,100 +124,100 @@ if (empty($reshook))
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if ($action == 'setmode' && $user->rights->commande->creer)
|
if ($action == 'setmode' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setavailability' && $user->rights->commande->creer) {
|
if ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->availability(GETPOST('availability_id'));
|
$result = $object->availability(GETPOST('availability_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
if ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setconditions' && $user->rights->commande->creer)
|
if ($action == 'setconditions' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set incoterm
|
// Set incoterm
|
||||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// shipping method
|
// shipping method
|
||||||
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// warehouse
|
// warehouse
|
||||||
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
|
if ($action == 'setwarehouse' && $user->rights->commande->creer) {
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
|
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update_extras')
|
if ($action == 'update_extras')
|
||||||
{
|
{
|
||||||
$object->oldcopy = dol_clone($object);
|
$object->oldcopy = dol_clone($object);
|
||||||
|
|
||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
// Actions on extra fields
|
// Actions on extra fields
|
||||||
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
|
$result = $object->insertExtraFields('SHIPMENT_MODIFY');
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
|
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
|
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
|
||||||
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -280,61 +280,61 @@ if ($id > 0 || !empty($ref))
|
|||||||
// Ref customer
|
// Ref customer
|
||||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
|
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
|
||||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
|
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
|
||||||
// Thirdparty
|
// Thirdparty
|
||||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1);
|
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1);
|
||||||
// Project
|
// Project
|
||||||
if (!empty($conf->projet->enabled))
|
if (!empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
if ($action != 'classify') {
|
if ($action != 'classify') {
|
||||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&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.'">';
|
||||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
$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 .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||||
$morehtmlref .= '</form>';
|
$morehtmlref .= '</form>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!empty($object->fk_project)) {
|
if (!empty($object->fk_project)) {
|
||||||
$proj = new Project($db);
|
$proj = new Project($db);
|
||||||
$proj->fetch($object->fk_project);
|
$proj->fetch($object->fk_project);
|
||||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||||
$morehtmlref .= $proj->ref;
|
$morehtmlref .= $proj->ref;
|
||||||
$morehtmlref .= '</a>';
|
$morehtmlref .= '</a>';
|
||||||
} else {
|
} else {
|
||||||
$morehtmlref .= '';
|
$morehtmlref .= '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$morehtmlref .= '</div>';
|
$morehtmlref .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border centpercent tableforfield">';
|
print '<table class="border centpercent tableforfield">';
|
||||||
|
|
||||||
// Discounts for third party
|
// Discounts for third party
|
||||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||||
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
|
||||||
} else {
|
} else {
|
||||||
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
|
$filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
|
||||||
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
|
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td colspan="3">';
|
print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print dol_print_date($object->date, 'day');
|
print dol_print_date($object->date, 'day');
|
||||||
if ($object->hasDelay() && empty($object->date_livraison)) {
|
if ($object->hasDelay() && empty($object->date_livraison)) {
|
||||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -380,7 +380,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
} else {
|
} else {
|
||||||
print dol_print_date($object->date_livraison, 'dayhour');
|
print dol_print_date($object->date_livraison, 'dayhour');
|
||||||
if ($object->hasDelay() && !empty($object->date_livraison)) {
|
if ($object->hasDelay() && !empty($object->date_livraison)) {
|
||||||
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -390,43 +390,43 @@ if ($id > 0 || !empty($ref))
|
|||||||
//print '</td>';
|
//print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Shipping Method
|
// Shipping Method
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('SendingMethod');
|
print $langs->trans('SendingMethod');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editshippingmethod' && $user->rights->expedition->creer)
|
if ($action != 'editshippingmethod' && $user->rights->expedition->creer)
|
||||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if ($action == 'editshippingmethod') {
|
if ($action == 'editshippingmethod') {
|
||||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||||
} else {
|
} else {
|
||||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Warehouse
|
// Warehouse
|
||||||
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
|
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('Warehouse');
|
print $langs->trans('Warehouse');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($action != 'editwarehouse' && $user->rights->commande->creer)
|
if ($action != 'editwarehouse' && $user->rights->commande->creer)
|
||||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>';
|
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>';
|
||||||
print '</tr></table>';
|
print '</tr></table>';
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if ($action == 'editwarehouse') {
|
if ($action == 'editwarehouse') {
|
||||||
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
|
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
|
||||||
} else {
|
} else {
|
||||||
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
|
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Terms of payment
|
// Terms of payment
|
||||||
/*
|
/*
|
||||||
@ -502,14 +502,14 @@ if ($id > 0 || !empty($ref))
|
|||||||
$totalVolume = $tmparray['volume'];
|
$totalVolume = $tmparray['volume'];
|
||||||
if ($totalWeight || $totalVolume)
|
if ($totalWeight || $totalVolume)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
|
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
|
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
|
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
|
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||||
@ -517,22 +517,22 @@ if ($id > 0 || !empty($ref))
|
|||||||
// Incoterms
|
// Incoterms
|
||||||
if (!empty($conf->incoterm->enabled))
|
if (!empty($conf->incoterm->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||||
print $langs->trans('IncotermLabel');
|
print $langs->trans('IncotermLabel');
|
||||||
print '<td><td class="right">';
|
print '<td><td class="right">';
|
||||||
if ($user->rights->commande->creer) print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
if ($user->rights->commande->creer) print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($action != 'editincoterm')
|
if ($action != 'editincoterm')
|
||||||
{
|
{
|
||||||
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
|
print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
|
||||||
} else {
|
} else {
|
||||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$expe = new Expedition($db);
|
$expe = new Expedition($db);
|
||||||
@ -553,20 +553,20 @@ if ($id > 0 || !empty($ref))
|
|||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||||
{
|
{
|
||||||
// Multicurrency Amount HT
|
// Multicurrency Amount HT
|
||||||
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
|
||||||
print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
|
||||||
print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
|
||||||
print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total HT
|
// Total HT
|
||||||
@ -581,13 +581,13 @@ if ($id > 0 || !empty($ref))
|
|||||||
// Amount Local Taxes
|
// Amount Local Taxes
|
||||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
|
||||||
print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||||
}
|
}
|
||||||
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
|
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
|
||||||
print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total TTC
|
// Total TTC
|
||||||
@ -676,8 +676,8 @@ if ($id > 0 || !empty($ref))
|
|||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$prod = new Product($db);
|
$prod = new Product($db);
|
||||||
$prod->id = $objp->fk_product;
|
$prod->id = $objp->fk_product;
|
||||||
$prod->entity = $objp->entity;
|
$prod->entity = $objp->entity;
|
||||||
$prod->getMultiLangs();
|
$prod->getMultiLangs();
|
||||||
|
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
@ -700,25 +700,25 @@ if ($id > 0 || !empty($ref))
|
|||||||
$product_static->type = $type;
|
$product_static->type = $type;
|
||||||
$product_static->id = $objp->fk_product;
|
$product_static->id = $objp->fk_product;
|
||||||
$product_static->ref = $objp->ref;
|
$product_static->ref = $objp->ref;
|
||||||
$product_static->entity = $objp->entity;
|
$product_static->entity = $objp->entity;
|
||||||
|
|
||||||
$product_static->weight = $objp->weight;
|
$product_static->weight = $objp->weight;
|
||||||
$product_static->weight_units = $objp->weight_units;
|
$product_static->weight_units = $objp->weight_units;
|
||||||
$product_static->length = $objp->length;
|
$product_static->length = $objp->length;
|
||||||
$product_static->length_units = $objp->length_units;
|
$product_static->length_units = $objp->length_units;
|
||||||
$product_static->width = $objp->width;
|
$product_static->width = $objp->width;
|
||||||
$product_static->width_units = $objp->width_units;
|
$product_static->width_units = $objp->width_units;
|
||||||
$product_static->height = $objp->height;
|
$product_static->height = $objp->height;
|
||||||
$product_static->height_units = $objp->height_units;
|
$product_static->height_units = $objp->height_units;
|
||||||
$product_static->surface = $objp->surface;
|
$product_static->surface = $objp->surface;
|
||||||
$product_static->surface_units = $objp->surface_units;
|
$product_static->surface_units = $objp->surface_units;
|
||||||
$product_static->volume = $objp->volume;
|
$product_static->volume = $objp->volume;
|
||||||
$product_static->volume_units = $objp->volume_units;
|
$product_static->volume_units = $objp->volume_units;
|
||||||
|
|
||||||
$text = $product_static->getNomUrl(1);
|
$text = $product_static->getNomUrl(1);
|
||||||
$text .= ' - '.$label;
|
$text .= ' - '.$label;
|
||||||
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
|
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
|
||||||
$description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
|
$description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
|
||||||
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
||||||
|
|
||||||
// Show range
|
// Show range
|
||||||
@ -845,8 +845,8 @@ if ($id > 0 || !empty($ref))
|
|||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
// Bouton expedier sans gestion des stocks
|
// Bouton expedier sans gestion des stocks
|
||||||
if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
|
if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
|
||||||
{
|
{
|
||||||
if ($user->rights->expedition->creer)
|
if ($user->rights->expedition->creer)
|
||||||
{
|
{
|
||||||
@ -863,24 +863,24 @@ if ($id > 0 || !empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Bouton expedier avec gestion des stocks
|
// Bouton expedier avec gestion des stocks
|
||||||
|
|
||||||
if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT)
|
if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
print $langs->trans("ValidateOrderFirstBeforeShipment");
|
print $langs->trans("ValidateOrderFirstBeforeShipment");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
|
if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED))
|
||||||
{
|
{
|
||||||
if ($user->rights->expedition->creer)
|
if ($user->rights->expedition->creer)
|
||||||
{
|
{
|
||||||
//print load_fiche_titre($langs->trans("CreateShipment"));
|
//print load_fiche_titre($langs->trans("CreateShipment"));
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/card.php">';
|
print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/card.php">';
|
||||||
print '<input type="hidden" name="action" value="create">';
|
print '<input type="hidden" name="action" value="create">';
|
||||||
//print '<input type="hidden" name="id" value="'.$object->id.'">';
|
//print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
|
print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
|
||||||
print '<input type="hidden" name="origin" value="commande">';
|
print '<input type="hidden" name="origin" value="commande">';
|
||||||
print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
|
print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
|
||||||
print '<input type="hidden" name="projectid" value="'.$object->fk_project.'">';
|
print '<input type="hidden" name="projectid" value="'.$object->fk_project.'">';
|
||||||
|
|||||||
@ -2219,37 +2219,37 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
|
if ($user->socid) $sql .= ' AND ff.fk_soc = '.$user->socid;
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
|
$response->warning_delay = $conf->facture->fournisseur->warning_delay / 60 / 60 / 24;
|
||||||
$response->label = $langs->trans("SupplierBillsToPay");
|
$response->label = $langs->trans("SupplierBillsToPay");
|
||||||
$response->labelShort = $langs->trans("StatusToPay");
|
$response->labelShort = $langs->trans("StatusToPay");
|
||||||
|
|
||||||
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
$response->url = DOL_URL_ROOT.'/fourn/facture/list.php?search_status=1&mainmenu=billing&leftmenu=suppliers_bills';
|
||||||
$response->img = img_object($langs->trans("Bills"), "bill");
|
$response->img = img_object($langs->trans("Bills"), "bill");
|
||||||
|
|
||||||
$facturestatic = new FactureFournisseur($this->db);
|
$facturestatic = new FactureFournisseur($this->db);
|
||||||
|
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$response->nbtodo++;
|
$response->nbtodo++;
|
||||||
|
|
||||||
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
|
$facturestatic->date_echeance = $this->db->jdate($obj->datefin);
|
||||||
$facturestatic->statut = $obj->fk_statut;
|
$facturestatic->statut = $obj->fk_statut;
|
||||||
|
|
||||||
if ($facturestatic->hasDelay()) {
|
if ($facturestatic->hasDelay()) {
|
||||||
$response->nbtodolate++;
|
$response->nbtodolate++;
|
||||||
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
$response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
return $response;
|
return $response;
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$this->error = $this->db->error();
|
$this->error = $this->db->error();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user