Plugin Directory

Changeset 2426605


Ignore:
Timestamp:
11/26/2020 01:49:10 PM (5 years ago)
Author:
officegestpt
Message:

fix inventory update
add button to force update inventory

Location:
officegest/trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • officegest/trunk/officegest.php

    r2420184 r2426605  
    55 *   Plugin URI:   https://www.officegest.com/woocommerce
    66 *   Description:  A forma mais fácil de ligar a sua loja online com a sua faturação.
    7  *   Version:      1.0.33
     7 *   Version:      1.0.34
    88 *   Author:       OfficeGest
    99 *   Author URI:   https://www.officegest.com
     
    275275    $row = $wpdb->get_results(  "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA  = '". DB_NAME ."' AND table_name = 'officegest_articles' AND column_name = 'updated_at'" );
    276276    if(empty($row)){
    277         $wpdb->query("ALTER TABLE officegest_articles ADD updated_at TIMESTAMP DEFAULT current_timestamp");
     277        $wpdb->query("ALTER TABLE officegest_articles ADD updated_at TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
    278278    }
    279279    $row = $wpdb->get_results(  "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA  = '". DB_NAME ."' AND table_name = 'officegest_eco_parts' AND column_name = 'created_at'" );
     
    283283    $row = $wpdb->get_results(  "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA  = '". DB_NAME ."' AND table_name = 'officegest_eco_parts' AND column_name = 'updated_at'" );
    284284    if(empty($row)){
    285         $wpdb->query("ALTER TABLE officegest_eco_parts ADD updated_at TIMESTAMP DEFAULT current_timestamp");
     285        $wpdb->query("ALTER TABLE officegest_eco_parts ADD updated_at TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
    286286    }
    287287    $row = $wpdb->get_results(  "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA  = '". DB_NAME ."' AND table_name = 'officegest_eco_processes' AND column_name = 'created_at'" );
     
    291291    $row = $wpdb->get_results(  "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA  = '". DB_NAME ."' AND table_name = 'officegest_eco_processes' AND column_name = 'updated_at'" );
    292292    if(empty($row)){
    293         $wpdb->query("ALTER TABLE officegest_eco_processes ADD updated_at TIMESTAMP DEFAULT current_timestamp");
     293        $wpdb->query("ALTER TABLE officegest_eco_processes ADD updated_at TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
    294294    }
    295295
  • officegest/trunk/readme.txt

    r2420184 r2426605  
    55Tested up to: 5.5
    66Requires PHP: 5.6
    7 Stable tag: 1.0.33
     7Stable tag: 1.0.34
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3333
    3434== Changelog ==
     35= 1.0.34 =
     36Fix inventory sync
     37
    3538= 1.0.33 =
    3639Update import ecoauto parts images
  • officegest/trunk/src/OfficeGestDBModel.php

    r2420184 r2426605  
    19011901
    19021902    /**
    1903      * Clear ecoauto parts inventory
     1903     * Clear ecoauto parts inventory in woocommerce
    19041904     */
    19051905    public static function clearEcoAutoParts()
     
    19271927                if (empty($result)){
    19281928                    $p = new WC_Product_Simple($product->ID);
    1929                     $p->post_status='trash';
    1930                     $p->save();
     1929                    wp_update_post( array( 'ID' => $p->get_id(), 'post_status' => 'trash' ) );
    19311930                }
    19321931            }
  • officegest/trunk/src/Plugin.php

    r2420184 r2426605  
    232232                        $this->syncEcoautoPartsImages();
    233233                        break;
     234
     235                    case 'forcesyncpartsinventory':
     236                        $this->forceSyncPartsInventory();
     237                        break;
    234238
    235239                    case 'deubug':
     
    487491
    488492    /**
     493     * Force to sync woocommerce part with ecoauto last inventory
     494     */
     495    private function forceSyncPartsInventory() {
     496        ini_set( 'memory_limit',-1);
     497        ini_set( 'max_execution_time',-1);
     498        $forceSyncParts = (new Controllers\SyncEcoautoPartsInventory())->run();
     499        if ($forceSyncParts->countFoundRecord() > 0) {
     500            add_settings_error('officegest', 'officegest-sync-pecas-woo-updated', __('Foram criadas ' . $forceSyncParts->countFoundRecord() . ' peças.' ), 'updated');
     501        }
     502    }
     503
     504    /**
    489505     * Force to run officegest ecoauto processes sync
    490506     */
  • officegest/trunk/src/Templates/Containers/Settings/Articles.php

    r2420007 r2426605  
    123123            </td>
    124124        </tr>
     125        <?php } ?>
    125126        <tr>
    126127            <th scope="row" class="titledesc">
     
    143144            </td>
    144145        </tr>
    145         <?php } ?>
    146146    </tbody>
    147147</table>
  • officegest/trunk/src/Templates/EcoAuto/Utils.php

    r2420007 r2426605  
    1111                   href='<?= admin_url('admin.php?page=ecoauto&tab=utils&action=forcesyncparts') ?>'>
    1212                    <?= __('Importação das Peças') ?>
     13                </a>
     14            </td>
     15        </tr>
     16        <tr>
     17            <th style="padding: 2rem">
     18                <strong class="name"><?= __('Inventário') ?></strong>
     19                <p class='description'><?= __('Atualizar Inventário de Peças do Woocommerce') ?></p>
     20            </th>
     21            <td class="run-tool" style="padding: 2rem; text-align: right">
     22                <a class="button button-large"
     23                   href='<?= admin_url('admin.php?page=ecoauto&tab=utils&action=forcesyncpartsinventory') ?>'>
     24                    <?= __('Atualizar peças Woocommerce') ?>
    1325                </a>
    1426            </td>
Note: See TracChangeset for help on using the changeset viewer.