Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 23 additions & 28 deletions admin/shippableorder_setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT . "/core/class/extrafields.class.php";
require_once '../lib/shippableorder.lib.php';
dol_include_once('/abricot/includes/class/class.form.core.php');

// Translations
$langs->load("admin");
Expand All @@ -47,15 +46,15 @@

// Parameters
$action = GETPOST('action', 'alpha');

/*
* Actions
*/
if (preg_match('/set_(.*)/',$action,$reg))
{

$code=$reg[1];

$value = GETPOST($code);
if(is_array($value))$value = implode(',',$value);

Expand All @@ -71,7 +70,7 @@
dol_print_error($db);
}
}

if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
Expand Down Expand Up @@ -110,17 +109,15 @@
);

// Setup page goes here
$form=new Form($db);
$form = new Form($db);
$var=false;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";

print '<td align="center" width="100">'.$langs->trans("Value").'</td>';
print '</tr>';

$form=new TFormCore();
$formdoli=new Form($db);
// Add shipment as titles in invoice
$var=!$var;
print '<tr '.$bc[$var].'>';
Expand All @@ -135,17 +132,15 @@

dol_include_once('/product/class/html.formproduct.class.php');

$formDoli=new Form($db);
$formprod = new FormProduct($db);
$formprod->loadWarehouses();

$TWareHouse = array();
foreach($formprod->cache_warehouses as $id=>$ent) {
$TWareHouse[$id]=$ent['label'];
$TWareHouse[$id]=$ent['label'];
}


echo $formDoli->multiselectarray('SHIPPABLEORDER_SPECIFIC_WAREHOUSE',$TWareHouse,explode(',', getDolGlobalString('SHIPPABLEORDER_SPECIFIC_WAREHOUSE')));
echo $form->multiselectarray('SHIPPABLEORDER_SPECIFIC_WAREHOUSE',$TWareHouse,explode(',', getDolGlobalString('SHIPPABLEORDER_SPECIFIC_WAREHOUSE')), 5, 0, 'minwidth150');

