Skip to content

Commit

Permalink
Latest changes for berlicrm-1.0.40
Browse files Browse the repository at this point in the history
  • Loading branch information
urban-thinking authored Dec 30, 2024
1 parent 4363f22 commit 36fd6a7
Showing 1 changed file with 105 additions and 32 deletions.
137 changes: 105 additions & 32 deletions db_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,51 +688,124 @@
echo '<br>module crmtogo done <br>';

// add recurring frequency
echo "add recurring frequency of 4 month<br>";
$query = 'update `vtiger_recurring_frequency` set recurring_frequency_id = 7, sortorderid = 7 where recurring_frequency_id = 6';
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
echo "sortoder done<br>";
$queryCheck = "SELECT 1 FROM `vtiger_recurring_frequency` WHERE `recurring_frequency` = ?";
$checkRes = $adb->pquery($queryCheck, array('every 4 months'));
if ($adb->num_rows($checkRes) === 0) {
// control sort order
echo "add recurring frequency of 4 month<br>";
$query = 'update `vtiger_recurring_frequency` set recurring_frequency_id = 7, sortorderid = 7 where recurring_frequency = ?';
$res = $adb->pquery($query, array('Yearly'));
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
echo "sortoder done<br>";

$query = "INSERT INTO `vtiger_recurring_frequency` (`recurring_frequency_id`, `recurring_frequency`, `sortorderid`, `presence`) VALUES (6, 'every 4 months', 6, 1)";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
$query = "INSERT INTO `vtiger_recurring_frequency` (`recurring_frequency_id`, `recurring_frequency`, `sortorderid`, `presence`) VALUES (6, 'every 4 months', 6, 1)";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}

$query = "UPDATE `vtiger_recurring_frequency_seq` SET id = 7";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
$query = "UPDATE `vtiger_recurring_frequency_seq` SET id = 7";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
}

echo "recurring frequency done<br>";

// add 14 days payment interval
echo "add 14 days payment interval<br>";
$query = 'UPDATE vtiger_payment_duration SET sortorderid = sortorderid + 1 WHERE sortorderid >= 1';
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
echo "sortoder done<br>";
$queryCheck = "SELECT 1 FROM `vtiger_payment_duration` WHERE `payment_duration` = ?";
$checkRes = $adb->pquery($queryCheck, array('Net 14 days'));

if ($adb->num_rows($checkRes) === 0) {
$query = 'UPDATE vtiger_payment_duration SET sortorderid = sortorderid + 1 WHERE sortorderid >= 1';
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
echo "sortoder done<br>";

$query = "INSERT INTO vtiger_payment_duration (payment_duration_id, payment_duration, sortorderid, presence) VALUES (1, 'Net 14 days', 1, 1)";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
$query = "INSERT INTO vtiger_payment_duration (payment_duration_id, payment_duration, sortorderid, presence) VALUES (1, 'Net 14 days', 1, 1)";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}

$query = "UPDATE `vtiger_payment_duration_seq` SET id = 4";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();
}
}
echo "14 days payment interval done<br>";

$query = "UPDATE `vtiger_payment_duration_seq` SET id = 4";
$res = $adb->pquery($query, array());
if(!$res) {
echo "Error: ".$adb->database->errorMsg();

echo '<br>module Projects update start<br>';
//update Projects module
$moduleFolders = array('packages/vtiger/mandatory', 'packages/vtiger/optional');
foreach($moduleFolders as $moduleFolder) {
if ($handle = opendir($moduleFolder)) {
while (false !== ($file = readdir($handle))) {
$packageNameParts = explode(".",$file);
if($packageNameParts[count($packageNameParts)-1] != 'zip'){
continue;
}
array_pop($packageNameParts);
$packageName = implode("",$packageNameParts);
if ($packageName =='Projects') {
$packagepath = "$moduleFolder/$file";
$package = new Vtiger_Package();
$module = $package->getModuleNameFromZip($packagepath);
if($module != null) {
$moduleInstance = Vtiger_Module::getInstance($module);
if($moduleInstance) {
updateVtlibModule($module, $packagepath);
}
else {
installVtlibModule($module, $packagepath);
}
}
}
}
closedir($handle);
}
}
echo '<br>module update Projects done <br>';

echo "14 days payment interval done<br>";

echo '<br>module berlimap update start<br>';
//update berlimap module
$moduleFolders = array('packages/vtiger/mandatory', 'packages/vtiger/optional');
foreach($moduleFolders as $moduleFolder) {
if ($handle = opendir($moduleFolder)) {
while (false !== ($file = readdir($handle))) {
$packageNameParts = explode(".",$file);
if($packageNameParts[count($packageNameParts)-1] != 'zip'){
continue;
}
array_pop($packageNameParts);
$packageName = implode("",$packageNameParts);
if ($packageName =='berlimap') {
$packagepath = "$moduleFolder/$file";
$package = new Vtiger_Package();
$module = $package->getModuleNameFromZip($packagepath);
if($module != null) {
$moduleInstance = Vtiger_Module::getInstance($module);
if($moduleInstance) {
updateVtlibModule($module, $packagepath);
}
else {
installVtlibModule($module, $packagepath);
}
}
}
}
closedir($handle);
}
}
echo '<br>module update berlimap done <br>';


$query = "UPDATE `vtiger_version` SET `tag_version` = ?";
Expand Down

0 comments on commit 36fd6a7

Please sign in to comment.