print '<input type="submit" '.($ent_by_user_activated ? 'disabled="disabled"' : '').' class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
Expand All @@ -160,7 +155,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_ENTREPOT_BY_USER">';
print $formdoli->selectyesno("SHIPPABLEORDER_ENTREPOT_BY_USER", getDolGlobalString('SHIPPABLEORDER_ENTREPOT_BY_USER'),1);
print $form->selectyesno("SHIPPABLEORDER_ENTREPOT_BY_USER", getDolGlobalString('SHIPPABLEORDER_ENTREPOT_BY_USER'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -176,7 +171,7 @@
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_GENERATE_SHIPMENT_PDF">';
dol_include_once('/core/modules/expedition/modules_expedition.php');
$liste = ModelePdfExpedition::liste_modeles($db);
print $formdoli->selectarray('SHIPPABLEORDER_GENERATE_SHIPMENT_PDF', $liste, getDolGlobalString('SHIPPABLEORDER_GENERATE_SHIPMENT_PDF'), 1);
print $form->selectarray('SHIPPABLEORDER_GENERATE_SHIPMENT_PDF', $liste, getDolGlobalString('SHIPPABLEORDER_GENERATE_SHIPMENT_PDF'), 1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -191,7 +186,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_GENERATE_GLOBAL_PDF">';
print $formdoli->selectyesno("SHIPPABLEORDER_GENERATE_GLOBAL_PDF",getDolGlobalString('SHIPPABLEORDER_GENERATE_GLOBAL_PDF'),1);
print $form->selectyesno("SHIPPABLEORDER_GENERATE_GLOBAL_PDF",getDolGlobalString('SHIPPABLEORDER_GENERATE_GLOBAL_PDF'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -206,7 +201,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_CLOSE_ORDER">';
print $formdoli->selectyesno("SHIPPABLEORDER_CLOSE_ORDER", getDolGlobalString('SHIPPABLEORDER_CLOSE_ORDER'),1);
print $form->selectyesno("SHIPPABLEORDER_CLOSE_ORDER", getDolGlobalString('SHIPPABLEORDER_CLOSE_ORDER'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -219,7 +214,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLE_ORDER_ALLOW_ALL_LINE">';
print $formdoli->selectyesno("SHIPPABLE_ORDER_ALLOW_ALL_LINE",getDolGlobalString('SHIPPABLE_ORDER_ALLOW_ALL_LINE'),1);
print $form->selectyesno("SHIPPABLE_ORDER_ALLOW_ALL_LINE",getDolGlobalString('SHIPPABLE_ORDER_ALLOW_ALL_LINE'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -232,7 +227,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLE_ORDER_ALLOW_SHIPPING_IF_NOT_ENOUGH_STOCK">';
print $formdoli->selectyesno("SHIPPABLE_ORDER_ALLOW_SHIPPING_IF_NOT_ENOUGH_STOCK", getDolGlobalString('SHIPPABLE_ORDER_ALLOW_SHIPPING_IF_NOT_ENOUGH_STOCK'),1);
print $form->selectyesno("SHIPPABLE_ORDER_ALLOW_SHIPPING_IF_NOT_ENOUGH_STOCK", getDolGlobalString('SHIPPABLE_ORDER_ALLOW_SHIPPING_IF_NOT_ENOUGH_STOCK'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -245,7 +240,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLE_ORDER_AUTO_VALIDATE_SHIPPING">';
print $formdoli->selectyesno("SHIPPABLE_ORDER_AUTO_VALIDATE_SHIPPING", getDolGlobalString('SHIPPABLE_ORDER_AUTO_VALIDATE_SHIPPING'),1);
print $form->selectyesno("SHIPPABLE_ORDER_AUTO_VALIDATE_SHIPPING", getDolGlobalString('SHIPPABLE_ORDER_AUTO_VALIDATE_SHIPPING'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -258,7 +253,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLE_ORDER_DISABLE_AUTO_REDIRECT">';
print $formdoli->selectyesno("SHIPPABLE_ORDER_DISABLE_AUTO_REDIRECT",getDolGlobalString('SHIPPABLE_ORDER_DISABLE_AUTO_REDIRECT'),1);
print $form->selectyesno("SHIPPABLE_ORDER_DISABLE_AUTO_REDIRECT",getDolGlobalString('SHIPPABLE_ORDER_DISABLE_AUTO_REDIRECT'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -271,7 +266,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_NO_DEFAULT_CHECK">';
print $formdoli->selectyesno("SHIPPABLEORDER_NO_DEFAULT_CHECK",getDolGlobalString('SHIPPABLEORDER_NO_DEFAULT_CHECK'),1);
print $form->selectyesno("SHIPPABLEORDER_NO_DEFAULT_CHECK",getDolGlobalString('SHIPPABLEORDER_NO_DEFAULT_CHECK'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -284,7 +279,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_DONT_CHECK_DRAFT_SHIPPING_QTY">';
print $formdoli->selectyesno("SHIPPABLEORDER_DONT_CHECK_DRAFT_SHIPPING_QTY", getDolGlobalString('SHIPPABLEORDER_DONT_CHECK_DRAFT_SHIPPING_QTY'),1);
print $form->selectyesno("SHIPPABLEORDER_DONT_CHECK_DRAFT_SHIPPING_QTY", getDolGlobalString('SHIPPABLEORDER_DONT_CHECK_DRAFT_SHIPPING_QTY'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -298,7 +293,7 @@
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$newToken.'">';
print '<input type="hidden" name="action" value="set_SHIPPABLEORDER_SELECT_BY_LINE">';
print $formdoli->selectyesno("SHIPPABLEORDER_SELECT_BY_LINE",getDolGlobalString('SHIPPABLEORDER_SELECT_BY_LINE'),1);
print $form->selectyesno("SHIPPABLEORDER_SELECT_BY_LINE",getDolGlobalString('SHIPPABLEORDER_SELECT_BY_LINE'),1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
Expand All @@ -312,10 +307,10 @@
$db->close();

function create_extrafield($code, $label, $type, $elementtype, $options='') {

global $db;

$e = new ExtraFields($db);
$e->addExtraField($code, $label, $type, '', '', $elementtype, 0, 0, '', $options);

}
15 changes: 15 additions & 0 deletions class/actions_shippableorder.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?php
/* Copyright (C) 2025 ATM Consulting
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

require_once __DIR__ . '/../backport/v19/core/class/commonhookactions.class.php';

Expand Down
22 changes: 22 additions & 0 deletions class/shippableorder.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?php
/* Copyright (C) 2025 ATM Consulting
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
class ShippableOrder
{
function __construct (&$db) {
Expand Down Expand Up @@ -38,6 +53,13 @@ function __construct (&$db) {
}


/**
* Selects the shippable order status.
*
* @param string $htmlname The HTML name for the select element. Defaults to 'search_status'.
* @param array $selected The currently selected status(es).
* @return string HTML string for the select/multiselect element.
*/
public function selectShippableOrderStatus($htmlname='search_status', $selected) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';

Expand Down
4 changes: 2 additions & 2 deletions class/techatm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static function getLastModuleVersionUrl($moduleDescriptor){


/**
* @param $url
* @param string $url The URL to fetch JSON data from.
* @return false|object
*/
public function getJsonData($url){
Expand All @@ -170,7 +170,7 @@ public function getJsonData($url){
}

/**
* @param $url
* @param string $url The URL to fetch content from.
* @return false|string
*/
public function getContents($url){
Expand Down
22 changes: 16 additions & 6 deletions config.default.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
<?php

/* Copyright (C) 2025 ATM Consulting
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

if(is_file('../main.inc.php'))$dir = '../';
else if(is_file('../../../main.inc.php'))$dir = '../../../';
else $dir = '../../';
Expand All @@ -22,10 +37,5 @@
define('DB_DRIVER',$dolibarr_main_db_type);
}

if(!dol_include_once('/abricot/inc.core.php')) {
print $langs->trans('AbricotNotFound'). ' : <a href="http://wiki.atm-consulting.fr/index.php/Accueil#Abricot" target="_blank">Abricot</a>';
exit;
}



15 changes: 15 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?php
/* Copyright (C) 2025 ATM Consulting
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

require('config.default.php');

6 changes: 3 additions & 3 deletions core/modules/modShippableOrder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function __construct($db)
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->phpmin = array(7,0); // Minimum version of PHP required by module
$this->phpmin = array(7,4); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(16, 0); // Minimum version of Dolibarr required by module
$this->langfiles = array("shippableorder@shippableorder");

Expand All @@ -108,8 +108,8 @@ function __construct($db)
$this->const = array();

// Array to add new pages in new tabs
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@shippableorder:$user->rights->shippableorder->read:/shippableorder/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@shippableorder:$user->rights->othermodule->read:/shippableorder/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@shippableorder:$user->hasRight('shippableorder', 'read'):/shippableorder/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1
// 'objecttype:+tabname2:Title2:mylangfile@shippableorder:$user->hasRight('othermodule', 'read'):/shippableorder/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2
// 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
// where objecttype can be
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
Expand Down
Loading